Specifications

Little Board/P5i Technical Manual
3–22
can dynamically change the port between input and output modes by changing bit 5. A 1 in bit five sets
the port to input only; a 0 sets it to output only. Here is a sample of code for dynamically changing the
port direction after it is in Extended Mode.
;----------------------------------------------------------
; Code to change the parallel port direction to input
;----------------------------------------------------------
MOV DX,37Ah ;(27Ah for LPT2)
IN AL,DX
OR AL,20h ;set bit 5
OUT DX,AL
;
;----------------------------------------------------------
; Code to change the parallel port direction to output
;----------------------------------------------------------
MOV DX,37Ah ;(27Ah for LPT2)
IN AL,DX
AND AL,0DFh ;clear bit 5
OUT DX,AL
Besides the eight data lines, you can use the four control lines (-STROBE, -AUTOFD, -INIT, and -SEL
IN) as general purpose output lines. Similarly, you can use the five status lines (-ERROR, SEL OUT,
PAPER EMPTY, -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 write to its corresponding
bit in the control register. Refer to Table 3–7. If the line is inverting, write a 0, otherwise write a 1. This
will cause the line to float (pulled up by the 4.7K ohm resistors). When they float, you can use them as
inputs.
Bit 4 in the Control Register (Table 3–7) 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 port interrupt (IRQ7 or
IRQ5).