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 support@ccsinfo.com

USART parity problem on 18f8722

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



Joined: 18 May 2006
Posts: 3

View user's profile Send private message

USART parity problem on 18f8722
PostPosted: Tue Dec 05, 2006 3:33 am     Reply with quote

Hi everyone,

I have a problem with pic 18f8722.

When i try to compile :
Code:
#use rs232(baud=9600,parity=O,xmit=PIN_C6,rcv=PIN_C7,bits=9)


The compiler answer :
Quote:
*** Error 100 "D:\TEMP\test.h" Line 5(5,61): USE parameter value is out of range Too many bits


The compilation is a success when i put :

Code:
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)

OR
Code:
#use rs232(baud=9600,parity=O,xmit=PIN_C6,rcv=PIN_C7,bits=8)


But I need odd parity and 9 bits... So I don't know how to do !!?
Someone have an idea ?

Thanks for answers.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Tue Dec 05, 2006 9:19 am     Reply with quote

Check the data sheet for this part. I don't think it has hardware support for parity.
_________________
David
Ttelmah
Guest







PostPosted: Tue Dec 05, 2006 11:10 am     Reply with quote

It is worse than this.
The UART in the PICs, does not support parity. It supports the transmission of 8 or 9bits, and it is up to the software to use this ninth bit to generate parity. The CCS driver does this. So selecting 8bits, with parity, enables the transmission of 9bit data, with the ninth bit being the parity bit. You therefore cannot on any PIC generate 9 bit data with parity (using the hardware).

Best Wishes
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

Re: USART parity problem on 18f8722
PostPosted: Tue Dec 05, 2006 12:24 pm     Reply with quote

You could set it up like this.
ben fem wrote:

Code:
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9,errors)



Then upon the RDA interrupt, read the buffer, catch the parity, clear the buffer.

I just hope the "errors" prevents the hardware usart from detecting framming errors.
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