View previous topic :: View next topic |
Author |
Message |
newbie_1974
Joined: 04 Jul 2007 Posts: 4
|
ATI Commands & Rs232 - PIC 18F8722 |
Posted: Wed Jul 04, 2007 4:57 pm |
|
|
Hi,
PLEASE HELP!
I'm trying to implement a timeout on serial port if I don't get a character after say 30 seconds. I've looked at the timed_getc() example, this is fine upto 1/2 second but if I increase this it never returns.
I'm using the following to read the ATI response from a modem.
fprintf (rs232stream,"ATI4\n\r");
while (1)
{
c = fgetc (rs232stream);
fprintf (hyperterm, "%c", c);
}
I would love it if I could replace the above with a timeout version which works - many thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
newbie_1974
Joined: 04 Jul 2007 Posts: 4
|
|
Posted: Thu Jul 05, 2007 12:11 am |
|
|
Hi PCM Programmer,
That wasn't me, but thanks for posting the link. I'm new to PIC programming, I was thinking on the same lines of the example but don't know how to do it.
My question is on the RTCC timer, can you let me have an example of a variable time out function such as:
Code: | void timeout ( int16 num_secs)
{
// this will wait num_secs before timing out
...
code
...
}
|
I'm not completely sure of the best way to do this - thanks
help! |
|
|
|