HCS08 uart and 7 bits+parity

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS08 uart and 7 bits+parity

844 Views
AndersJ
Contributor IV

As far as I can tell from the datasheet and Processor Expert the HCS08(DZnnnn) cannot

be set to 7 bit characters+parity.

 

If this is not true, can someone please explain where I may have slipped in my thinking.

 

If true, is there a efficient way to find the parity of the 7 lsb's

apart from the obvious shift/test/count method? ( and then stuff it into bit 7)

 

Thanks,

Anders J

Labels (1)
0 Kudos
2 Replies

453 Views
bigmac
Specialist III

Hello Anders,

 

From the datasheet (Table 14.4), there is the following -

Parity Enable

—Enables hardware parity generation and checking. When parity is enabled, the most significant

bit (MSB) of the data character (eighth or ninth data bit) is treated as the parity bit.

 

So it would appear that enabling parity whilst in 8-bit mode will achieve what you require.

 

Writing code to generate the parity bit can be achieved by two basic methods -

Shift and count as you describe, which should be code efficient, but slow, or

Table lookup method, which is fast, but not code efficient because of the size of the lookup table.

 

Another variation is to use a lookup table to handle each nybble, and then combine the results of the two nybbles. This would need a much smaller 16 entry lookup table, but should still be relatively fast.

 

Regards,

Mac

 

453 Views
AndersJ
Contributor IV

Mac,

 

Thanks for you help.

 

Anders

0 Kudos