System information
Analog Input
46 – Reference VSBC-6 Reference Manual
B
INARY
F
ORMAT
(0
TO
+5V
AND
0
TO
+10V O
NLY
)
The full analog input range is divided into 4096 steps. The output code (0000h) is associated
with an analog input voltage of 0 Volts (ground). All codes are considered positive.
The formulas for calculating analog or digital values are given by:
Digital =
Analog
Step
Analog = Step Digital
x
Where:
Analog = Applied voltage
Digital = A/D Conversion Data
Step = 0.002441406 Volts (0 to +10V Range)
0.001220703 Volts (0 to +5V Range)
Sample values are shown in the table below:
Table 23: Binary Data Format
±5V Input
Voltage
±10V Input
Voltage Hex Decimal Comment
+5.000000 +10.000000 — — Out of range
+4.998779 +9.997559 0FFFh 4095 Maximum voltage
+2.500000 +5.000000 0800h 2048 Half scale
+1.250000 +2.500000 0400h 1024 Quarter scale
+0.001220 +0.002441 0001h 1 1 LSB
0.000000 0.000000 0000h 0 Zero (ground input)
A
NALOG
I
NPUT
C
ODE
E
XAMPLE
The following code example illustrates the procedure for reading a ±10V analog voltage from
channel 0:
OUT 0E4h,18h ;Select channel 0 and begin conversion
BUSY: IN AL,0E2h ;Get A/D status
AND AL,04h ;Isolate the DONE bit
JZ BUSY ;Loop back if conversion isn't complete
DONE: MOV DX,00E4h ;Point to ADCLO register
IN AX,DX ;16-bit input reads ADCLO and ADCHI into AX