Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:23 02 Jul 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 : Watchdog timeout Error:Negative argument

Author Message
mikeb

Senior Member

Joined: 10/04/2016
Location: Australia
Posts: 174
Posted: 07:23pm 22 Apr 2016
Copy link to clipboard 
Print this post

Hi all,

Just completed my first build and use of MMbasic 5.1.
I have constructed the Boat Computer MkII and loaded the PIC with the latest version of the downloaded HEX file (BoatComputerFull.hex).
Demo mode works OK and initialisation works
(Waiting for GPS, Searching for satellites) up until the first screen is loaded.
The Watchdog timer times out, after the allotted 5 seconds, and the PIC restarts.
Using the utility 'MMedit' I get the error dump message as follows -

Watchdog timeout
Processor restarted

[389] n = (2 * atan2(Sqr(a), Sqr(1 - a)))
Error: Negative argument

Found the above line in the Bas file but not quite sure as to what is happening.

Would appreciate any guidance on offer.

Regards, Mike B.

Edited by mikeb 2016-04-24
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
 
mikeb

Senior Member

Joined: 10/04/2016
Location: Australia
Posts: 174
Posted: 08:43pm 22 Apr 2016
Copy link to clipboard 
Print this post

Hi all,
Found this at lines 55-57

' details of the POIs (these are saved in flash)
Dim String POIs1 = "POI 1", POIs2 = "POI 2", POIs3 = "POI 3", POIs4 = "POI 4"
Dim Integer POIa1, POIa2, POIa3, POIa4, POIb1, POIb2, POIb3, POIb4

These variables appear to be declared as 'unsigned' integers.

Found this at lines 78-79

POIs1 = "HARBOUR" : POIa1 = -1121262 : POIb1 = 4401721
POIs2 = "BOAT RAMP" : POIa2 = -1131062 : POIb2 = 4410721

POIa1 and 2 have been set to a default 'signed' value in the 'Demo' routine.

I removed the '-' sign and downloaded the Bas file again and my problem has disappeared.

As the error is 'flagged' at the end of the POI routine (line 389) I'm assuming it has something to do with it. Just not sure why it is not 'flagged' sooner.

Regards, Mike B. Edited by mikeb 2016-04-24
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
 
mikeb

Senior Member

Joined: 10/04/2016
Location: Australia
Posts: 174
Posted: 08:55pm 22 Apr 2016
Copy link to clipboard 
Print this post

Hi all,



Edited by mikeb 2016-04-24
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2947
Posted: 08:59pm 22 Apr 2016
Copy link to clipboard 
Print this post

  mikeb said   Hi all,





GDay Mike
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3281
Posted: 10:30pm 22 Apr 2016
Copy link to clipboard 
Print this post

Damn, I seem to spend my life creating bugs

  mikeb said   Dim Integer POIa1, POIa2, POIa3, POIa4, POIb1, POIb2, POIb3, POIb4
These variables appear to be declared as 'unsigned' integers.

No, that cannot be the problem... in MMBasic all integers are signed.

I can't see what the problem is but it sounds as if the POI's lat/long are corrupted. But how did that happen?

The fix should be to break out of the program and then use VAR CLEAR. When you then run the program it should startup with the defaults.

Mick, can you list the steps that led you to this situation? There might be a clue there.

Geoff
Geoff Graham - http://geoffg.net
 
mikeb

Senior Member

Joined: 10/04/2016
Location: Australia
Posts: 174
Posted: 03:38pm 23 Apr 2016
Copy link to clipboard 
Print this post

Hi Geoff,

Thanks for the reply. Thankyou also for your superb efforts.
I have been using PicBasic Pro (MeLabs) for many years with a different 'syntax', and construct, so sorry if I appear to be a total 'newbie'. Never got into Basic in my younger years so will probably ask some pretty 'naff' questions from time to time.

The VAR CLEAR command got me back to square 1. Thanks, I'll remember that one.
I have been able to replicate my problem reliably.
If I select any POI and return to the main screen, without having first set any
co-ordinates (ie VAR = 0), then I end up with a watchdog timeout.
However, if I set a co-ordinate, using the 'Set To Here' button (great function !!!), no timeout occurs.

Hope you can explain why this is so as I do like to learn the 'ins and outs' of things.

Don't worry about bugs. You can design something idiot proof and then along comes a bigger idiot. Yours truly for example.

Regards, Mike B.

There are 10 kinds of people in the world.
Those that understand binary and those that don't.

Edited by mikeb 2016-04-25
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
 
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