Page 1 of 1
How to convert BCD to DEC
Posted: Mon Jan 20, 2014 6:36 pm
by Desdewit
Hallo
What is the quickest way to get BCD to DEC or Ascii to be displayed on lcd?
Re: How to convert BCD to DEC
Posted: Mon Jan 20, 2014 7:09 pm
by JohnCrow
Re: How to convert BCD to DEC
Posted: Mon Jan 20, 2014 11:45 pm
by medelec35
Not sure how well this will work:
Code: Select all
dec = (bcd >> 4) * 10 + (bcd & 15)
Martin
Re: How to convert BCD to DEC
Posted: Tue Jan 21, 2014 5:12 am
by Desdewit
Thanks I will give it a go.
Re: How to convert BCD to DEC
Posted: Tue Jan 21, 2014 6:55 pm
by Desdewit
Hi Martin / John
I've tested the code after I did some reading and my onboard RTCC is running at last. Thanks for the help.

Re: How to convert BCD to DEC
Posted: Tue Jan 21, 2014 7:02 pm
by medelec35
Hi Desdewit,
Glad it's working for you.
If the code that worked was different to what I posted, would you mind posting it please, to help others that may be faced with the same issue.
Or was it the code I posted you used?
Maritin
Re: How to convert BCD to DEC
Posted: Tue Jan 21, 2014 9:06 pm
by Desdewit
Hi Martin
The code you posted worked but I will post a basic program for the onboard rtc over the weekend.
