Set sensor type – Sensoray 417 User Manual
Page 15

Instruction Manual
14
Set Sensor Type
This command declares the type of sensor connected to a channel. Typically, this command is exe-
cuted once for each channel during the coprocessor initialization sequence (i.e., after a hard or soft
reset). Each execution of this command specifies the sensor type for a single channel, therefore 32
invocations must occur to declare sensor types for all 32 channels.
A two-byte sequence forms the command string. The first byte contains the Set Sensor Type com-
mand opcode and target channel number. The second byte contains a Sensor Definition Code
(SDC). Each sensor type is assigned a unique 8-bit SDC. Refer to the Sensor Table at the end of
this chapter for a complete list of sensor definition codes.
Notes:
1.
Undeclared channel sensor types default to the 5-Volt input range, SDC 0.
2.
Declaring an invalid sensor type may result in unpredictable behavior.
3.
Declaring a sensor type as “Disabled” inhibits scanning of the corresponding channel,
resulting in increased throughput for all remaining active channels.
4.
Sensor data is not available immediately after declaring a channel’s sensor type; you must
wait for one complete scan loop before valid sensor data can be accessed.
COMMAND: (32 + Chan), (SensorDefinitionCode)
RESPONSE:
NONE
VB Code Example:
‘**********************************************************
‘ Generic procedure used to declare any sensor type.
‘**********************************************************
Sub SetSensorType(BasePort%, Channel%, TypeCode%)
Const SET_TYPE = 32
‘ SET SENSOR TYPE command opcode
‘ Send the command string to the coprocessor board
Call SendByte(BasePort, SET_TYPE + Channel)
Call SendByte(BasePort, TypeCode)
End Sub
‘**********************************************************
‘ Configure channel 2 for interface to K thermocouple.
‘**********************************************************
Const TYPE_K = 3
‘ K thermocouple SDC (from Sensor Tables)
Call SetSensorType(BaseAdrs, 2, TYPE_K)