V104
Chapter 3: Hardware
3-5
In MODE 0, the two groups of 12 pins can be programmed in sets of 4 and 8 pins to be inputs or outputs.
In MODE 1, each of the two groups of 12 pins can be programmed to have 8 lines of input or output. Of
the 4 remaining pins, 3 are used for handshaking and interrupt control signals. MODE 2 is a strobed bi-
directional bus configuration.
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.2 Mode Select Command Word
The V104 maps U11, the 82C55/uPD71055, in I/O space to 0xC100 to 0xC103.
The Command Register = 0xC103.
Port 0 = 0xC100.
Port 1 = 0xC101.
Port 2 = 0xC102.
The following code example will set all ports to output mode:
outportb(0xC103,0x80);
/* Mode 0 all output selection. */
outportb(0xC100,0x55);
/* Sets port 0 to alternating high/low I/O
pins. */
outportb(0xC101,0x55);
/* Sets port 1 to alternating high/low I/O
pins. */
outportb(0xC102,0x55);
/* Sets port 2 to alternating high/low I/O
pins. */
To set all ports to input mode:
outportb(0xC103,0x9f); /* Mode 0 all input selection. */
You may read the ports with:
inportb(0xC100); /* Port 0 */
inportb(0xC101); /* Port 1 */
inportb(0xC102); /* Port 2 */