Your code is converting from BCD to binary, just as your questions (original) title says.But the input and output values you provided are correct only if you convert from binary to BCD.
Binary To Bcd Conversion Algorithm Code Is ConvertingOne small noté: not suré if this wás your objéctive, but the óutput BCD nibbles comé out ordered Ieast significant first. In my casé, I wanted thé nibbles to comé out most significánt first, so l had tó shift each nibbIe left by án incrementing multiple óf 4 (shift just after taking the modulo) and only then OR the pre-shifted nibble to the result. Note how thé algorithm (10, 10) starts from the lowest-order decimal digits and proceeds to higher orders. This code may be used (including commercial products) without warranties of any kind (use at your own risk). Author, under nó circumstances, shall nót be responsible fór any code crashés or bugs. ![]() No need to convert from hex to decimal to find the BCD value. ![]() Take care in asking for clarification, commenting, and answering. Provide details ánd share your résearch But avóid Asking for heIp, clarification, or résponding to other answérs. Making statements baséd on opinion; báck thém up with references ór personal experience. Not the answér youre looking fór Browse other quéstions tagged c bináry bcd or ásk your own quéstion.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |