not sure if this is what your looking for but is what I do with my camera
ON INTERRUPT GoTo TAKEPIC 'ON PIR TRIP WAKE UP
INTCON=$90 'ENABLE .2 INTERUPT
not sure if this is what your looking for but is what I do with my camera
ON INTERRUPT GoTo TAKEPIC 'ON PIR TRIP WAKE UP
INTCON=$90 'ENABLE .2 INTERUPT
" be nice it's people like me that make people like you look smart"
yes I read the datasheet, of the 300 pages I understood 10
Possibly![]()
The thing is I want an LCD to display some relevant info for a short time after the shot is taken but then go to sleep.
I suppose I could use a timer overflow to trigger the SLEEP command, and reset the timer everytime something happens to keep it awake ?
Running at 4MHz can I count to 60secs with an internal timer or do I need to use the timer overflow to increment a "second counter" ?
Andrew
The easiest way would be to count down 60 x 1 second delays using pause. After that time, simply put your PIC to sleep. The delay can be reset by the Interrupt occurence.
Code:ISR: .... .... SleepTimeOut = 60 INT_RETURN main: ... ... if SleepTimeOut <> 0 then pause 1000 SleepTimeOut = SleepTimeOut-1 else @ sleep ' use the ASM sleep command @ nop ' some pics need these 2 nops (the datasheet will tell) @ nop endif goto main
Hi, Andrew
If your program loops ...
just count how many loops in a minute ... and go to an @sleep command if value reaches the loops per minute value ...
just need to add a counter and a test in your loop ...
Non-blocking solution ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
So Alain,
One thing that I always find difficult to answer, how can you work out how many clock cycles are used by a particular group of PBP instructions ? I could test it empirically but there must be a way of calculating it.
Thanks, Andrew
Would work but then I need to rewrite my code - I don't trigger off an interrupt but instead look at PortB which holds not just the trigger signal but also a small keypad. The unit I'm making isn't just a simple "fire", there is also a small menu system to enter a few system parameters.
Not impossible to rewrite but perhaps I'll just count how many times I loop and conditionally branch ..
Thanks, Andrew
Bookmarks