Programming Example (Basic)
The following example in BASIC is provided as a guide to assist you in developing your working
software. In this example, the board base address is 2D0 hex and the I/O lines of group 0 are to be
setup as follows:
Port A = Input
Port C Hi = Input
Port B = Output
Port C Lo = Output
The first step is to configure the control register. Configure bits of the control register as:
D7 1 Active Mode Set
D6 0 Mode 0
D5 0 Mode 0
D4 1 Port A = Input
D3 1 Port C Hi = Input
D2 0 Mode 0
D1 0 Port B = Output
D0 0 Port C Lo = Output
This corresponds to 98 hex. If the board address is 2D0 hex, use the BASIC OUT command to write to
the control register as follows:
10
BASEADDR=&H2D0
20
OUT
B3,&H98
To read the inputs at Port A and the upper nybble of Port C:
30
X=INP(BASEADDR)
‘Read Port A
40
Y=INP(B2)/16
'Read Port C Hi
To set outputs high (1) at Port B and the lower nybble of Port C:
50
OUT B1,&HFF
'Turn on all Port B bits
60
OUT B2,&HF
‘Turn on all bits of Port C lower nybble
Enabling/ Disabling I/O Buffers
When using the tristate mode (Jumper in the TST position), the method to disable the I/O buffers
involved writing a control word to the Control Register at Base A3 and Base A7. This
control word was required to have bit D7 (the most significant bit) set.
That meant that the PPI translated it as an "active mode set" and reset the output data latches to "zero"
on all output ports and the output buffers were disabled. However, if the buffers are to be enabled at a
later time, the output latches will be in a "zero" state. For example, if all the outputs were 1's, they will
now be 0's and the output buffers will be disabled. This problem can be resolved as follows.
Manual 104-DIO-48E, 24E
18