View previous topic :: View next topic |
Author |
Message |
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
[SOLVED] Question about RS232_ERRORS |
Posted: Mon Apr 18, 2011 1:14 pm |
|
|
Hi There,
How do I know which USART is represented int RS232_ERRORS?
Can't find documentation.
Thanks,
Ron
Last edited by cerr on Mon Apr 18, 2011 3:13 pm; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9253 Location: Greensville,Ontario
|
|
Posted: Mon Apr 18, 2011 1:54 pm |
|
|
open a project..
press F11...ccs onscreen help !
search for #use rs232
read what it says ....
"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.
Warning:
The PIC UART will shut down on overflow (3 characters received by the hardware with a GETC() call). The "ERRORS" option prevents the shutdown by detecting the condition and resetting the UART.
"
I tend to leave the CCS onscreen help open while in all projects...saves me time loking up 'stuff' like this ! |
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Mon Apr 18, 2011 2:24 pm |
|
|
Huh,
Thank you! So what's the best approach to determine which USART is carrying an error? It doesn't say if RS232_ERRORS is mirroring RCSTA1 or RCSTA2... The problem i'm experiencing is that I put my RS232 from the PC in BREAK (verified with oscilloscope) but the PIC doesn't see it. My code:
Code: | if (bit_test (RS232_ERRORS, 2)&& ! input (PC_RX)) { |
This is on USART1.
Any suggestions? |
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Mon Apr 18, 2011 3:13 pm |
|
|
I'm now just doing it this way round:
Code: | if (bit_test (RCSTA1, 2)&& ! input (PC_RX)) { |
Where RCSTA1 is
Code: | #byte RCSTA1 = getenv("sfr:RCSTA1") |
That seems to work fine for me.
Thanks,
Ron |
|
|
|