Getallsensors, 2 getallsensors – Sensoray 118 User Manual
Page 25

Sensoray Model 118 Smart A/D™ Instruction Manual
23
Commands: Sensor Acquisition
6.3.2 GetAllSensors
Returns the most recent sensor data from all eight
channels, starting with channel 0. Data is returned from
all eight channels, including disabled channels. The
value returned from a disabled channel is indeterminate.
Sensor data is scaled as a function of the declared sensor
type connected to each channel. Refer to Table 9 on
page 36 for a list of sensor data scalars.
Driver
// Fetch sensor data from all eight Smart A/D channels into an array.
// The resulting integer data must be scaled to engineering units.
VOID GetAllSensors( USHORT BasePort, SHORT *pArray )
{
SendByte( BasePort, CMD_READ_ALL );
for ( UCHAR ch = 0; ch < 8; *pArray++ = ReadWord( BasePort, ch++ ) );
}
Example
// Read sensor data from all eight Smart A/D channels into an array, then
// return the voltage at channel 6, which is configured for 5V,200uV/bit range.
SHORT SensorData[8]; // Buffer to receive integer sensor data
GetAllSensors( MyBasePort, SensorData ); // get sensor data
// Fetch channel 6 integer sensor data from array & convert to volts.
DOUBLE Chan6volts = SCALAR_VOLTS * (DOUBLE) SensorData[6];
Command: (88)
Response:
(MSB0),(LSB0),(MSB1),(LSB1),(MSB2),(LSB2),(MSB3),(LSB3),
(MSB4),(LSB4),(MSB5),(LSB5),(MSB6),(LSB6),(MSB7),(LSB7)