Hello!
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 PIC.
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 thing happened.
Does the PIC's serial circuit time out after a while, or does the Max232 go to sleep? What could cause this?
Any ideas?
Thanks!