Need help with converting base 10 (2 digits) to BCD code(8 bits)
matt_will
Posts: 1
I have 2 7 segment displays on which I need to show a double digit base 10 number that can vary from 50 -90. How do I convert the two digit number to the 8 bits for the BCD code? I am using 2 7447 decoder drivers and have them connected to pin 8 - 15. I know how to use the OUTH = % command.
Comments
NUMH Var Nib
NUML Var Nib
NUMH = NUM/10
NUML = NUM//10
Both NUMH and NUML will be 0-9. That can be written directly to your outputs, but use OUTC and OUTD:
OUTC = NUML
OUTD = NUMH
OUTC = num DIG 0
OUTD = num DIG 1
Page 117 in the Stamp manual.