Sounds like a good practice to stop the timer at the start of a function call, but doubt it would solve the problem.
I am currently trying the GETIO method again:
TSET 3, 3600 //create timer for every hour
TSET 1, 1 //create a timer every seconds
ONTIMER 3, “GOTO MoveData”
ONTIMER 1, “GOTO WriteRecordA” //every two seconds go to the first write command which then leads onto the seconds write command.
END
//Funcion used to shorten the GETIO function to fit more IO value calls on the line
FUNCTION G($T)
$G = GETIO $T
ENDFN
WriteRecordA:
T$ = TIME$ //grab current time
$Date$ = T$ (1 TO 2) + T$ (4 To 5) + T$ (7 TO 10) // Get the current date
fileNameA$ = "/Datalog Part A " + $Date$ // create the filenames of the split data
fileNameB$ = "/Datalog Part B " + $Date$
fileNameC$ = "/Datalog Part C " + $Date$
fileNameD$ = "/Datalog Part D " + $Date$
// Now below we will verify if the file exists on first cycle. If it doesn’t we will create the file and write the header. If it does exist we will just append the tag data.
SETSYS PRG, “RESUMENEXT”, 1 //this command means to continue even if an error occures, this is needed so that the program continues if there is no file already created (which produces an error)
CLOSE 1
OPEN fileNameA$ FOR TEXT INPUT AS 1 //attempt to open the file
ErrorReturned = GETSYS PRG, “LSTERR” //record if there is an error or not
IF(ErrorReturned = 33) THEN //if there is an error, create a new file and add headers to each column
CLOSE 1
OPEN fileNameA$ FOR TEXT OUTPUT AS 1
PUT 1, “Time” “LS-B10” //csv headers, to change later
CLOSE 1
Print "New File Created Called " + fileNameA$
ELSE //if there is no error then the file already exists and can just be appended with new data points
CLOSE 1
OPEN fileNameA$ FOR TEXT APPEND AS 1
PUT 1,T$@G(1)@G(2)@G(3)@G(4)@G(5)@G(6)@G(7)@G(8)@G(9)@G(10)@G(11)@G(12)@G(13)@G(14)@G(15)@G(16)@G(17)@G(18)@G(19)@G(20)@G(21)@G(22)@G(23)@G(24)@G(25)@G(26)@G(27)@G(28)@G(29)@G(30)@G(31)@G(32)@G(33)@G(34)@G(35)@G(36)@G(37)@G(38)@G(39)@G(40)
CLOSE 1
Print “New Data Inputted in A”
ENDIF
WriteRecordB:
SETSYS PRG, “RESUMENEXT”, 3
CLOSE 3
OPEN fileNameB$ FOR TEXT INPUT AS 3
ErrorReturned = GETSYS PRG, “LSTERR”
IF(ErrorReturned = 33) THEN
CLOSE 3
OPEN fileNameB$ FOR TEXT OUTPUT AS 3
PUT 3, “Time” “LS-B10”
CLOSE 3
Print "New File Created Called " + fileNameB$
ELSE
CLOSE 3
OPEN fileNameB$ FOR TEXT APPEND AS 3
PUT 3,T$@G(1)@G(2)@G(3)@G(4)@G(5)@G(6)@G(7)@G(8)@G(9)@G(10)@G(11)@G(12)@G(13)@G(14)@G(15)@G(16)@G(17)@G(18)@G(19)@G(20)@G(21)@G(22)@G(23)@G(24)@G(25)@G(26)@G(27)@G(28)@G(29)@G(30)@G(31)@G(32)@G(33)@G(34)@G(35)@G(36)@G(37)@G(38)@G(39)@G(40)
CLOSE 3
Print “New Data Inputted in B”
ENDIF
WriteRecordC:
SETSYS PRG, “RESUMENEXT”, 5
CLOSE 5
OPEN fileNameC$ FOR TEXT INPUT AS 5
ErrorReturned = GETSYS PRG, “LSTERR”
IF(ErrorReturned = 33) THEN
CLOSE 5
OPEN fileNameC$ FOR TEXT OUTPUT AS 5
PUT 5, “Time” “LS-B10”
CLOSE 5
Print "New File Created Called " + fileNameC$
ELSE
CLOSE 5
OPEN fileNameC$ FOR TEXT APPEND AS 5
PUT 5,T$@G(1)@G(2)@G(3)@G(4)@G(5)@G(6)@G(7)@G(8)@G(9)@G(10)@G(11)@G(12)@G(13)@G(14)@G(15)@G(16)@G(17)@G(18)@G(19)@G(20)@G(21)@G(22)@G(23)@G(24)@G(25)@G(26)@G(27)@G(28)@G(29)@G(30)@G(31)@G(32)@G(33)@G(34)@G(35)@G(36)@G(37)@G(38)@G(39)@G(40)
CLOSE 5
Print “New Data Inputted in C”
ENDIF
WriteRecordD:
SETSYS PRG, “RESUMENEXT”, 7
CLOSE 7
OPEN fileNameD$ FOR TEXT INPUT AS 7
ErrorReturned = GETSYS PRG, “LSTERR”
IF(ErrorReturned = 33) THEN
CLOSE 7
OPEN fileNameD$ FOR TEXT OUTPUT AS 7
PUT 7, “Time” “LS-B10”
CLOSE 7
Print "New File Created Called " + fileNameD$
ELSE
CLOSE 7
OPEN fileNameD$ FOR TEXT APPEND AS 7
PUT 7,T$@G(1)@G(2)@G(3)@G(4)@G(5)@G(6)@G(7)@G(8)@G(9)@G(10)@G(11)@G(12)@G(13)@G(14)@G(15)@G(16)@G(17)@G(18)@G(19)@G(20)@G(21)@G(22)@G(23)@G(24)@G(25)@G(26)@G(27)@G(28)@G(29)@G(30)@G(31)@G(32)@G(33)@G(34)@G(35)@G(36)@G(37)@G(38)@G(39)@G(40)
CLOSE 7
Print “New Data Inputted in D”
ENDIF
END
MoveData:
T$ = TIME$
$Date$ = T$ (1 TO 2) + T$ (4 To 5) + T$ (7 TO 10) // Get the current date
SETSYS PRG, “RESUMENEXT”, 1
FS “mv”, "/usr/Datalog Part A " + $Date$, "/usr/sdext/Datalog set/Datalog Part A " + $Date$ + T$(12 To 13)
FS “mv”, "/usr/Datalog Part B " + $Date$, "/usr/sdext/Datalog set/Datalog Part B " + $Date$ + T$(12 To 13)
FS “mv”, "/usr/Datalog Part C " + $Date$, "/usr/sdext/Datalog set/Datalog Part C " + $Date$ + T$(12 To 13)
FS “mv”, "/usr/Datalog Part D " + $Date$, "/usr/sdext/Datalog set/Datalog Part D " + $Date$ + T$(12 To 13)
END
where i would change the IO numbers for the actual IOs i want to record. Just trying it again and it has lasted 24 hours with no reboot, but I still do not trust it. Anything you would change in this?