Hello,
I am polling the CR-1000 from a Linux computer. I think my SerialOut line is wrong because I don't always get my data when polling every minute. Or maybe this is a delay issue (not sure of datainterval and scanning time).
My main question is: How do I do to get my data available if I want to Polldata on the other end at any time?
Here is my code:
DataTable (PT_cal_Group,1,1000)
DataInterval (0,15,Sec,10)
Sample (1,batt_volt,FP2)
Sample (1,Temp,FP2)
Sample (3,PT,FP2)
EndTable
BeginProg
SerialOpen (ComRS232,115200,0,0,10000)
Scan (5,Sec,0,0)
TimeValue=PT_cal_Group.TimeStamp(6,1)
PanelTemp (Temp,250)
Battery (batt_volt)
VoltDiff (PT,3,mV250,1,True ,0,250,1.0,0)
CallTable PT_cal_Group
GetRecord(plop, PT_cal_Group, 1)
SerialIn(SensorInput, ComRS232, 100, 13, 16)
If InStr(1, SensorInput, "Polldata", 2) Then
SerialOut (ComRS232,"CS#1,"+plop,"",0,100)
EndIf
NextScan
EndProg
Thanks.
You are performing your SerialIn()/SerialOut() instructions inside of a five second scan so the worst case time for the datalogger program to recognise incoming requests is five seconds. If you need a faster response, you will have to either change the scan rate or you will need to move the code that performs serial I/O to a slow sequence. If you do the latter, I would suggest that you consider using a while loop inside of the slow sequence.