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

If two UARTS where is second rs232_errors?

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



Joined: 23 Feb 2004
Posts: 51

View user's profile Send private message

If two UARTS where is second rs232_errors?
PostPosted: Fri Apr 16, 2004 2:41 am     Reply with quote

Friends,

Code:
 #use rs232(DEBUGGER,stream=DEBUG)

#use rs232(baud=115200,xmit=PIN_C6,rcv=PIN_C7,bits=8,parity=n,errors,stream=COM1)

#use rs232(baud=115200,xmit=PIN_G1,rcv=PIN_G2,bits=8,parity=n,errors,stream=COM2)



Q1: "errors" in there results in the creation of a byte called "rs232_errors". But I have two real UARTS onboard my 8720. So where is the corresponding second byte?

Q2: My current treatment of this byte is, as each byte is received: (my inline comments are inferred from the help file):

Code:
      // For Rx only, RS232_ERRORS contains a near-copy of RCSTAx's err bits:
         if ( rs232_errors & 0x01 )                      // compiler sets this
            x_ErrCodes.ISRCOM2R.ParityErrors++;          // bit0: not "9th bit"
         if ( rs232_errors & 0x02 )
            x_ErrCodes.ISRCOM2R.OverrunErrors++;         // bit 1
         if ( rs232_errors & 0x04 )
            x_ErrCodes.ISRCOM2R.FramingErrors++;         // bit 2
         // Other bits are control bits -- see .pdf pg 201/366


Q3: There is apparently some kind of benefit if "errors" is included in those #use rs232 macros. But... what is the benefit? And do I have to READ the byte in order for the magic to occur...? Or set it to zero?

Thanks for your comments,

Smile Robert (PIC18F8720, CCS v3.187)
Ttelmah
Guest







PostPosted: Fri Apr 16, 2004 5:27 am     Reply with quote

RS232_ERRORS, contains the error status for the last UART read, and the 9th bit, for the next one written.
The 'magic', is simply that if this is specified, and errors do occur on the UART, the driver will automatically clear the fault. I must admit, that I prefer to read the 'real' error in the status register, and clear the fault myself, but this is down to personal preference. If 'errors' is not used, a fault occurs, and is not tested for/cleared, then the UART will effectively be 'hung'...

Best Wishes
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