User Guide
23
' --------------------------------------------------------------------------
' Simple OS version and OS sig check for the SDM-SIO1
' --------------------------------------------------------------------------
'Variables and constants for the version number and signature checking
Public Ver_Value As String * 25 'Holds version as text string
Public Sig_Value As String * 4 'Holds SIG of OS as four byte HEX string
Public Sig_Value_Dec 'Holds sig as a decimal number
'Change this address to match the SDM-SIO1 SDM address.
Const SDM_Address=0
Dim Src As String * 1
Const cmd = 5 'constant cmd = 0..7
Const bytes_out = 1 'constant number of bytes out
Const bytes_val = 1 'constant bytes per value (1,2,4)
Const big_endian = 1 'constant 1 (big endian) or 0 (little endian)
Const delay_usec = -0 'constant delay between outgoing bytes (negative means delay also for incoming
bytes)
Const Ver_values_in = 20 'constant number of values to receive
Const Sig_values_in = 4 'constant number of values to receive
Sequentialmode
BeginProg
SDMSpeed (30) ‘Fix the speed
Ver_Value = ""
Sig_Value = ""
Scan(1,Sec,0,0)
'Use the generic SDM command to get extra info from the SDM-SIO1
'Ask for the firmware 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 (Sig_Value) 'Convert sig to decimal too.
Next Scan
EndProg