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
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
Mac,
Thanks for you help.
Anders