Convert integer to BCD
Posted on 2003-03-26
I am looking for a code snippet that shows how to convert an unsigned long integer (4 bytes) too either a packed (preferable) or unpacked BCD format. I would like to see this done using a method simular to the "Add Three" algorithm - not with division operations. The code snippet needs to be in C -- I have two examples of how to do this in PIC assembly, but I'm not certain how the F register works so I can't translate them. I will post the PIC assembly code if someone requests it. My motivation is intellectual curiosity.