15 lines
178 B
C
15 lines
178 B
C
#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;
|
|
}
|