Sensoray 417 User Manual
Page 11

Instruction Manual
10
‘*******************************************************************
‘ Read a signed, 16-bit integer value from the 417, MSB first.
‘*******************************************************************
Function ReadWord%(BasePort As Integer)
Dim Lval As Long
‘ Handshake the high byte (MSB) from Model 417
Lval = ReadByte(BasePort)
‘ Handshake LSB from Model 417 & concatenate with high byte
Lval = Lval * 256 + ReadByte(BasePort)
‘ Adjust sign, if necessary
If Lval > 32767 Then Lval = Lval - 65536
‘ Set return value
ReadWord = Lval
End Function
‘*******************************************************************
‘ Send a signed, 16-bit integer value to the 417, MSB first.
‘*******************************************************************
Sub SendWord(BasePort As Integer, Value As Integer)
‘ Handshake the high byte (MSB) to Model 417
Call SendByte(BasePort, Value \ 256)
‘ Handshake the low byte (LSB) to Model 417
Call SendByte(BasePort, Value)
End Sub