On Sat, Dec 08, 2001 at 09:04:19AM -0800, Nick Masluk wrote: > Hi, > > How would you go about taking a binary number from a > register and displaying it in decimal on two 7-segment > displays? I understand how to drive the two displays > in parallel, and I am going to cut off any numbers > above 99dec and display "HH". The part I am having > trouble with is converting the binary number into two > "7-segment" binary numbers for output. It takes some work. You first have to convert to BCD (Binary Coded Decimal). You then have to convert the BCD into the LED segment pattern. I've done this for both my sunrise/sunset clock and my simple automatic thermostat. The thermostat probably has less code: http://www.finitesite.com/d3jsys/thermostat.asm Take a read of the routines GETCHAR, HIGHBCD, and HEX2BCD. GETCHAR does the hex to 7-segment conversion. HEX2BCD does a complete 8 bit hex to 8 bit BCD conversion and HIGHBCD is a utility routine that HEX2BCD uses to quick convert the high nybble of the binary number into BCD. I'm pretty sure they'll do the task you require. BAJ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads