diff --git a/int_to_bcd.c b/int_to_bcd.c new file mode 100644 index 0000000..d1bbdae --- /dev/null +++ b/int_to_bcd.c @@ -0,0 +1,14 @@ +#include "mc8051fun.h" + +uint16_t int_to_bcd(uint16_t i) +{ + uint16_t b; + b = i%10; + i/=10; + b |= (i%10)<<4; + i/=10; + b |= (i%10)<<8; + i/=10; + b |= (i%10)<<12; + return b; +}