Hallo
What is the quickest way to get BCD to DEC or Ascii to be displayed on lcd?
How to convert BCD to DEC
Moderator: Benj
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: How to convert BCD to DEC
Not sure how well this will work:
Martin
Code: Select all
dec = (bcd >> 4) * 10 + (bcd & 15)
Martin
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
- Contact:
Re: How to convert BCD to DEC
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.
I've tested the code after I did some reading and my onboard RTCC is running at last. Thanks for the help.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: How to convert BCD to DEC
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
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
Martin
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
- Contact:
Re: How to convert BCD to DEC
Hi Martin
The code you posted worked but I will post a basic program for the onboard rtc over the weekend.
The code you posted worked but I will post a basic program for the onboard rtc over the weekend.