Read channel – Sensoray 417 User Manual
Page 18

17
Sensoray Model 417
Chapter
4
Programming
Read Channel
This command returns the most recently acquired sensor data from one channel. The returned
value is scaled as a function of the channel’s sensor type and is always represented as a signed,
16-bit integer. Refer to the Sensor Table at the end of this chapter for a list of sensor scaling fac-
tors.
COMMAND: (Chan)
RESPONSE:
(Data MSB), (Data LSB)
VB Code Example:
‘****************************************************************
‘ Return the most recent Engineering Units data from any channel.
‘****************************************************************
Sub ReadChannel!(BasePort%, Channel%, Scalar!)
‘ Send command to 417 (Opcode = 0)
Call SendByte(BasePort, Channel)
‘ Read chan data from 417 and convert to Engineering Units
ReadChannel = ReadWord(BasePort) * Scalar
End Sub
‘**************************************************************
‘ Assume channel 6 has been configured for 5-Volt input signal,
‘ 200uV per bit. Read the voltage measured at channel 6.
‘**************************************************************
Dim ChanSixVolts
As Single
Dim Scalar
As Single
Scalar = 0.0002
‘ From Sensor Tables, scalar = 200uV/bit
ChanSixVolts = ReadChannel(BaseAdrs, 6, Scalar)
‘**************************************************************
‘ Assume channel 4 has been configured for a K thermocouple,
‘ 0.1C/bit. Read the temperature measured at channel 4.
‘**************************************************************
Dim DegreesC As Single
DegreesC = ReadChannel(BaseAdrs, 4, 0.1)