beautypg.com

Read channel group – Sensoray 417 User Manual

Page 19

background image

Instruction Manual

18

Read Channel Group

This command returns the most recent sensor data from a group of eight channels. Sensor data is
scaled as a function of the declared sensor type for each channel, just as it is scaled when using the
Read Channel command. Refer to the Sensor Table at the end of this chapter for a list of sensor
data scalars.

A Group Code is included in the command to specify which eight-channel group is to be returned.
Group Code 0 returns channels 0-7, 1 returns channels 8-15, 2 returns channels 16-23, and 3
returns channels 24-31. The response string consists of channel data ordered by increasing channel
number, beginning with the lowest channel number in the group. For example, Group Code 2 will
return data in the following channel order: 16, 17, 18, ... , 23.

COMMAND: (104 + GroupCode)

RESPONSE:

(GroupChan 0 MSB), (GroupChan 0 LSB),
(GroupChan 1 MSB), (GroupChan 1 LSB),
(GroupChan 2 MSB), (GroupChan 2 LSB),
(GroupChan 3 MSB), (GroupChan 3 LSB),
(GroupChan 4 MSB), (GroupChan 4 LSB),
(GroupChan 5 MSB), (GroupChan 5 LSB),
(GroupChan 6 MSB), (GroupChan 6 LSB),
(GroupChan 7 MSB), (GroupChan 7 LSB)

VB Code Example:

‘*******************************************************************

‘ Read integer data from 8-channel group into DataArray().

‘*******************************************************************

Sub ReadChannelGroup(BasePort%, GroupCode%, DataArray%())

Dim Channel As Integer

‘ ChanNum and DataArray() index

Const READ_GROUP = 104

‘ READ CHANNEL GROUP command opcode

‘ Send command to 417 and read channel data into DataArray()

Call SendByte(BasePort, READ_GROUP + GroupCode)

For Channel = (8 * GroupCode) TO (8 * GroupCode + 7)

DataArray(Channel) = ReadWord(BasePort)

Next Channel

End Sub

‘******************************************************************

‘ Fetch integer data from all 32 channels.

‘******************************************************************

Dim Group

As Integer

‘ Channel Group specifier

Dim IntDataArray(0 To 31)

As Integer

‘ Array to hold chan data

For Group = 0 to 3

Call ReadChannelGroup(BaseAdrs, Group, IntDataArray())

Next Group