XP8500
44
s
Software Reference
Correcting Readings
The structure
adc4coeff
that holds the constants for correcting readings
is defined as follows.
struct adc4coeff {
int zero_offset;
float invgain;
}
This structure must be declared in an application.
The following equation, which the function
adc4_convert
uses, adjusts
A/D data from any channel voltage to correct for gain and offset errors.
voltage =
invgain
* (
zero_offset
A/D data).
The top sixty six bytes (addresses 446 to 511) of the XP8500 boards
EEPROM are reserved to store the calibration constants for the boards
eleven A/D channels (six bytes per channel).
The factory will calibrate Channels 0 to 3 based on the installed resistors
and store the constants in their appropriate locations in the EEPROM.
Channels 4 to 10 will come with nominal calibration constants of:
zero_offset
= 0 and
invgain
= -0.0006105
stored in their respective locations in the EEPROM.
Sample Program
The sample program
ADC4SMP1.C
in
PLC_EXP.LIB
reads data from an
XP8500 board over the PLCBus. The program reads the first four
(conditioned) channels of the XP8500 board, then displays the data
showing both the raw A/D readings and their equivalent voltages.
The program converts the raw readings to voltages based on the calibration
constants stored in the EEPROM. The XP8500 board stores these calibra-
tion constants in the last 66 bytes (6 bytes/channel) of its EEPROM.
Use the following steps to run the sample program.
1. Compile the program by pressing
F3
or by choosing
Compile
from the
COMPILE
menu. Dynamic C compiles and downloads the program
into the controllers memory. During compilation, Dynamic C rapidly
displays several messages in the compiling window, which is normal.
2. Run the program by pressing
F9
or by choosing
Run
from the
RUN
menu. It is also possible to single-step through the program with
F7
or
F8
.
3. To halt the program, press
<CTRL-Z>
.
4. To restart the program, press
F9
.
Содержание 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...