Created a CSV data logger that runs in the background of the HMI. For some reason the logger stops logging after 30 minutes, any idea on why this is happening?
π
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Created a CSV data logger that runs in the background of the HMI. For some reason the logger stops logging after 30 minutes, any idea on why this is happening?
more posts ...
Hello,
I know the problem.
How do you access the .csv?
The directory path is the C drive.
how do you write the csv file. can you show the code in question?
Not the whole code but this should give you an example on how I'm doing it.
csvInitDataLog (xExecute := TRUE, sDirectoryPath := 'C:/DataLogging', sFileName := 'DataLogging2.csv', sColumnSeparator := ';', rCSVWriter := gCSVWriter);
IF(//conditions) THEN
timer1 (ENABLE := TRUE, TIMEHIGH := T#7.5S, TIMELOW := T#7.5S);
// timer to log data every 15 seconds
END_IF
RTrig1 (CLK := timer1.OUT);
// log upon the rising edge of timer
csvSysDateTime (xExecute := (csvInitDataLog.xDone AND RTrig1.Q), sInput := SYS_DATE_TIME_SCRN, rCSVWriter := gCSVWriter);
csvSysHours (xExecute := (csvSysDateTime.xDone AND RTrig1.Q), lrInput := System_Hours, rCSVWriter := gCSVWriter);
csvAddNewLine (xExecute := csvSysHours.xDone, rCSVWriter := gCSVWriter);
csvWriteFile (xExecute := csvAddNewLine.xDone, rCSVWriter := gCSVWriter);
Last edit: linux 2022-08-16
Your problem is the multiple call of
xExecute
This leads to an overflow after some time.
Have you already looked at this example?
https://www.codesys-blog.com/allgemein/data-logging-csv-in-codesys-erstellen/
best regards