PDA

View Full Version : Tmr1



andybarrett1
- 3rd May 2015, 09:37
Hi all

Quick question

Thinking of using TMR1 on a 16f688 device for a time out (PIC stays on after a button push for 20mins then goes sleep)

Would this do that ?


Or would you suggest another method that may be better.... Operators are forgetting to turn field loggers off!!

Thank you
Andy

HenrikOlsson
- 3rd May 2015, 09:49
Yes, you can do that.
But you're not going to get 20 minutes out of it in one go, unless you clock it externally with a very low frequency of course. Instead you're going to set it up so it overflows 10, 25, 50, 100, whatever times per second and count the number of overflows, either using interrupts or by polling the interrupt flag - depending on how the rest of the program i structured.

/Henrik.

andybarrett1
- 5th May 2015, 10:34
Hmmmm...

Back to drawing board then..

TY for help.... least now I know I cant do it....

or use a 555 on outside of pic lol

Art
- 7th May 2015, 07:46
You said in your other thread you're using GPS,
You can easily know how long it was since someone pushed a button.
Rather than use timer1 which might mess with software serial at a low
crystal frequency, I would ignore GPS time which might not be present,
and just count serial bursts which should arrive each second.

Count 1200 serial bursts no matter what the content and go to sleep.

Art
- 7th May 2015, 11:03
...Reset the count to zero any time a button is pushed (meaning someone is using it and they get a new 20 minutes).
Looks like editing posts is turned off.

I read again, and it wasn’t GPS, but you have “PAUSE 400” in a subroutine you’re calling, so you could increment a count
to a bit more than double the 1200 in that routine.

andybarrett1
- 9th May 2015, 12:16
Hi Art

Will try your suggestions later.... Would you believe my PC has died now. So need fix that first !! Typing this on the Mac. PBP not mac friendly!

Thank you for suggestions

Art
- 10th May 2015, 02:17
I run a Windows partition on my Mac specifically for dev environments so that particular installation can’t see the internet
because it doesn’t have the wifi module or network interface drivers installed.
Everyone knows that as soon as a Windows PC sees the internet it breaks :D

andybarrett1
- 10th May 2015, 22:40
CQ CQ CQ VK4FAST…..

You may have a point…. LOL

Watch this space

Best 73 de Andy (G7IIF)