View previous topic :: View next topic |
Author |
Message |
bsodmike
Joined: 05 Aug 2006 Posts: 52
|
putc(), getc()... |
Posted: Wed Aug 30, 2006 12:13 pm |
|
|
Quick question, in the event nothing is received does this function timeout? Or does it simply attempt to read the RCREG register, find that it hasn't been loaded and continue?
Was just wondering it no devices were attached, if these would cause the code to halt...but I don't see why putc() would be affected. (both are in ref to async rs232)
Cheers,
Mike |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 30, 2006 12:18 pm |
|
|
Quote: | Quick question, in the event nothing is received does this function timeout? |
getc() and fgetc() will wait forever, while looking for a character to
come in.
Use kbhit() to check if a character is available, before calling getc() or
fgetc(). Also look at the timed_getc() function in this example file:
c:\program files\picc\examples\ex_tgetc.c |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
|
bsodmike
Joined: 05 Aug 2006 Posts: 52
|
|
Posted: Thu Aug 31, 2006 12:42 am |
|
|
That said putc() isn't affected yea?
Cheers! |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu Aug 31, 2006 8:12 am |
|
|
Quote: |
That said putc() isn't affected yea?
|
yea
Humberto |
|
|
|