|
|
View previous topic :: View next topic |
Author |
Message |
ben fem
Joined: 18 May 2006 Posts: 3
|
USART parity problem on 18f8722 |
Posted: Tue Dec 05, 2006 3:33 am |
|
|
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
|
|
Posted: Tue Dec 05, 2006 9:19 am |
|
|
Check the data sheet for this part. I don't think it has hardware support for parity. _________________ David |
|
|
Ttelmah Guest
|
|
Posted: Tue Dec 05, 2006 11:10 am |
|
|
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
|
Re: USART parity problem on 18f8722 |
Posted: Tue Dec 05, 2006 12:24 pm |
|
|
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. |
|
|
|
|
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
|