View previous topic :: View next topic |
Author |
Message |
object01
Joined: 13 May 2004 Posts: 90 Location: Nashville, TN
|
Undefined identifier: rs232_errors |
Posted: Thu May 12, 2005 2:11 pm |
|
|
Can anyone get this code to compile in 3.224 without the compiler complaining that rs232_errors doesn't exist?
Code: | #include <18F4620.h>
#device ICD=TRUE
#fuses intrc,nowdt,nobrownout,nolvp,noprotect
#use delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_A0, rcv=PIN_A0, ERRORS, stream=asdf)
void main() {
while(1){
output_high(PIN_A0);
rs232_errors = 0;
fprintf(asdf, "HELLO WORLD");
delay_ms(1000);
}
} |
--
Jeff S. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
object01
Joined: 13 May 2004 Posts: 90 Location: Nashville, TN
|
|
Posted: Thu May 12, 2005 2:23 pm |
|
|
Different chip, different month, different compiler version. New question. :)
It may have been my thread, but it was an unrelated problem. The last thread was about the compiler complaining that the variable was never used. Now it's complaining that it doesn't exist.
--
Jeff S. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 12, 2005 2:54 pm |
|
|
I think it's because you've defined a software UART.
The RS232_ERRORS variable is only available under limited
circumstances with a soft UART. Here's what the manual says:
Quote: |
The definition of the RS232_ERRORS is as follows:
No UART:
� Bit 7 is 9th bit for 9 bit data mode (get and put).
� Bit 6 set to one indicates a put failed in float high mode.
With a UART:
� Used only by get:
� Copy of RCSTA register except:
� Bit 0 is used to indicate a parity error. |
It would be more clear if they had stated it as "No Hardware UART" and
"With a Hardware UART".
So if you modify your declaration of a software UART so that it uses
9 bits, then the compiler will create the RS232_ERRORS variable,
and you won't get the error. Example:
Code: | #use rs232(baud=9600, xmit=PIN_A0, rcv=PIN_A0, ERRORS, bits=9, stream=asdf) |
|
|
|
Tom Jetland
Joined: 23 Jun 2011 Posts: 31 Location: UK
|
|
Posted: Wed Jul 02, 2014 10:01 am |
|
|
Also the reason this error will occur is if you haven't specified the correct UART Hardware pins!
Make sure you change these when porting code from one Pic to another!!
Tom |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Jul 02, 2014 10:25 am |
|
|
Tom,
Do you realize that you are replying to a 9 year old thread? Doubtful this is still an issue for the OP. They have either solved it by now, or given up!
IMHO, it's a bad idea to resurrect these 'zombie threads'......
Just sayin'
John |
|
|
|