Hello All
I am using a CR3000 datalogger on a moving vehicle with a number of different sensors, including GPS, attached to the vehicle.
Currently, all sensors starts capturing data as soon as I turn the datalogger on. I do require the GPS to start locking on to satellites, but all other sensors are only needed when I get to the research plots that I would like to measure.
Is there a way to either use LoggerNet or a hardwired switch that will tell the program to start writing data to the defined tables in my program?
I have included my main program below.
Thanks in advance.
'Main program (program is making a measurement every second)
BeginProg
'Open RS232 port of communications 9600 BAUD Is the default:
SerialOpen (Com1,9600,0,0,2000)
SerialOpen (Com2,9600,0,0,2000)
SerialOpen (GPSPort,4800,3,0,1001)
Scan (1,Sec,0,0)
'GPS program
SerialInRecord (GPSPort,rawdata,36,0,&h0D0A,NBytesReturned,11)
CalculatedChecksum = CheckSum (rawdata,9,Len(rawdata) - 3)
CalculatedChecksum = CalculatedChecksum AND 255
ReportedChecksum = HexToDec(Right(rawdata,2))
If CalculatedChecksum = ReportedChecksum Then
If InStr (1,rawdata,"GPRMC",2) Then
RMCstring = rawdata
ElseIf InStr (1,rawdata,"GPGGA",2) Then
GGAstring = rawdata
EndIf
EndIf
SerialInRecord (GPSPort,rawdata,36,0,&h0D0A,NBytesReturned,11)
CalculatedChecksum = CheckSum (rawdata,9,Len(rawdata) - 3)
CalculatedChecksum = CalculatedChecksum AND 255
ReportedChecksum = HexToDec(Right(rawdata,2))
If CalculatedChecksum = ReportedChecksum Then
If InStr (1,rawdata,"GPRMC",2) Then
RMCstring = rawdata
ElseIf InStr (1,rawdata,"GPGGA",2) Then
GGAstring = rawdata
EndIf
EndIf
'parse rmc data
SplitStr (SubStrings(),RMCstring,",",16,5)
rmcid = SubStrings(1)
rmcutc = SubStrings(2)
rmcstatus = SubStrings(3)
rmclatitude = SubStrings(4)
rmcin_s_ind =SubStrings(5)
rmclongitude=SubStrings(6)
rmce_w_indicator=SubStrings(7)
rmcspeed=SubStrings(8)
rmccourse=SubStrings(9)
rmcutcdate=SubStrings(10)
rmcmagvariation=SubStrings(11)
rmcmage_w =Left(SubStrings(12),1)
rmcchecksum=Right(RMCstring,2)
'parse gga data
SplitStr (SubStrings(),GGAstring,",",16,5)
ggaid=SubStrings(1)
ggautc=SubStrings(2)
ggailatitude=SubStrings(3)
ggan_s_ind=SubStrings(4)
ggalongitude=SubStrings(5)
ggae_w_ind=SubStrings(6)
ggapositionfix=SubStrings(7)
gganumsatellites=SubStrings(8)
ggahdop=SubStrings(9)
ggaaltitude=SubStrings(10)
ggaaltutudeunits=SubStrings(11)
ggageoidsep=SubStrings(12)
ggageoidunits=Left(SubStrings(13),1)
ggachecksum=Right(GGAstring,2)
PanelTemp (PanelT,_60Hz)
Battery (BattV)
Therm109 (SBTempC_5713,1,3,Vx1,0,_60Hz,1.0,0)
VoltDiff (TargmV_5713,1,mV50,1,True ,0,_60Hz,1.0,0)
m_5713 = mC2_5713 * SBTempC_5713^2 + mC1_5713 * SBTempC_5713 + mC0_5713
b_5713 = bC2_5713 * SBTempC_5713^2 + bC1_5713 * SBTempC_5713 + bC0_5713
'Calculation of target temperature
SBTempK_5713 = SBTempC_5714 + 273.15
TargTempK_5713 = ((SBTempK_5713^4) + m_5713 * TargmV_5713 + b_5713)^0.25
TargTempC_5713 = TargTempK_5713 - 273.15
Therm109 (SBTempC_5714,1,7,Vx2,0,_60Hz,1.0,0)
VoltDiff (TargmV_5714,1,mV50,3,True ,0,_60Hz,1.0,0)
m_5714 = mC2_5714 * SBTempC_5714^2 + mC1_5714 * SBTempC_5714 + mC0_5714
b_5714 = bC2_5714 * SBTempC_5714^2 + bC1_5714 * SBTempC_5714 + bC0_5714
SBTempK_5714 = SBTempC_5714 + 273.15
TargTempK_5714 = ((SBTempK_5714^4) + m_5714 * TargmV_5714 + b_5714)^0.25
TargTempC_5714 = TargTempK_5714 - 273.15
SerialOut(Com1,"p33"+CHR(13),"",0,0)
SerialOut(Com2,"p33"+CHR(13),"",0,0)
SerialFlush(Com1)
SerialFlush(Com2)
SerialIn(SR50AData_6055,com1,200,13,50)
SerialIn(SR50AData_6917,com2,200,13,50)
SplitStr(ParseVals_6055,SR50AData_6055,"",5,0)
SplitStr(ParseVals_6917,SR50AData_6917,"",5,0)
Temp_Corr_Distance_6055=Raw_Distance_6055*(SQR((SBTempC_5713+273.15)/273.15))
Temp_Corr_Distance_6917=Raw_Distance_6917*(SQR((SBTempC_5714+273.15)/273.15))
Pasture_Height_6055=Initial_Distance - Temp_Corr_Distance_6055
Pasture_Height_6917=Initial_Distance - Temp_Corr_Distance_6917
CallTable IRR&SONAR
CallTable gpsdata
CallTable alldata
NextScan
EndProg
Every data table(DataTable instruction) has a TrigVar parameter. Usually, a constant for true is in that parameter to always output. You can use a variable in its place to control when you save data.
Thank you JDavis