Power-down on no activity question

General discussion on mikroBasic for dsPIC30/33 and PIC24.
Post Reply
Author
Message
jmarkwolf
Posts: 89
Joined: 01 Apr 2007 15:45
Location: Southeast Michigan
Contact:

Power-down on no activity question

#1 Post by jmarkwolf » 10 Dec 2009 14:22

I need to implement a "power-down on no activity" function on a DsPIC30F6012 (battery-power saving measure).

My application requires power-down after 120seconds of inactivity on a port pin. The idea is that activity on the port pin would keep resetting
the counter so it never reached the match register. If the port pin were static for 120seconds, the counter would automatically increment to the 0xFFFF match register then vector to an interrupt routine that would then invoke my power-down hardware.

I have the power-down hardware operating, and am wondering about the most efficient way to implement the code.

My assumption is to employ T1 in timer free-running mode.

However with a 20MHZ clock it appears the longest interval I can acheive is about 3.3seconds ( 20,000,000 / 4 / 65535 / 256 ).

Are there any tricks other than to "collect" a count of 54 interrupts (120 / 3.3) then invoke the power-down?

I know I could use the 32-bit counters but I will likely need them for other functions.

Any tips and tricks?

Post Reply

Return to “mikroBasic for dsPIC30/33 and PIC24 General”