Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:26 13 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Log File Routines.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 09:04pm 05 Nov 2019
Copy link to clipboard 
Print this post

Hi All,

Back looking at this from nearly 2 years back & wondering if I'm taking the right approach or whether I could do it better.

Basically it's been logging data on the SD card since 2017.
Logs every 15 minutes into the hour.

Still trying to get it all back in my head as to my logic at the time.

Any suggestions on an alternate approach.

(Iritating thing is the seconds stamp in the log varying....).

Phil.

  Quote    SetTick 2000, MainInt,1
 
SetTick 30000,ChkTime,2
 
 
 
Do
   
If Touch(x) <> -1 Then CheckTouch
   
   
If DoLog=1 Then LogData
   
   UpdateLCD
 
Loop
 
Sub MainInt
 ReqComs
 
'UpdateLCD
 UpdateConsole
End Sub

Sub SendLog

xmodem Send "SpaLog.csv"

End Sub
 
Sub ChkTime
 
 
IF Val(Mid$(Time$,4,2)) Mod LogInt=0 And LogDone=0 Then
   DoLog=
1
 
Else If Val(Mid$(Time$,4,2)) Mod LogInt<>0 And Logdone=1 Then
   DoLog=
0:LogDone=0
 
End If
 
End Sub
 
 
Sub LogdataOld
 
 
If DoLog=1 And LogDone=0 Then
   
OPEN "TestLog.txt" FOR Append AS #2
   
Print #2, Date$;",";Time$;",";TmpScAmb;",";TmpScPan;",";TmpScCur;",";TmpScInp;",";TmpScOut;",";FlowRate;",";SlrVlt;",";FlowRate*(TmpScOut-TmpScInp)*70.2
   
Close #2
   LogDone=
1
 
End If
 
End Sub
 
Sub Logdata
 
 
If DoLog=1 And LogDone=0 Then
   
   
IF Dir$("SpaLog.csv", File)="" Then
     
OPEN "SpaLog.csv" FOR Append AS #2
     
Print #2, "Date,Time,TmpScAmb.,TmpScPan,TmpScCur,TmpScInp,TmpScOut,FlowRate,SlrVlt,FlowRate"
     
Close #2
   
End If
   
   
IF Dir$("HeatLog.csv", File)="" Then
     
OPEN "HeatLog.csv" FOR Append AS #3
     
Print #3, "Date,Time,TmpChAmb,TmpChRof,TmpChLng,TmpChCel,TmpChBed,TmpChOf1,TmpChOf2"
     
Close #3
   
End If
   
   
OPEN "SpaLog.csv" FOR Append AS #2
   
Print #2, Date$;",";Time$;",";TmpScAmb;",";TmpScPan;",";TmpScCur;",";TmpScInp;",";TmpScOut;",";FlowRate;",";SlrVlt;",";FlowRate*(TmpScOut-TmpScInp)*70.2
   
Close #2
   
   
OPEN "HeatLog.csv" FOR Append AS #3
   
Print #3, Date$;",";Time$;",";TmpChAmb;",";TmpChRof;",";TmpChLng;",";TmpChCel;",";TmpChBed;",";TmpChOf1;",";TmpChOf2
   
Close #3
   LogDone=
1
 
End If
 
End Sub
 
Dim Float TmpChAmb,TmpChRof,TmpChLng,TmpChBed,,TmpChOf2,TmpChCel
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 12:27pm 14 Dec 2019
Copy link to clipboard 
Print this post

This may fix it.


Sub ChkTime
 
 Ltime$=time$

 IF Val(Mid$(Time$,4,2)) Mod LogInt=0 And LogDone=0 Then
   DoLog=1
 Else If Val(Mid$(Time$,4,2)) Mod LogInt<>0 And Logdone=1 Then
   DoLog=0:LogDone=0
 End If
 
End Sub


then in subs

LogdataOld
Logdata

change time$ to Ltime$
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025