View previous topic :: View next topic |
Author |
Message |
volcane
Joined: 23 Feb 2008 Posts: 29
|
Bug EX_STR.C |
Posted: Sun Apr 12, 2009 2:46 pm |
|
|
Hi!
I'm using the development board CCS with 16f877A i uploaded example EX_STR.C
working normally, but when i pressed the enter key on the keyboard without releasing, the program on the PIC (EX_STR.C) is blocked. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Apr 12, 2009 2:57 pm |
|
|
This example does not use #int_rda with a receive buffer, so it can only
receive characters when it's executing the get_string() function. If the
program is sending out text with a printf() statement and you send it
characters from the keyboard at the same time, the UART will lock up.
To fix the lock-up problem, add ERRORS to the #use rs232() statement
as shown below:
Quote: | #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS) |
CCS should do this in most of their examples. For some reason, they
don't do it. |
|
|
volcane
Joined: 23 Feb 2008 Posts: 29
|
|
Posted: Sun Apr 12, 2009 3:22 pm |
|
|
Hi!
Working!!!
I wanted to add: the compiler shows a message Warning: variable never used: rs232_errors
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
volcane
Joined: 23 Feb 2008 Posts: 29
|
|
Posted: Sun Apr 12, 2009 4:44 pm |
|
|
Hi!
Thanks for the information, I believe that in the future I will use the ISR. |
|
|
|