View previous topic :: View next topic |
Author |
Message |
oxxyfx
Joined: 24 May 2007 Posts: 97
|
|
Posted: Thu Nov 11, 2010 4:43 pm |
|
|
Thank you. Now, the interesting part. If I put the 2 programs together first blinking the LED's and then run the RS232 test the led's will never blink but the characters I type will be echoed back on the serial port.
So why is the LED not blinking. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 11, 2010 4:55 pm |
|
|
Because the getc() function waits in a loop until a character has been
received by the UART. Then it gets the character, and the program
flow moves on to the next line.
You can avoid the waiting loop if you call the kbhit() function before you
call getc(). If kbhit() returns 'True', then call getc(). If not, then don't
call it. |
|
 |
oxxyfx
Joined: 24 May 2007 Posts: 97
|
|
Posted: Thu Nov 11, 2010 6:22 pm |
|
|
Yes, I knew that. However the blinking led is before the code gets to read the getc(). The getc() is in the while loop and the blinking code is before that. I think it should be executed before the code enters into the UART section, or doesn't it? |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Nov 11, 2010 6:33 pm |
|
|
Post the program that fails. |
|
 |
|