|
|
View previous topic :: View next topic |
Author |
Message |
Falgellus
Joined: 12 Feb 2006 Posts: 8
|
How to reset a SLEEP by rs232 interrupt |
Posted: Sun Feb 12, 2006 8:48 am |
|
|
HALLO ALL
I have a program that controls a door open close, all is ok and when the engine is off the pic is set in sleep mode. The sleep mode is then reset by the ON button press.
Now I need to control it by a remote PC so I have implemented a communication routine that is working well but only when the PIC is not in Sleep.
Anyone knows how to reset the Sleep mode by a Rs232 interrupt? I used it but it seems not to reset the sleep condition.
THANK YOU VERY MUCH!!!
Paolo |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sun Feb 12, 2006 9:35 am |
|
|
Your didn't tell us what processor are you using, but as general rule almost all mid-range PIC processors can't wake up from INT_RDA, unless if it has an Enhaced UART module (namelly EUSART).
During Sleep mode, all clocks to the UART are inactive, because of this, the Baud Rate
Generator is inactive too and a proper byte reception cannot be performed.
Workaroud: wire the receive (TTL level) signal with the INT_EXT pin just to wake up the PIC.
Humberto |
|
|
Falgellus
Joined: 12 Feb 2006 Posts: 8
|
using 16f876A |
Posted: Mon Feb 13, 2006 1:37 am |
|
|
Thank you, i'm using a 16F876A, but I checked that it hasn't the EUSART. I 'll try to wire the EXT_INT pin.
Thank You
Paolo |
|
|
Ttelmah Guest
|
|
Posted: Mon Feb 13, 2006 6:22 am |
|
|
Have the interrupt set to trigger on high to low.
Before going to sleep, clear it (since it will probably be set from earlier serial data), enable it, but leave the global interrupt _disabled_. Then at the 'host', to wake up the processor, you'll need to send a byte (0xFF) then wait for a few uSec, and send the actual data.
In the code, when the interrupt flag gets set, because the global interrupt is not enabled, no interrupt 'call' will take place, and the next instruction will be exectuted.
The byte '0xFF', sends just a single low 'start' pulse to wake the chip. How long you have to wait after this, will depend on your oscillator. Crystal oscillators, can take quite a few uSec, to wake up. The duration of the eight data bits, may well be enough (the wake up will happen on the 'start' bit).
Best Wishes |
|
|
|
|
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
|