Tset 1,600 //timer set for 600 seconds Ontimer 1, "@write_data" // every 600 seconds it will call the function write_data Function write_data() T$ = TIME$ // grabs the current time $Date$ = T$ (4 To 5) + "_" + T$ (1 TO 2) + "_" + T$ (7 TO 10) + "_" + T$(12 To 13) + "_" + T$(15 To 16) + "_" + T$(18 To 19) // puts the time into this format MMDDYYYY HHMMSS $CustomFileName$ = "Historical_Log_" + $Date$ //names the file "Historical_Log_" followed by the current time $FileName$ = "/usr/" + $CustomFileName$ + ".csv" //writes it into the usr directory and writes it as a csv file $EBD$ = "$dtHL$ftT$st_m10$et_m0$ut" //dtHL is historical logs for all tags, ftT is saying its a text filetype st_m10 means it's grabbing all the data from 10 minutes ago // et_m0 means that it's going from 10 minutes ago to the current time. // to modify what is being grabbed please visit: https://ewonsupport.biz/ebd/ Print $FileName$ // just says the current name of the file WriteEBD $EBD$,$FileName$ // writes the csv to the sd card print "Historical data written" // just a check to see that it made it to this step and lets you know that it performed the writeebd Endfn