CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to reset a SLEEP by rs232 interrupt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Falgellus



Joined: 12 Feb 2006
Posts: 8

View user's profile Send private message

How to reset a SLEEP by rs232 interrupt
PostPosted: Sun Feb 12, 2006 8:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Feb 12, 2006 9:35 am     Reply with quote

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

View user's profile Send private message

using 16f876A
PostPosted: Mon Feb 13, 2006 1:37 am     Reply with quote

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







PostPosted: Mon Feb 13, 2006 6:22 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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