XP8500
40
s
Software Reference
int adc4_set( unsigned int board_adr,
int chan )
Sets the A/D converter chip to the specified channel (
chan
)
.
PARAMETERS:
board_adr
is the physical address of the XP8500
board, defined as 0000 1100 ppxy.
chan
ranges from 0 to 10, corresponding to the boards 11 A/D
channels. Passing
chan
= 11 will return (VREF+ VREF)/2,
passing
chan
=
12 will return VREF, passing
chan
= 13 will return
VREF+, and passing
chan
= 14 will put the boards A/D chip, a
TLC2543, into software power-down mode. All data defaults to 12
bits unipolar mode with MSB first. The returned datas nominal zero
point is 4095 for unipolar conversion and 2047 for bipolar conversion.
RETURN VALUE: whole number from 0 to 4095 from the last A/D
conversion (caller should be aware of which A/D channel was set
previously); 1 if the specified XP8500 board cannot be found.
Because the A/D converter chip is hardwired to return a
converted value while accepting new settings,
adc4_set
returns a value converted with the chips
previous
settings.
Therefore, subsequent calls to
adc4_set
using the same
arguments will return conversions using the
new
settings.
The key to understanding the difference between
adc4_read
and
adc4_set
is the pipelined nature of the A/D converter.
By design, shifting a command
into
the A/D converter simulta-
neously shifts a reading
out.
However, the A/D converter
made this shifted-out reading according to the
previous
commands setup.
So to return a correct reading for a single function call, the
adc4_read
command shifts a command into the A/D con-
verter, discards the resulting reading, and makes a second read
from the now properly set up A/D converter. The faster
adc4_set
function simply returns the first reading. Succeed-
ing
adc4_set
calls will return proper readings with the same
arguments.
!
Содержание Exp-A/D12
Страница 6: ...vi s Contents XP8500 and Exp A D12 Blank...
Страница 10: ...XP8500 and Exp A D12 x s About This Manual Blank...
Страница 11: ...XP8500...
Страница 12: ...Blank...
Страница 49: ...EXP A D12...
Страница 50: ...Blank...
Страница 58: ...Exp A D12 58 s Getting Started Blank...
Страница 64: ...Exp A D12 64 s I O Configurations Blank...
Страница 73: ...APPENDICES...
Страница 74: ...Blank...
Страница 86: ...XP8500 and Exp A D12 86 s PLCBus Blank...
Страница 87: ...XP8500 and Exp A D12 Specifications s 87 APPENDIX B SPECIFICATIONS...
Страница 92: ...XP8500 and Exp A D12 92 s Specifications Blank...
Страница 97: ...XP8500 and Exp A D12 Simulated PLCBus Connection s 97 APPENDIX D SIMULATED PLCBUS CONNECTION...
Страница 99: ...XP8500 and Exp A D12 Technical Circuit Details s 99 APPENDIX E TECHNICAL CIRCUIT DETAILS...
Страница 104: ...XP8500 and Exp A D12 104 s Technical Circuit Details Blank...