
Manual P104-DIO-96
14
Programming Example
The following programming example is provided as a guide to assist you in developing your working
software. In this example, the board base address is 2D00 hex and I/O lines of Port 0 are to be setup as
follows:
port
A
=
Input
port
B
=
Output
port C hi
=
Input
port C lo
=
Output
Configure bits of the Control Register as:
D7
1
Active Mode Set
D6
0
0
D5
0
0
D4
1
Port A = input
D3
1
Port C Hi = input
D2
0
0
D1
0
Port B = output
D0
0
Port C Lo = output
This corresponds to 98 hex. If the card base address is 2D00 hex, use the BASIC OUT command to write
to the control register as follows:
10
BASEADDR=&H2D00
20
OUT
B3,&H98
To read the inputs at Port A and the upper nybble of Port C, use the BASIC INPUT command:
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 Lo