From ff95ee6537ae0a70145fb925062910d85fae4637 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Sun, 19 May 2024 21:00:30 +0200 Subject: [PATCH] initial commit --- int_to_bcd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 int_to_bcd.c 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; +}