Select A/D Channel Number
Set C3 to C0 of port address+0 (low 8 bits) to select A/D channel number.
MSB






LSB




C3
C2
C1
C0

C3
C2
C1
C0
Input cannel
0
0
0
0
CH0
0
0
0
1
CH1
0
0
1
0
CH2
0
0
1
1
CH3
0
1
0
0
CH4
0
1
0
1
CH5
0
1
1
0
CH6
0
1
1
1
CH7
1
0
0
0
CH8
1
0
0
1
CH9
1
0
1
0
CH10
1
0
1
1
CH11
1
1
0
0
CH12
1
1
0
1
CH13
1
1
1
0
CH14
1
1
1
1
CH15
Hold the Input Signal
Set x bit of port address+0 (low 8 bits) to 0 to latch input signal.

MSB






LSB
x







Start A/D Conversion
Set SE0 and SE1 of port address+0 (high 8 bits) to select trig method for A/D converter.
MSB






LSB
x
x
x
TRI
INT
ENX
SE1
SE0

SE1 SE0 Selection
0
0
Software trigger by TRI bit
0
1
Software trigger by TRI bit
1
0
External trig from J1-2
1
1
Trig by 8254

1. By using software trigger
1.1 Set or reset INT bit to enable/disable interrupt.
INT Enable/Disable
0
Disable interrupt
1
Enable interrupt
1.2 Write 0 to TRI bit to start conversion.
2. By using 8254 trigger
2.1 Set or reset INT bit to enable/disable interrupt.
2.2 Set the ENX bit to 1.
2.3 Start 8254 counter.
The clock rate of 8254 is 1M, it is connected to counter 0, then the output of counter 0 is connected to counter 1, so that user need divide the clock by counter 0 then divide it by counter 1. The divided clock rate of counter 1 is used to trig A/D conversion
3. By using external trigger
3.1 Set or reset INT bit to enable/disable interrupt.
3.2 Set the ENX bit to 1.
3.3 Send "1" to "0" pulse from J1-02 pin.
Get Results
There are two methods to get the results of A/D conversion.
1. By using polling
After start conversion, wait about 50us to get the conversion result.
2. By using interrupt
2.1  Write an interrupt service routine.
2.2  After conversion, the adapter will generate an interrupt to start the interrupt service routine.
2.3  The interrupt service routine read 12 bits result from port address + 0.
MSB






LSB
0
0
0
0
11
10
9
8
7
6
5
4
3
2
1
0
2.4 The interrupt service routine read port address + 2 to clear interrupt signal.
How to Use D/A Converter
1. Write 12 bits D/A to port address + 2 (D/A channel 1).
MSB






LSB
0
0
0
0
11
10
9
8
7
6
5
4
3
2
1
0
2. Write 12 bits D/A to port address + 4 (D/A channel 2).
MSB






LSB
0
0
0
0
11
10
9
8
7
6
5
4
3
2
1
0
3.After 30us, the D/A converter will finish output procedure.
How to Use Digital Output Channel
Write data to port address + 6.
MSB






LSB
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
How to Use Digital Input Channel
1. Write FF to port address + 6.
2. Read digital input from port address + 6.