Writing And Reading From I/O; I/O Output Program Examples - Octagon Systems XE–700 Reference Manual

Table of Contents

Advertisement

OUT 123h, 1
4. Write a bit pattern to appear at the outputs of the desired I/O port when the
I/O chip is put in "operation" mode; all input bits are unaffected. This step
ensures that known values appear when the I/O chip is placed in operation
mode.
5. Write a "3" to the control register (base register + 3). This places the I/O chip
back into "operation" mode:
OUT 123h, 3

Writing and reading from I/O

Writing to or reading from the desired I/O port is accomplished with single
program statements:
1. To write a bit pattern to the desired I/O port:
OUT 122h, FFh
All output bits of port C go high; all input bits are unaffected.
2. To read a bit pattern from the desired I/O port:
PORTC = INP(122h)
The byte read from port C is assigned to variable PORTC.

I/O output program examples

To configure ports A, B, and C as all outputs, issue the commands:
OUT 123h, 2
OUT 120h, FFh 'PortA'
OUT 121h, FFh 'PortB'
OUT 122h, FFh 'PortC'
OUT 123h, 3
Ports A, B, and C will now output all "1"s after issuing the following commands:
OUT 120h, FFh (portA)
OUT 121h, FFh (portB)
OUT 122h, FFh (portC)
or all "0"s after:
OUT 120h, 0 (portA)
OUT 121h, 0 (portB)
OUT 122h, 0 (portC)
66
(control register, preset mode)
(control register)
'Direction' Mode
'Operation' Mode

Advertisement

Table of Contents
loading

Table of Contents