|
|
View previous topic :: View next topic |
Author |
Message |
WillysJeeps
Joined: 24 May 2012 Posts: 5
|
RS232_ERRORS variable bit definitions |
Posted: Mon Jun 04, 2012 5:43 pm |
|
|
Does anyone know where I can find the complete definition list for RS232_ERRORS as generated by #USE_RS232(ERRORS, blah blah blah)?
From the manual:
Bit 0:
Bit 1:
Bit 2:
Bit 3:
Bit 4:
Bit 5:
Bit 6: not high at the end of the bit time/multi-master collision
Bit 7: 9th bit for 9 bit data mode (get and put).
I'm getting some errors (144, 146, 148, 150), but I can't find the magic decoder ring. I'm assuming this is an 8-bit variable. Thanks all. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 04, 2012 5:49 pm |
|
|
Quote: |
I'm getting some errors (144, 146, 148, 150),
|
Don't display the values in decimal. Use hex.
The CCS manual says where the bits come from:
Quote: |
With a UART:
Copy of RCSTA register except:
Bit 0 is used to indicate a parity error.
|
Look up the bit definitions of the RCSTA register in your PIC.
(Always post your PIC).
See page 156 in the Acrobat reader:
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf |
|
|
WillysJeeps
Joined: 24 May 2012 Posts: 5
|
|
Posted: Tue Jun 05, 2012 10:15 am |
|
|
So to translate the numbers, the errors I'm getting back are 0x90, 0x92, 0x94, 0x96.
I'm using a 18F46K22, which has 2 Enhanced USARTs. This problem is on port #1. I have not tried port #2 to see if I'm getting the same issue. Port #2 does work and I can move data across.
My Baud rate is set to 9600 and I'm using the internal oscillator at 16MHz. My setup looks like this:
Code: | #include <18F46k22.h>
#fuses HSM, INTRC_IO, NOMCLR, NOWDT, LVP, NOBROWNOUT, NOPROTECT, PUT, NOPBADEN
#use delay(clock=16000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, Stream=PC, UART1, ERRORS)
#use rs232(baud=115200, xmit=PIN_D6, rcv=PIN_D7, UART2, stream=BT, ERRORS)
|
Looking at page 156 of the manual - OK - I missed the second part where it say if you are using hardware you get a copy of the RECEIVE STATUS register. Given that it looks like I've got a couple framing errors and a couple overrun errors. Now to track those down and find out why my Xon/Xoff isn't working.
This lead me to another question, which uart is the RS232_ERRORS reporting from and how would I get to the second uart RS232_ERRORS variable? I know ERRORS clears the RECEIVE STATUS register errors when detected so I'm assuming RS232_ERRORS is loaded when that happens? The manual doesn't explain the behavior well on page 156. What happens when both uarts are being used at the same time? How can you tell which error is which port? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|