Hi there.
I need help to operate a SDM SIO4 module.
Recently we bought this module in order to add serials ports to a CR1000 datalogger.
I have read the module’s manual. This manual provides a few examples about configuration and operation, but for the CR10X datalogger.
I tried several options in CRBasic but I can’t communicate with the instruments.
I can communicate with the module.
I reset it using command and the button.
I deleted almost all the code to get a most simple program, just for this test.
I checked the led flashes once. And also the baud rate, stop bit, parity bits… All is fine.
I don’t use filters or checks. Now, I only want to get a response from the instrument.
I am doing checks using only a datalogger and a compass (TCM 2.5) in SDM-SIO4’s port1.
I have to send “C?” to the compass and the response is $Cxxx.x
My code:
Public PortStatus
Public Cmd5_Response(2)
Public Batt_Volt
Public WindSpd '(pulse)
Public WindDir
Public VaneDir
Public BuoyOrnt
Public BuoyCorrection
Public InternalTemp
Public outcompass As String * 16
Public InString_compass As String * 10
'Define Data Tables
DataTable(Met,True,-1)
DataInterval(0,5,Min,5)
Average(1,Batt_Volt,FP2,False)
Average(1,InternalTemp,FP2,False)
Sample(1,InString_compass,String)
EndTable
'Main Program
BeginProg
outcompass = "c?"+CHR(13)+CHR(10) 'Last compass data
Scan(30,Sec,1,0)
PulseCount(WindSpd,1,1,1,1,0.098,0)
BrHalf(VaneDir,1,mV2500,1,1,1,2500,True,0,_60Hz,355,0)
SDMSIO4 (outcompass,1,0,1,2304,0,0,4,1.0,0)
Delay (1,3,Sec) '1 sec delay
SDMSIO4 (InString_compass,1,0,1,4,0,0,10,1.0,0)
SDMSIO4 (Cmd5_Response(),1,0,5,5,0,0,2,1.0,0)
SDMSIO4 (PortStatus,1,0,5,8,0,0,1,1.0,0)
SplitStr (BuoyOrnt,InString_compass,"$C",1,0)
'Make Buoy Orientation between 0 and 360
BuoyOrnt = BuoyOrnt MOD 360
If BuoyOrnt < 0 Then
BuoyOrnt = BuoyOrnt + 360
EndIf
'Make VaneDir between 0 and 360
VaneDir = VaneDir MOD 360
If VaneDir < 0 Then
VaneDir = VaneDir + 360
EndIf
'WindDir is wind direction magnetic such that 0 is wind FROM magnetic North
BuoyCorrection = 180.0
WindDir = BuoyOrnt + VaneDir - BuoyCorrection
WindDir = WindDir MOD 360
If WindDir < 0 Then
WindDir = WindDir + 360
EndIf
If WindDir >=360 Then WindDir =360
If WindDir <0 Then WindDir=0
If TimeIntoInterval (0,5,Min) = -1
Battery(Batt_Volt)
PanelTemp(InternalTemp,_60Hz)
Delay(1,10,Sec)
EndIf
CallTable Met
NextScan
EndProg
The result is:
InString_compass = nothing
Cmd5_Response(0) = 1
Cmd5_Response(1) = 0
PortStatus = 0
I have tried several ways to send the code to the compass and get the response, but none of them worked out.
Could you please help me with this?.
I can’t see what I’m doing wrong.
* Last updated by: JavierG on 2/23/2012 @ 9:41 AM *