Sensoray 118 Manual do Utilizador Página 24

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 38
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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)
Vista de página 23
1 2 ... 19 20 21 22 23 24 25 26 27 28 29 ... 37 38

Comentários a estes Manuais

Sem comentários