Well, first let's look at how the parity works.
It's calulated by counting the number of 1's in the byte. For instance the letter "J" which is 01001010, 3 bits are a 1.
If using EVEN parity, the parity bit will be set to 0, since 3 is not an even number. ODD parity would be 1, if used.
For the letter "K" 01001011, 4 bits are a 1. So EVEN parity = 1, ODD = 0.
As for sending that via the USART ...
First, set up SPBRG, TXSTA and RCSTA like normal. (many other posts here show how to do that)
Set TXSTA.6 (TX9) to 1. Selects 9-bit transmission
The parity bit goes in TXSTA.0 (TX9D) 9th bit of Transmit Data
Then put the byte to be sent in TXREG
and away she goes.
Bookmarks