BCD List to HEX List
Philippe Martin
pmartin at snakecard.com
Sun Jul 30 18:31:25 EDT 2006
Dennis Lee Bieber wrote:
> On Sun, 30 Jul 2006 16:39:47 -0500, Philippe Martin
> <pmartin at snakecard.com> declaimed the following in comp.lang.python:
>
>>
>> My apologies, I clearly made a mistake with my calculator, yes the
>> resulting array I would need is [0xb,0xc,0x6,0x1,0x4,0xe]
>>
> Take note that this is NOT a BCD form for "12345678". BCD (typically
> packed) uses four bits per decimal digit. That would make "12345678" =>
> 0x12, 0x34, 0x56, 0x78 (ignoring matters of big/little end).
>
> The binary representation of 12345678, in bytes, is 0xBC, 0x61, 0x4E
>
> 0xb, 0xc... is really 0x0B, 0x0C... 8-bits per byte, with MSB set to
> 0000.
>
> Compare:
> BCD 00010010 00110100 01010110 01111000
> binary 10111100 01100001 01001110
> your 00001011 00001100 00000110 00000001 00000100 00001110
> --
> Wulfraed Dennis Lee Bieber KD6MOG
> wlfraed at ix.netcom.com wulfraed at bestiaria.com
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: web-asst at bestiaria.com)
> HTTP://www.bestiaria.com/
Yes I realized that after writing it.
Regards,
Philippe
More information about the Python-list
mailing list