Little Board P6d Module
2-23
To change the port between input and output states, write a 1 to bit five of the control register to
set the port to its input state; or a 0 to set it to its output state. Here is a cod e samp le fo r
dynamically changing the port direction (after it is in Extended Mode).
;----------------------------------------------------------
; Code to change the parallel port direction to input
;----------------------------------------------------------
MOV DX,37A
IN AL,DX
OR AL,20h ;set bit 5 (input)
OUT DX,AL
;
;----------------------------------------------------------
; Code to change the parallel port direction to output
;----------------------------------------------------------
MOV DX,37Ah
IN AL,DX
AND AL,0DFh ;clear bit 5
OUT DX,AL

Using the Control Lines for Additional I/O

Besides the eight data lines, you can use the four control lines (STB*, AUTOFD*, INIT*, and
SELIN*) as general purpose output lines. Similarly, you can use the five status lines (ERROR*,
SLCT, PE, ACK*, and BUSY) as general purpose input lines.
You can read the four control lines and use them as input lines. These lines have open collector
drivers with 4.7k ohm pull-ups. To use a control line as an input line, you must first w rite to its
corresponding bit in the control register. If the line is inverting (*), write a 0, o therwise write a 1.
This will cause the line to float (pulled up by the 4.7k ohm resistors). When a lin e flo ats, you can
use it as an input.
Enabling the Parallel Port Interrupt
Bit 4 in the Control Register enables the parallel port interrupt. If this bit is high 1, then a rising
edge on the ACK* (IRQ) line will produce an interrupt on the parallel p ort interru pt, IRQ7. Table
2-22 lists the parallel port register bits. Parallel port register bit definitions are described in Table
2-23.