Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
How to Sleep Until Pin Change

 
Post new topic   Reply to topic    Forum Index -> Files
Author Message
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 04 June 2008, 16:06 PM    Post subject: How to Sleep Until Pin Change Reply with quote

The attached code illustrates how to cause a ZX to sleep until a pin change event occurs. Although the example code is specific to ZX devices based on the mega644 and mega644P chips, the code could be modified for other ZX devices that support pin change interrupts. The code can also be modified to awaken on an external interrupt (e.g. INT0), analog comparator interrupt, Timer interrupt, etc.

The particular sleep mode used in the example (Power Down) is one that turns off the main clock. While this results in lower power consumption, it has the disadvantage of a slower startup time upon awakening. Generally, the clock oscillator of the CPU chip is configured for a startup delay of 16,000 clock cycles. At 14.7456MHz, this results in a startup delay of about 1mS. If a faster startup is needed, a different sleep mode can be used that keeps the main clock running, e.g. StandBy mode.



SleepPinChange.zip
 Description:

Download
 Filename:  SleepPinChange.zip
 Filesize:  1.42 KB
 Downloaded:  2802 Time(s)

Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 04 June 2008, 20:56 PM    Post subject: Reply with quote

I made a minor change to the example code, adding a line to disable the pin change interrupt after execution resumed. The new file replaced the older one - just download it again to get the updated version.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> Files Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group