Chapter 3: Hardware
R-Engine-D
3-8
7
6
0
1
2
3
4
5
G R O U P 1
P o r t 2
( L o w e r )
P o r t 1
M o d e
0
1
0
1
0
1
O u t p u t
I n p u t
O u t p u t
I n p u t
M o d e 0
M o d e 1
G R O U P 2
P o r t 2
( U p p e r )
P o r t 0
M o d e
0
1
0
1
0 0
0 1
O u t p u t
I n p u t
O u t p u t
I n p u t
M o d e 0
M o d e 1
M o d e 2
1 X
C o m m a n d
S e l e c t
0
1
B i t
m a n i p u l a t i o n
M o d e
S e l e c t
Figure 3.3 Mode Select Command Word
The R-Engine-D maps U5, the 82C55/uPD71055, at base I/O address 0x1A0.
The ports/registers are offsets of this I/O base address.
The command register = 0x1A6; Port 0 = 0x1A0; Port 1 = 0x1A2; Port 2 = 0x1A4.
The following code example will set all ports to output mode:
outportb(0x1A6,0x80);
// mode 0 output, all pins
outportb(0x1A0,0x55);
// Port 0, alternating high/low on pins
outportb(0x1A2,0x55);
// Port 1, alternating high/low on pins
outportb(0x1A4,0x55);
// Port 2, alternating high/low on pins
To set all ports to input mode:
outportb(0x1A6, 0x9b); // mode 0 input, all pins