Do you have a question? Post it now! No Registration Necessary
- Posted on
- Does a PIC16F628 Serial Port Go To Sleep?
September 27, 2005, 10:23 am
rate this thread
I am working on an serial RS232 RF link between two PIC16F628's.
The master uses SEROUT to send a serial command such as "*0001-5260*F"
out to the cloud of slaves. The "*0001-5260*" is the address of one of
the slaves, and the "F" is the command. The slave with that serial
number responds, receives the string with SERIN, then verifies that the
whole command was read (it must match the master's serial number and
have either an A, B, C, D, E or F after the serial number), then the
slave peels off the "F" which is the command to turn on pin B7 and
turns on pin B7, waits a second, then turns it off. The slave then
uses SEROUT to echo the command that was received back to the master
with an "OK" appended to the end, so the slave sends the string
"*0003-9659*FOK" (the *0003-9659*" is the address of the master's RF
modem). The master uses SERIN to receive the "FOK" and knows that the
slave received the command, and if no confirmation is received from the
slave, the master resends the command once more, then gives up if there
is still no response from the slave.
The RF modems are serial RF modems running at 9600 baud, and their
internal sleep and time-out modes have been disabled.
I am using a Max232 to make the PIC's serial signals correct.
I am not using handshaking...just TX and RX.
The problem is that if I send a command to the slave from a terminal
program on my PC, it works great. But if I wait for 10 or 20 minutes
or so and send the command again, I get garbage echoed back from the
If I send the command a second time, it responds correctly, but then
will do the same garbage sthing after another 10 or 20 minutes or so.
I can't figure out why the PIC would spit out garbage characters after
not communicating for a while.
I have the slave flash it's status LED once every 3 seconds, so I can
see that the PIC hasn't crashed.
I even tried having the pic send a character to the RF modem every so
often to see if the serial port or modem was timing out, but the same
Does the PIC's serial circuit time out after a while, or does the
Max232 go to sleep? What could cause this?
- Meindert Sprang
September 27, 2005, 11:15 am
Re: Does a PIC16F628 Serial Port Go To Sleep?
Does the RF link use CRCs to only deliver verified data, or pass through
data on a best effort basis?
I don't know what your problem is, but I would use a digital scope or
serial data analyzer to monitor to links: PIC to modem, modem to PIC.
You should be able to find where the problem is occurring. It could be
something within the modem. It might have to do with how your slave
handles comm noise.