i am using a history log i found on here and need to have some sort of a delay in the script.
it executes to fast and the tag does not refresh in the time that it logs the file.
WRITE_DI1:
DIStatus$ = “” //REM - Because I will be saying open/closed instead of 0/1 I need a string to track this.
IF(DI_1_MEM@ = 0) THEN
DIStatus$ = “DGITAL INPUT OFF”
ELSE
DIStatus$ = “DIGITAL INPUT ON”
ENDIF
//REM - 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
CLOSE 1 REM - Close the file just in case.
OPEN “file:/usr/DI_1_TEST.csv” FOR BINARY INPUT AS 1
ErrorReturned = GETSYS PRG, “LSTERR”
IF(ErrorReturned = 33) THEN
CLOSE 1
OPEN “file:/usr/DI_1_TEST.csv” FOR BINARY OUTPUT AS 1
PUT 1, “Time,TagName,TIME RAN (MIN),COUNTS (ON)”
PUT 1, CHR$(13)+ CHR$(10)
PUT 1, Time$ +","+ DIStatus$ +","+ STR$ DI_1_TIME@ +","+ STR$ DI_1_COUNT@ +","+ CHR$(13)+ CHR$(10)
CLOSE 1
ELSE
CLOSE 1
OPEN "file:/usr/DI_1_TEST.csv" FOR BINARY APPEND AS 1
PUT 1, Time$ +","+ DIStatus$ +","+ STR$ DI_1_TIME@ +","+ STR$ DI_1_COUNT@ +","+ CHR$(13)+ CHR$(10)
CLOSE 1
ENDIF
END