XP8500
Software Reference
s
41
int adc4_sample( unsigned int board_adr,
int chan, int count, int *buf,
unsigned int divider )
Samples data from an A/D
chan
at uniform intervals of time.
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. In addition, passing channel numbers above 10 will access
the A/D chips internal nodes: passing
chan
= 11 will return (VREF+
VREF)/2, passing
chan
=
12 will return
VREF, and passing
chan
= 13 will return VREF+.
count
specifies the number of samples to collect.
buf
points to a buffer where the samples will be stored.
divider
specifies the sample rate based on the formula
sample rate
=
sysclock
/(20 *
divider
) , or
divider
=
sysclock
* (sample period/20) .
All data default to 12 bits unipolar mode with MSB first. The mini-
mum value for
divider
depends on the clock speed, the number of
I/O wait states, and the number of memory wait states. The number of
states is approximately
12 * ( 131 + 4 * 38 * Mwait) .
For example, a 9 MHz clock with 4 I/O wait states and 0 memory wait
states has a sample period of approximately 192 µs; for 1 memory
wait state, the sample period is approximately 240 µs. For a 6 MHz
clock with 4 I/O wait states and 0 memory wait states, the sample
period is approximately 290 µs; with 1 memory wait state the sample
period becomes approximately 357 µs.
RETURN VALUE: 0 if the data collection is successful, 1 if the
XP8500 board cannot be found, 2 if the sampling rate is too fast.
The function will not collect data if the sampling rate is set too fast.
This function turns off the interrupts for the duration of each
sampling period.
!
Содержание 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...