CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RS232_ERRORS variable bit definitions

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
WillysJeeps



Joined: 24 May 2012
Posts: 5

View user's profile Send private message

RS232_ERRORS variable bit definitions
PostPosted: Mon Jun 04, 2012 5:43 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jun 04, 2012 5:49 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 05, 2012 10:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 05, 2012 11:43 am     Reply with quote

Quote:

What happens when both uarts are being used at the same time?
How would I get to the second uart RS232_ERRORS variable?

See these posts by Ttelmah:
http://www.ccsinfo.com/forum/viewtopic.php?t=19027
http://www.ccsinfo.com/forum/viewtopic.php?t=17911
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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