Sensoray 118 Manuel d'utilisateur Page 24

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 38
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 23
Sensoray Model 118 Smart A/D™ Instruction Manual 22 Commands: Sensor Acquisition
6.3 Sensor Acquisition
6.3.1 GetSensorData
Returns the most recently acquired sensor data from a
channel. The returned 16-bit integer value is scaled as a
function of the declared channel sensor type.
Regardless of sensor type, the returned value is always
represented in 16-bit two’s complement integer form.
The returned value must be multiplied by an appropriate
scalar to convert it to floating point engineering units.
Refer to Table9 on page36 for a list of sensor scalars.
Driver
// Read sensor data from specified channel in appropriate engineering units.
// Scalar converts integer sensor data to engineering units.
DOUBLE GetSensorData( USHORT BasePort, UCHAR Channel, DOUBLE Scalar )
{
SendByte( BasePort, Channel ); // request sensor data
return Scalar * (DOUBLE) ReadWord( BasePort ); // return scaled data
}
Example
// Read voltage at Channel 6, which is configured for 5V, 200uV/bit range.
DOUBLE Chan6volts = GetSensorData( MyBasePort, 6, SCALAR_VOLTS_5 );
Example
// Read temperature (in degrees C) at channel 4, which is configured for
// a type K thermocouple.
DOUBLE Chan4temp = GetSensorData( MyBasePort, 4, SCALAR_TC_K );
Command: (Chan)
Response: (DataMSB),(DataLSB)
Vue de la page 23
1 2 ... 19 20 21 22 23 24 25 26 27 28 29 ... 37 38

Commentaires sur ces manuels

Pas de commentaire