Hi Am experimenting with a PIC16F628 here and would like put the processor in Sleep Mode and then wake it up when a character is received in the UART. Problem is that SLEEP seems to shut down the OSC and thus the Baudrate Generator is not running to get the character. Read over the application note (AN774) and data sheet and I couldn't find any enlightening words about how to handle this. I am wondering if it would be possible to also hook the RX lead from the RS232 line (RB1) to the external interrupt pin (RB0). Before I put the processor to sleep would enable interrupt RB0. After exiting sleep would start processing UART chars (might miss a couple) and leave interrupt masked until went back to sleep. Have I missed something in the data sheet? Has anyone tried this or have a better way??? Bob Ball WB8WGA |
|

Waking Up UART from Sleep
yeah, sleep is just a little too, well, deep. If its power saving you want, you could put the 628 into INTOSC mode at 37 khz. I'm not how the BRG needs to be set and you have to figure out how handle the first byte that comes down . When you see a character, you then toggle up to 4 mhz. I'm not sure if this meets you app needs as INTOSC can be problematic for BRG and I dont immediately see a way to toggle between INTOSC and XT or HS (so you can run at a frequency that can be used for BRG). Look at the "special features" section of the data sheet. Maybe you could build a dual speed external oscillator on CLKIN and toggle it with a spare i/o pin (RA6 becomes free). See EC mode. That's probably how I would do it if I HAD to use a 16F628. Several other PICs (look at the 16F88, for example) allow for switching between external and internal OSCs. You can have primary and secondary oscillators and switch between them at will. --- In , "northwoodsfisherman" <caravita@e...> wrote: > Hi > Am experimenting with a PIC16F628 here and would like put the > processor in Sleep Mode and then wake it up when a character is > received in the UART. Problem is that SLEEP seems to shut down the > OSC and thus the Baudrate Generator is not running to get the > character. Read over the application note (AN774) and data sheet and > I couldn't find any enlightening words about how to handle this. > > I am wondering if it would be possible to also hook the RX lead from > the RS232 line (RB1) to the external interrupt pin (RB0). Before I > put the processor to sleep would enable interrupt RB0. After exiting > sleep would start processing UART chars (might miss a couple) and > leave interrupt masked until went back to sleep. > > Have I missed something in the data sheet? Has anyone tried this or > have a better way??? > > Bob Ball > WB8WGA |
|
--- In , "Phil" <phil1960us@y...> wrote: Thanks for the reply Phil. I checked out the "downshifting" option you mentioned but it requires to be running in either INTRC or ER Mode. The UART application note warns about using these modes for a UART operation due to clock variation might make it unreliable with some RS 232 devices. So guess should have a crystal. I could go to an external 32 to 200 khz crystal (XT Mode) and cut down the power consumption but can't get fast enough baud rate (wanted at least 1200). I think your external oscillator suggestion would work and is a possibility. I'll also try tying RB1 to RB0 to wake it up on a bit transistion external interrupt to see if that can be made to work when I breadboard it. Am waiting for the MAX232 RS232 driver in the mail. Thanks Again Bob WB8WGA > yeah, sleep is just a little too, well, deep. > > If its power saving you want, you could put the 628 into INTOSC mode > at 37 khz. I'm not how the BRG needs to be set and you have to > figure out how handle the first byte that comes down . When you see a > character, you then toggle up to 4 mhz. I'm not sure if this meets > you app needs as INTOSC can be problematic for BRG and I dont > immediately see a way to toggle between INTOSC and XT or HS (so you > can run at a frequency that can be used for BRG). Look at > the "special features" section of the data sheet. > > Maybe you could build a dual speed external oscillator on CLKIN and > toggle it with a spare i/o pin (RA6 becomes free). See EC mode. > That's probably how I would do it if I HAD to use a 16F628. > > Several other PICs (look at the 16F88, for example) allow for > switching between external and internal OSCs. You can have primary > and secondary oscillators and switch between them at will. > > --- In , "northwoodsfisherman" <caravita@e...> > wrote: > > Hi > > Am experimenting with a PIC16F628 here and would like put the > > processor in Sleep Mode and then wake it up when a character is > > received in the UART. Problem is that SLEEP seems to shut down the > > OSC and thus the Baudrate Generator is not running to get the > > character. Read over the application note (AN774) and data sheet > and > > I couldn't find any enlightening words about how to handle this. > > > > I am wondering if it would be possible to also hook the RX lead > from > > the RS232 line (RB1) to the external interrupt pin (RB0). Before I > > put the processor to sleep would enable interrupt RB0. After > exiting > > sleep would start processing UART chars (might miss a couple) and > > leave interrupt masked until went back to sleep. > > > > Have I missed something in the data sheet? Has anyone tried this or > > have a better way??? > > > > Bob Ball > > WB8WGA |
|
Can you use hardware handshaking? The RTS line could be used to wake up a PIC. Charles Linquist -----Original Message----- From: northwoodsfisherman [mailto:] Sent: Monday, January 26, 2004 7:22 PM To: Subject: [piclist] Re: Waking Up UART from Sleep --- In , "Phil" <phil1960us@y...> wrote: Thanks for the reply Phil. I checked out the "downshifting" option you mentioned but it requires to be running in either INTRC or ER Mode. The UART application note warns about using these modes for a UART operation due to clock variation might make it unreliable with some RS 232 devices. So guess should have a crystal. I could go to an external 32 to 200 khz crystal (XT Mode) and cut down the power consumption but can't get fast enough baud rate (wanted at least 1200). I think your external oscillator suggestion would work and is a possibility. I'll also try tying RB1 to RB0 to wake it up on a bit transistion external interrupt to see if that can be made to work when I breadboard it. Am waiting for the MAX232 RS232 driver in the mail. Thanks Again Bob WB8WGA > yeah, sleep is just a little too, well, deep. > > If its power saving you want, you could put the 628 into INTOSC mode > at 37 khz. I'm not how the BRG needs to be set and you have to figure > out how handle the first byte that comes down . When you see a > character, you then toggle up to 4 mhz. I'm not sure if this meets > you app needs as INTOSC can be problematic for BRG and I dont > immediately see a way to toggle between INTOSC and XT or HS (so you > can run at a frequency that can be used for BRG). Look at the > "special features" section of the data sheet. > > Maybe you could build a dual speed external oscillator on CLKIN and > toggle it with a spare i/o pin (RA6 becomes free). See EC mode. > That's probably how I would do it if I HAD to use a 16F628. > > Several other PICs (look at the 16F88, for example) allow for > switching between external and internal OSCs. You can have primary > and secondary oscillators and switch between them at will. > > --- In , "northwoodsfisherman" <caravita@e...> > wrote: > > Hi > > Am experimenting with a PIC16F628 here and would like put the > > processor in Sleep Mode and then wake it up when a character is > > received in the UART. Problem is that SLEEP seems to shut down the > > OSC and thus the Baudrate Generator is not running to get the > > character. Read over the application note (AN774) and data sheet > and > > I couldn't find any enlightening words about how to handle this. > > > > I am wondering if it would be possible to also hook the RX lead > from > > the RS232 line (RB1) to the external interrupt pin (RB0). Before I > > put the processor to sleep would enable interrupt RB0. After > exiting > > sleep would start processing UART chars (might miss a couple) and > > leave interrupt masked until went back to sleep. > > > > Have I missed something in the data sheet? Has anyone tried this or > > have a better way??? > > > > Bob Ball > > WB8WGA to unsubscribe, go to http://www.yahoogroups.com and follow the instructions ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cidU11 http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/dN_tlB/TM ---------------------------------~- |
|
--- In , "Charles Linquist" <Charles@L...> wrote: Good idea Charles. I think that will work for me. Thanks! Still will miss a few chars while it is coming out of sleep (sorta like me while drinking my morning coffee) but I can deal with that. Thanks Again Bob Ball WB8WGA > > Can you use hardware handshaking? The RTS line could be used to wake up a > PIC. > > Charles Linquist > > -----Original Message----- > From: northwoodsfisherman [mailto:caravita@e...] > Sent: Monday, January 26, 2004 7:22 PM > To: > Subject: [piclist] Re: Waking Up UART from Sleep > > --- In , "Phil" <phil1960us@y...> wrote: > > Thanks for the reply Phil. I checked out the "downshifting" option you > mentioned but it requires to be running in either INTRC or ER Mode. The UART > application note warns about using these modes for a UART operation due to > clock variation might make it unreliable with some RS 232 devices. So guess > should have a crystal. I could go to an external 32 to 200 khz crystal (XT > Mode) and cut down the power consumption but can't get fast enough baud rate > (wanted at least 1200). I think your external oscillator suggestion would > work and is a possibility. I'll also try tying RB1 to RB0 to wake it up on > a bit transistion external interrupt to see if that can be made to work when > I breadboard it. Am waiting for the MAX232 RS232 driver in the mail. Thanks > Again Bob WB8WGA > > > yeah, sleep is just a little too, well, deep. > > > > If its power saving you want, you could put the 628 into INTOSC > mode > > at 37 khz. I'm not how the BRG needs to be set and you have to figure > > out how handle the first byte that comes down . When you see > a > > character, you then toggle up to 4 mhz. I'm not sure if this > meets > > you app needs as INTOSC can be problematic for BRG and I dont > > immediately see a way to toggle between INTOSC and XT or HS (so you > > can run at a frequency that can be used for BRG). Look at the > > "special features" section of the data sheet. > > > > Maybe you could build a dual speed external oscillator on CLKIN and > > toggle it with a spare i/o pin (RA6 becomes free). See EC mode. > > That's probably how I would do it if I HAD to use a 16F628. > > > > Several other PICs (look at the 16F88, for example) allow for > > switching between external and internal OSCs. You can have primary > > and secondary oscillators and switch between them at will. > > > > --- In , "northwoodsfisherman" > <caravita@e...> > > wrote: > > > Hi > > > Am experimenting with a PIC16F628 here and would like put the > > > processor in Sleep Mode and then wake it up when a character is > > > received in the UART. Problem is that SLEEP seems to shut down > the > > > OSC and thus the Baudrate Generator is not running to get the > > > character. Read over the application note (AN774) and data sheet > > and > > > I couldn't find any enlightening words about how to handle this. > > > > > > I am wondering if it would be possible to also hook the RX lead > > from > > > the RS232 line (RB1) to the external interrupt pin (RB0). Before > I > > > put the processor to sleep would enable interrupt RB0. After > > exiting > > > sleep would start processing UART chars (might miss a couple) and > > > leave interrupt masked until went back to sleep. > > > > > > Have I missed something in the data sheet? Has anyone tried this > or > > > have a better way??? > > > > > > Bob Ball > > > WB8WGA > to unsubscribe, go to http://www.yahoogroups.com and follow the instructions > > > ------------------------ Yahoo! Groups Sponsor --------------------- ~--> Buy > Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer > at MyInks.com. Free s/h on orders $50 or more to the US & Canada. > http://www.c1tracking.com/l.asp?cidU11 > http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/dN_tlB/TM > -------------------------------- -~-> > > |
Hi Bob,
If you have the luxery of using RTS to wake you
up, perhaps you can extend the concept and use CTS to tell the PC its ok to
send, that way you would'nt have to miss any characters. PC asserts RTS,
while your waking up, PC monitors CTS. Once your fully awake, your assert CTS
which causes the PC to start sending.
Scott Kellish
|
|
how clean is RTS/CTS? I'd be a bit worried about noise - it could keep the processor out of the sleep mode a lot if its an issue. --- In , "Scott Kellish" <skellish@c...> wrote: > Hi Bob, > If you have the luxery of using RTS to wake you up, perhaps you can extend the concept and use CTS to tell the PC its ok to send, that way you would'nt have to miss any characters. PC asserts RTS, while your waking up, PC monitors CTS. Once your fully awake, your assert CTS which causes the PC to start sending. > > Scott Kellish > ----- Original Message ----- > From: northwoodsfisherman > To: > Sent: Tuesday, January 27, 2004 8:06 AM > Subject: [piclist] Re: Waking Up UART from Sleep > --- In , "Charles Linquist" <Charles@L...> > wrote: > > Good idea Charles. I think that will work for me. Thanks! Still will > miss a few chars while it is coming out of sleep (sorta like me while > drinking my morning coffee) but I can deal with that. > > Thanks Again > > Bob Ball > WB8WGA > > > > Can you use hardware handshaking? The RTS line could be used to > wake up a > > PIC. > > > > Charles Linquist > > > > > > > > -----Original Message----- > > From: northwoodsfisherman [mailto:caravita@e...] > > Sent: Monday, January 26, 2004 7:22 PM > > To: > > Subject: [piclist] Re: Waking Up UART from Sleep > > > > --- In , "Phil" <phil1960us@y...> wrote: > > > > Thanks for the reply Phil. I checked out the "downshifting" option > you > > mentioned but it requires to be running in either INTRC or ER Mode. > The UART > > application note warns about using these modes for a UART operation > due to > > clock variation might make it unreliable with some RS 232 devices. > So guess > > should have a crystal. I could go to an external 32 to 200 khz > crystal (XT > > Mode) and cut down the power consumption but can't get fast enough > baud rate > > (wanted at least 1200). I think your external oscillator suggestion > would > > work and is a possibility. I'll also try tying RB1 to RB0 to wake > it up on > > a bit transistion external interrupt to see if that can be made to > work when > > I breadboard it. Am waiting for the MAX232 RS232 driver in the > mail. Thanks > > Again Bob WB8WGA > > > > > > > > > yeah, sleep is just a little too, well, deep. > > > > > > If its power saving you want, you could put the 628 into INTOSC > > mode > > > at 37 khz. I'm not how the BRG needs to be set and you have to > figure > > > out how handle the first byte that comes down . When you see > > a > > > character, you then toggle up to 4 mhz. I'm not sure if this > > meets > > > you app needs as INTOSC can be problematic for BRG and I dont > > > immediately see a way to toggle between INTOSC and XT or HS (so > you > > > can run at a frequency that can be used for BRG). Look at the > > > "special features" section of the data sheet. > > > > > > Maybe you could build a dual speed external oscillator on CLKIN > and > > > toggle it with a spare i/o pin (RA6 becomes free). See EC mode. > > > That's probably how I would do it if I HAD to use a 16F628. > > > > > > Several other PICs (look at the 16F88, for example) allow for > > > switching between external and internal OSCs. You can have > primary > > > and secondary oscillators and switch between them at will. > > > > > > --- In , "northwoodsfisherman" > > <caravita@e...> > > > wrote: > > > > Hi > > > > Am experimenting with a PIC16F628 here and would like put the > > > > processor in Sleep Mode and then wake it up when a character is > > > > received in the UART. Problem is that SLEEP seems to shut down > > the > > > > OSC and thus the Baudrate Generator is not running to get the > > > > character. Read over the application note (AN774) and data sheet > > > and > > > > I couldn't find any enlightening words about how to handle this. > > > > > > > > I am wondering if it would be possible to also hook the RX lead > > > from > > > > the RS232 line (RB1) to the external interrupt pin (RB0). Before > > I > > > > put the processor to sleep would enable interrupt RB0. After > > > exiting > > > > sleep would start processing UART chars (might miss a couple) > and > > > > leave interrupt masked until went back to sleep. > > > > > > > > Have I missed something in the data sheet? Has anyone tried this > > or > > > > have a better way??? > > > > > > > > Bob Ball > > > > WB8WGA > > > > > > to unsubscribe, go to http://www.yahoogroups.com and follow the > instructions > > > > > > ------------------------ > -------------------------------- ---------- > Yahoo! Groups Links > > a.. To |
As I remember RTS and CTS as active low, but
regardless, I think you'd want to put in an appropriate pull-up resistor on
each line.
Scott Kellish
|
