HCS08 uart and 7 bits+parity

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HCS08 uart and 7 bits+parity

1,778件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,387件の閲覧回数
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

 

1,387件の閲覧回数
AndersJ
Contributor IV

Mac,

 

Thanks for you help.

 

Anders

0 件の賞賛
返信