CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Wake from SLEEP if PORTF keyboard used

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
homfray



Joined: 19 Nov 2003
Posts: 45
Location: Oxford

View user's profile Send private message Visit poster's website

Wake from SLEEP if PORTF keyboard used
PostPosted: Fri Dec 02, 2005 10:32 am     Reply with quote

Ok I have been bloody silly I have built and programmed some harware using a 18F8621 (and PCH) and because I hadn't thought about what happens to the circuit when nothing is happening, I put the matrix (4x3) keyboard on PORTF and not on an interrupt port B pin.

I would like to wake up when a button is pressed and do stuff and go back to sleep if there is inactivity, not bothered how its done and would be willing to go down the WDT route if its the best method.

It is probably not possible, but if theres a way one of you dudes will know. Any clues for the stupid one Embarassed
_________________
Nice!!!
Ttelmah
Guest







PostPosted: Fri Dec 02, 2005 11:16 am     Reply with quote

No easy 'trick', but you can bodge round this. Why not enable the watchdog. Set this to wake at (say) 50mSec intervals, and just make one test on the input port, and then if nothing is seen, go back to sleep. Total time awake, can be below perhaps 10 instructions. If a key is seen, set a flag, and sleep again. If the key is still there on the next interrupt, this has provided a nice 'debounce', and you can respond. The total percentage of the time 'awake, will be tiny. Unfortunately, the power will be slightly worse than on some other chips, because there is no internal oscillator (these wake up faster, reducing consumption when working like this), but you will still get over 90% of the power saving available from sleep, and be able to detect the keyboard.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group