Hi,
I've just tried this at my end and it seems to work fine. The DEFINE sets the RCSTA and TXSTA (once) as well as "tells" the compiler to insert code to calculate the parity bit for each byte it send and receives. If we then "override" and disables the transmision of the 9th bit PBP will still calculate and load that bit into the 9th databit "slot" but it will never get sent out.
In my particular case I'm swiching between using and not using parity for both RX and TX, at runtime, so I had to add dual HSERIN commands in my receive ISR, like:
Code:
If RCSTA.6 = 1 THEN 'If 9th bit reception is enabled we're using parity.
HSERIN ParityError, [RxChar]
ELSE
HSERIN [RxChar]
ENDIF
Goto OverParityError
ParityError:
'Handle it here
OverParityError:
'Continue here....
Thanks again for pointing this, now pretty obvious, way out!
/Henrik.
Bookmarks