Chapter 3: Programming
Manual Number: 00431-024-14
Page 3-1
Chapter 3:
Programming
The DIO24-P uses the 8255 PPI to provide the 24 bits of input and output. These I/O are divided
into three ports, A, B, and C. Port C is further divided into two 4-bit ports, C-Lower and C-Upper.
The 8255 provides a Control Register at the cards base 3. This is a write only, 8-bit
register and is used to set the Mode and Direction of these 4 ports. On power-up or reset, all 24 I/
O lines are set as inputs. The 8255 should be configured by writing to the Control Register before
the chips ports are accessed, even as inputs.
Register Access
The DIO24-P is mapped into 4 bytes on any four byte boundary in the IBM I/O space. The address
definitions are:
BASE
0
Port A
Read/Write
1
Port B
Read/Write
2
Port C
Read/Write
3
Control Register
Write Only
To access the board from BASIC, for example:
1. Determine which ports are to be used for input and which for output. Determine the proper bit
pattern to write to the Control Register as discussed in the following section.
For example, a configuration of:
Port A
Input
Port B
Output
Port C-Upper Input
Port C-Lower Output
would have a bit pattern of 1001 1000 (Hex 98). Use the BASIC OUT command to write to the
Command Register:
10 BASEADDR = &H300
20 OUT B3, &H98
2. Port A and the upper 4 bits of Port C would be input ports and would be read. Port B and the
lower 4 bits of Port C would be outputs and would be written to:
30 X=INP(BASEADDR):Y=INP(B2)
‘READ PORTS A,C
40 PRINT X,Y
‘PRINT THE VALUES
50 OUT B1,255
‘TURNON ALL PORT B
60 OUT B2,15
‘TURNON 4 BITS OF C