Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:56 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 : Previously Stable device crashing.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 02:55am 16 Apr 2020
Copy link to clipboard 
Print this post

Hi All,

Bit of a quiz, to see what answers I get, now that I think I've solved it...

Story,

My Coms monitor, GCMicro2 (64) has been stable forever despite a bit of screen flicker when the ESP8266 or HC-12 hit it up for some transmit power.

I just never misses a beat & polls my Spa Controller, Heat Pump & Ceiling heat controller.

Does up a nice VT-100 page for me to see in Teraterm, & also sends the data to two E-100's to display on their screens.




So all of a sudden it's randomly crashing out to the prompt.
Can run for hours before this happens & can't see the issue in teraterm, as it's done an idle disconnect from the ESP8266 when I randomly discover it.

I had added a few lines of code before the issues apeared, but did check their operation & that code worked fine.

  Quote  if FlowRate > 1 then
   
Print Str$((37-TmpScCur)/(FlowRate*60*(TmpScOut-TmpScInp)/1000),3,1)
Else
   
print "   "
End If    
   
Print "    Solar Vlts "; STR$(SlrVlt,4,2);"        Solar (W)     "; Str$(SlrWat,4,2)



I just wanted a number on the console output to give me a ball park time in hours as to when the water would be up to temp; save the mental calc based on the "Temp Rise/h", 2.12 in the above image.

Avoided a Div by Zero with the IF statement.
All works Ok in both the Pump running & idle state when Flowrate is zero.

Checked & wiggled hardware; rechecked the code above; watched it sit running on the floor on the laptop, but was at a loss why it behave & then when not watching it stopped.

Anyone wan't to put up their theory on why it might have been crashing out?
See if we come up with the same answer?


Cheers

Phil.

Edit:-

Should add that this MM polls the other 3 devices & receives blocks of data (readable text) back from each device, does a Checksum on the block & if it passes, pulls it to bits & puts it in the local devices variables.
Edited 2020-04-16 13:01 by Phil23
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 07:49am 16 Apr 2020
Copy link to clipboard 
Print this post

Morning Phil.

no idea as to your mysterious shenanigans, but i developed this debug a couple of years ago - it helps massively in isolating the bit of code executing when this stuff happens

http://www.fruitoftheshed.com/MMBasic.Program-Step-A-Fast-Flexible-Debugging-Aid.ashx

To save messing up your display, just save teh PSTEP value to a variable then when is crashes to the prompt, print it at and that is where your code was at when it died.

Also consider using the watchdog to restart your app and MM.WATCHDOG to tell if the start was because of it (i.e. an error)
Edited 2020-04-16 17:52 by CaptainBoing
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 09:52am 16 Apr 2020
Copy link to clipboard 
Print this post

Thanks @CaptainBoing

I've fixed it now, but all the detail pointing to the problem is in the post above,
I just would like to challenge everyone to spot the fail point; the one I overlooked so many times.

I even caught it crash in Teraterm before my eyes today, and it was exactly what I finally realized earlier.

Only the first 5 of the 6 lines posted above were new code, & the answer is in that new code.

It's pretty damn simple, but admittedly I missed it time & time again.

Cheers.
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1045
Posted: 10:20am 16 Apr 2020
Copy link to clipboard 
Print this post

TmpScOut-TmpScInp could equal zero ? giving divide by zero
F4 H7FotSF4xGT
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 10:24am 16 Apr 2020
Copy link to clipboard 
Print this post

LOL... always something to learn.

Glad it is working now
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:35am 16 Apr 2020
Copy link to clipboard 
Print this post

  disco4now said  TmpScOut-TmpScInp could equal zero ? giving divide by zero


Lol, Lock it in?

I missed that possibility repeatedly. Then the Penny dropped.
Whilst digging thru the ((((('s & )))))'s, thinking order of operations.

You win the Beer!

Cheers
 
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