Hello,
Under what cincunstaces the variables (using preserve variables) will be erased? a watchdog can erase the values?
Last time i program a station with preserve variables and use a variable to correct an offset in the field, but after some time i note that variable was back to the original value "cero", under what circunstances this can happend?
i Dont make any change in the program or the station, except download data, i note that some watchdog errors occur in the status table.
Thank you
Regards
PD.- I want to use preserve variables to calibrate easy in the field some sensors like an evaporation pan, changing the offset and multiplier direct in the public variables, but i want to be shure that this values dont will change over the time (except of course if i change the program or something similar.
A watchdog can mess things up. Depending on the condition that caused the datalogger to watchdog, perserve variables could possibly not happen.
What version of the operating system are you running? Are you running the latest version? The could resolve the watchdog issue you are seeing.
Thank you, im tring to update the OS to the latest version, but some stations are very far and is difficult.
Do you know a way to write a constant in the program in some way in the field?
Normally i use public variables and preserve variable to change or calibrate evaporation pans in the field very easy for the client, calculate the coeficients and then write the multiplier and offset direct over the public variables with no need to change the program with new constants.
Do you have any idea?
Thanks!
This method is a bit involved, but will write values to a file on the datalogger. It will reload those values when the program starts.
Public PTemp, batt_volt Const SettingsCount = 9 Public MySettings(SettingsCount) = {1,2,3,4,5,6,7,8,9} 'Default values Dim LastSettings(SettingsCount) Dim FileHandle As Long Dim myString As String * 128 Dim i As Long Dim SettingsChanged As Boolean 'Define Data Tables. DataTable (Test,1,9999) 'Set table size to # of records, or -1 to autoallocate. DataInterval (0,15,Sec,10) Minimum (1,batt_volt,FP2,0,False) Sample (1,PTemp,FP2) EndTable 'Main Program BeginProg FileHandle = FileOpen ("USR:Settings.ini","r",0) If FileSize(FileHandle) > 1 Then 'If a non-empty file exists FileRead (FileHandle,myString,128) 'Read settings to a string SplitStr (MySettings(),myString,",",SettingsCount,5) 'Split string into the settings EndIf FileClose(FileHandle) Move (LastSettings(),SettingsCount,MySettings(),SettingsCount) Scan (1,Sec,0,0) PanelTemp (PTemp,250) Battery (batt_volt) CallTable Test 'Write settings to a file if they have changed For i = 1 To SettingsCount If LastSettings(i) <> MySettings(i) Then SettingsChanged = true Next i If SettingsChanged Then Erase(myString) For i = 1 To SettingsCount myString &= FormatFloat (MySettings(i),"%g") & "," Next i FileManage ("USR:Settings.ini",8) 'Delete old settings file FileHandle = FileOpen ("USR:Settings.ini","w",0) 'Open new file FileWrite (FileHandle,myString,0) 'Write settings string to file FileClose(FileHandle) 'Don't forget to close the file SettingsChanged = false EndIf Move (LastSettings(),SettingsCount,MySettings(),SettingsCount) NextScan EndProg
Thank you Jacob,
I will test and see how it works for my aplication
Regards!!
:)