PDA

View Full Version : Serial Port Timeout



isaac
- 2nd July 2005, 09:58
Hi People

Could someone be able to point me in the right direction here:)
I am running a Data Logger which is in sleep mode for 99% of the time
The problem is that I wake the PIC from sleep when it receives any
character from the Serial port and jumps to my Sub Routine Called SETMODE
This all works fine and if I type the word SET and if the word typed is not
correct its times out and go back to the label SLEEP_AGAIN, where the Pic
goes back to sleep.
This is all achieved by me linking my RX line to RBO Interrupt.
The problem is that , once in the Label SETUP_MODE, if no character is
received the program doesn't timeout to label SLEEP_AGAIN only if a
character is received but
Not the correct character.

Is there a way I can make the program timeout if no character comes in


Isaac

SETUP_MODE:

HSEROUT[" **** SET UP MODE ***** ",10,13,10,13 ]
'================================================
Hserin 2000, SLEEP_AGAIN, [WAIT ("SET")] ' Get the word SET from serial
port
'WAITS FOR 2 SECOND FOR THE TEXT SOIL
'=================================================

Rest of program here

End

mister_e
- 2nd July 2005, 14:56
what about some FOR TO NEXT loop with PAUSEUS to poll the RCIF bit???

isaac
- 2nd July 2005, 15:17
Thanks steve

\but i don't understand what you mean here

isaac

mister_e
- 2nd July 2005, 15:38
Can you post the PIC you use and schematic?? We can work on something for you.

isaac
- 2nd July 2005, 19:05
I am using an 18f452 with the RX line tired to RB0 Interupt.
This is because when is sleep mode any activity on the RX line (ie when i
type in hypertheminal) the pic wakes up.
RB0 has a 10k pullup resistor to +5v


Isaac