Checking The Operating System Version And Signature - Campbell SDM-SIO1A Instruction Manual

Serial input/output module
Hide thumbs Also See for SDM-SIO1A:
Table of Contents

Advertisement

CRBasic Example 8-1. Checking the Operating System Version and Signature
' --------------------------------------------------------------------------
' Simple OS version and OS sig check for the SDM-SIO1A
' --------------------------------------------------------------------------
'Variables and constants for the version number and signature checking
Public
Ver_Value
As String
Public
Sig_Value
As String
Public
Sig_Value_Dec
'Change this address to match the SDM-SIO1A SDM address.
Const
SDM_Address=0
Dim
Src
As String
* 1
Const
cmd = 5
Const
bytes_out = 1
Const
bytes_val = 1
Const
big_endian = 1
Const
delay_usec = -0
Const Ver_values_in = 20
Const Sig_values_in = 4
Sequentialmode
BeginProg
SDMSpeed
(30)
'Fix the speed
Ver_Value = ""
Sig_Value = ""
Scan(1,Sec,0,0)
'Use the generic SDM instruction to get extra info from the SDM-SIO1A
'Ask for the operating system version
Src = CHR(1)
SDMGeneric(Ver_Value,SDM_Address,cmd,bytes_out,Src,Ver_values_in,bytes_val, big_endian,delay_usec)
'Read signature
Src = CHR(2)
SDMGeneric(Sig_Value,SDM_Address,cmd,bytes_out,Src,Sig_values_in,bytes_val,big_endian,delay_usec)
Sig_Value_Dec =
HexToDec
Next Scan
EndProg
what the operating system version is (Ver_value) and the signature of the
operating system (Sig_value).
* 25
'Holds version as text string
* 4
'Holds SIG of OS as four byte HEX string
'Holds sig as a decimal number
'constant cmd = 0..7
'constant number of bytes out
'constant bytes per value (1,2,4)
'constant 1 (big endian) or 0 (little endian)
'constant delay between outgoing bytes (negative means delay also
'for incoming bytes)
'constant number of values to receive
'constant number of values to receive
(Sig_Value)
'Convert sig to decimal too.
SDM-SIO1A Serial Input/Output Module
27

Advertisement

Table of Contents
loading

Table of Contents