bin 16 to 4 (or 5) bcd and 4 bcd to bin 16

Status
Not open for further replies.

david_mora

New Member
hi people, i need help with this convertions:
16 bits binary number to 4 BCD digits
4 BCD digits to 16 bits binary number
16 bits multiplied by 8 bits
16 bits divided by 8 bits.

thanks
 
david_mora said:
hi people, i need help with this convertions:
16 bits binary number to 4 BCD digits
4 BCD digits to 16 bits binary number
16 bits multiplied by 8 bits
16 bits divided by 8 bits.

thanks

You don't mention what processor it's for, assuming it's for PIC, there are loads of examples on the PICList.

Also, you seem confused by BCD - presumably you want to convert a 16 bit number to FIVE decimal digits (BCD is a totally different thing, and not something you would normally want to do - particularly as the PIC doesn't have BCD maths support). If you did want BCD (for some bizarre purpose?), 16 bits is 2.5 bytes BCD.
 
well, i need the 16 bits bynaryu number to 4 BCD digits,, because i enter a max value of 3600 from a matrix keypad, then, i must convert this 4 BCD digits to 16 bits binary number and after processing it i must print the result in an LCD, with the max value of 3600.... that is why i only ask fot 4 bdc digits..... well the pic i am using is 16f877. thanks a lot.

PD: i did enter to your page, but, since this is a titulatiion proyect, i must explain each instruction, so i will be more thankfull if you "teach" me how to make this programs (or routines). thanks a lot for your interest.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…