View previous topic :: View next topic |
Author |
Message |
2mhelges1
Joined: 16 Jan 2006 Posts: 3
|
Posted: Mon Sep 22, 2014 8:56 pm Post subject: Wakeup from powerdown |
|
|
How do i select rising edge interrupt for waking up from powerdown? It is the tiny1634 chip, i use the pcint0 interrupt (vector 3), GIMSK and PCMSK0 registers are set correct for using the pcint0, pcint1, pcint2 and pcint3 as external interrups trigger pins. I do select ISC0 and ISC1 bits in the MCUCR reg for rising edge, but interrupts seems to occur while level changes from lowhigh or highlow. Any good sugestions?
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Mon Sep 22, 2014 9:21 pm Post subject: Re: Wakeup from powerdown |
|
|
2mhelges1 wrote: | How do i select rising edge interrupt for waking up from powerdown? |
The data sheet is very clear about it.
Quote: | It is the tiny1634 chip, i use the pcint0 interrupt (vector 3), GIMSK and PCMSK0 registers are set correct for using the pcint0, pcint1, pcint2 and pcint3 as external interrups trigger pins. I do select ISC0 and ISC1 bits in the MCUCR reg for rising edge, but interrupts seems to occur while level changes from lowhigh or highlow. Any good sugestions? |
If you'd have done everything right in your code, it would work as intended. As it does not, your code is likely wrong. As the code is likely wrong, it makes no sense to prosaically describe it.
Much better would be, to post a minimized code sample, which shows the problem. |
|
Back to top |
|
|
Visovian
Joined: 31 Oct 2007 Posts: 584 Location: Czech
|
Posted: Tue Sep 23, 2014 3:51 am Post subject: |
|
|
At PCINT interrupt you cannot choose rising or falling edge. Both cause the interrupt.
Quote: | I do select ISC0 and ISC1 bits | These bits are for external interrupt INT0. They have no effect on PCINT.
Set them for low level if you want to use INT0 for wake up. |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Sep 23, 2014 10:58 pm Post subject: |
|
|
Doing the edge detect in software will allow you to select either rising or falling edge, and because its much slower than the hardware edge detect, it much better ignores fast jitter on the hardware line.
Within the ISR, just read the level on the appropriate pin. If its high now, than you must have had a rising edge, so do whatever you want. If its low, you have had a falling edge, so ignore it, just exit from the ISR. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
|