Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:35 07 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 : WAKEUP Problem

Author Message
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 04:56pm 04 Feb 2017
Copy link to clipboard 
Print this post

Hi All,

As you know I am a bit of a tyro with programming but I am having a problem with SLEEP and WAKEUP

I am using a wakeup input (GND to pin 16) to bring the MM out of SLEEP mode

This works but after a wakeup command I cannot seem to reinstate the sleep command

See this small snippet of my cut down code to demonstrate.

premain:

print "PREMAIN Processed"

settick 3000, TimUp, 1
main:

? "MAIN LOOP"

pause 500

goto main:

TimUp:
print "SLEEP Triggered"

Settick 0,0,1 'disable timer
CPU SLEEP
? "WAKEUP Detected"

goto premain:


On a RUN the program shows that PreMain: was processed which setup a settick of 3 seconds then I get 7 iterations of Main Loop before the settick sends the program to the SLEEP routine as proven by SLEEP being printed on the display..
This works and a gnd on the wakeup pin awakens the processor and executes the Premain process again but the settick command doesnt seem to reinitialise after the MM has woken from a sleep (the words MAIN continue endlessly)

Is this a bug or just a Dumb-Mik problem?

Yes I am using GOTO commands and I am sure there are other methods but that is the way my brain works..

FYI I am using v5.3.1 and a 28pin chip.

Kind Regards,

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

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 05:15pm 04 Feb 2017
Copy link to clipboard 
Print this post

TimUp is an interrupt routine so you should have a IRETURN at the end of it.

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

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 05:21pm 04 Feb 2017
Copy link to clipboard 
Print this post

Thanks Geoff,

Ahh Of course !!!. See I told you I was a tyro..

It works now.. Makes sense to me..

Now to put it into my water program.. Which works well and just needs a method of saving on battery drain.

Appreciate the quick response.

Kind Regards,

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 172
Posted: 05:38pm 04 Feb 2017
Copy link to clipboard 
Print this post

It's probably all those beers and the nanna naps you've been having that are the problem with the sleep and wakeups
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 10:33pm 04 Feb 2017
Copy link to clipboard 
Print this post

@Greybeard,

You might be right,

I have now got my water tank/( beer vat ) level measuring code at a pretty good working stage.. well good for me anyway..

I had a lot of fun with my portrait mode linear gauge and testing with the distance sensor taped to a chair measuring the LITRES from the sensor to the door..

Geoff has put so much graphic support that it was simple to draw gauges etc all that was needed was the maths to convert 30cm to equate to 2000lt and 188cm as 0lt and convert the calculated litres to a vertical gauge.

Thank you Geoff and for helping me with the last part that stumped me so much.

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
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