In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote: dbj, A byte value in Binary Coded Decimal notation will typically represent two decimal digits, the smallest in the lower nibble, the highest in the upper nibble. For example, the decimal number ninety-five (95) would look like %10010101 in a BCD byte. To extract the digits five (5) and nine (9) from the BCD byte and place them in their own separate bytes, you could do the following. For the lower digit perform a logical AND operation with the hex value $0F and the BCD byte. The result is the lower digit, in this case five (5). For the upper digit perform a logical AND operation with the hex value $F0 and the BCD byte. Then divide the result by 16. This should leave a binary representation of the second digit, nine (9) in this case. I hope this helps. - Sparks ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=159072#m159169 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)