User`s manual
XP8500
42 s Software Reference
float adc4
_
convert( int data, struct
adc4coeff *cnvrsn )
Converts A/D data read by adc4
_
read( ) or adc4
_
set ( ) into
voltage equivalent. An adc4coeff structure pointed to by cnvrsn
stores the conversion constants for this function. The voltage is
voltage = cnvrsn->invgain *
( cnvrsn->zero
_
offset data).
RETURN VALUE: voltage value of the A/D data.
int adc4
_
readcoeff( unsigned int board
_
adr,
int chan, struct adc4coeff *cnvrsn )
Reads the constants for converting A/D data to voltages.
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.
cnvrsn is a pointer to the adc4coeff structure that stores the
constant zero_offset and the data-to-voltage conversion constant
invgain. The structure stores the constants as 6 continuous bytes in
reserved spaces of the XP8500s EEPROM.
RETURN VALUE: 0 if the constants are read successfully from the
EEPROM, 1 if the XP8500 board cannot be found, 2 if a problem
occurs while accessing the EEPROM.
int adc4
_
writecoeff( unsigned int board
_
adr,
int chan, struct adc4coeff *cnvrsn )
Stores the constants for converting A/D data to voltages.
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.
cnvrsn is a pointer to an adc4coeff structure that stores the
constant zero
_
offset and the data-to-voltage conversion constant
invgain. The structure stores the constants as 6 continuous bytes in
reserved spaces of the XP8500s EEPROM.
RETURN VALUE: 0 if the constants are stored successfully in the
EEPROM, 1 if the XP8500 board cannot be found, -2 if a problem
occurs while accessing the EEPROM, 3 if the upper 256 bytes of the
EEPROM are write-protected.