avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] BCD and packed BCD


From: Chris McFarlen
Subject: Re: [avr-gcc-list] BCD and packed BCD
Date: Wed, 29 May 2002 16:41:58 -0500

On Wednesday 29 May 2002 02:05 pm, Brandon Tolbert wrote:
> Does anyone know the difference between bcd and packed bcd?

Ooh, me, I know!
BCD is Binary Coded Decimal

BCD: take 0-9 in binary, it only uses 4 bits, so
         1 - 0001, 2 - 0010 ... 9 - 1001

then to pack it combine 2 BCD numbers into 1 byte, ie.
    packed_bcd = 9 << 4 | 1;

The number 86 in packed bcd is 10000110.

Hope that helps,
Chris


avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]