Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: Mega48V pwerdown troubles?

2007-07-22 by Jim Wagner

Richard -

This does not address your immediate question but is the
next step after you solve that. Its tht nasty business of
switch debounce. 

If it wakes up on a pin change, then does it start
executing when the timers are fully up and operating? I've
never dealt with this situation but I would be uneasy
whether or not I could reliably use a timer as part of
switch debounce. I think what I would otherwise try to do
is start a timer (say 100ms or so) within the interrupt. If
a second edge inturrupt happens while the timer is running,
then I would reset the timer but ignore the edge. Question
is whether or not the timer is fully available during that
initial interrupt on wakeup. Guess if code is executing, it
must be?

Jim


On Sun, 22 Jul 2007 22:08:51 -0000
 "Richard Cooke" <rcooke@digitalwavelength.com> wrote:
> Jim,
> 
> Your post was empty.  I'm desperate and I'm out of ideas.
> 
> Thanks,
> 
> Richard 
> 
> --- In AVR-Chat@yahoogroups.com, "Jim Wagner"
> <jim_d_wagner@...> wrote:
> >
> > On Sun, 22 Jul 2007 20:28:47 -0000
> >  "Richard Cooke" <rcooke@...> wrote:
> > > Hi Folks,
> > > 
> > > How do you set up the external interrupt on change to
> get
> > > the chip to
> > > come out of powerdown mode?
> > > 
> > > I'm having trouble with getting my Mega48V to come
> out of
> > > powerdown. 
> > > I need to read/debounce 4 tactile switches, power up
> a
> > > nRF905 chip,
> > > send the command and then go back to sleep.
> > > 
> > > I've sucessfully run the program if I don't go into
> sleep
> > > mode but now
> > > that I need to test the power consumption I've
> enabled
> > > the powerdown
> > > section.
> > > 
> > > Here is the external pin change ISR:
> > > 
> > > // Pin change 8-14 interrupt service routine
> > > interrupt [PCINT1] void pin_change_isr1(void)
> > > {
> > > EXT_PIN_INTR_DISABLE;         // Disable any more
> > > external pin change
> > > interrupts
> > > PWR_UP = 1;                   // Power up the nRF905
> chip
> > > Switch_State = (PINC & 0x0f); // PC0, PC1, PC2, PC3
> > > connected to the
> > > switches
> > > }
> > > 
> > > Here is where I set up the external pin change
> interrupt
> > > enable:
> > > 
> > > // External Interrupt(s) initialization
> > > // INT0: Off
> > > // INT1: Off
> > > // Interrupt on any change on pins PCINT0-7: Off
> > > // Interrupt on any change on pins PCINT8-14: On
> > > // Interrupt on any change on pins PCINT16-23: Off
> > > EICRA = 0x00;
> > > EIMSK = 0x00;
> > > PCICR = 0x02;
> > > PCMSK1 = 0x0f;
> > > PCIFR=0x02;
> > > 
> > > 
> > > What else do I have to do?
> > > 
> > > Thanks,
> > > 
> > > Richard Cooke
> > > Lake Forest, CA USA
> > > 
> > > 
> > 
> >
>
---------------------------------------------------------------
> > The Think Different Store
> > http://www.thinkdifferentstore.com/
> > For All Your Mac Gear
> >
>
---------------------------------------------------------------
> >
> 
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.