10bit conversion to decimal
10bit conversion to decimal
I am using the pic16f877a. Is there an equation or some algorithm that i could use to convert the 10bit result to decimal. I want to display the number on a 4digit 7seg display.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
There is indeed an equation
Variable = 10bit result
1st Digit = Variable % 10; //Ones % Symbol = MOD
Variable = Variable / 10;
2nd Digit = Variable % 10; //Tens % Symbol = MOD
Variable = Variable / 10;
3rd Digit = Variable % 10; //Hundreds % Symbol = MOD
Variable = Variable / 10;
4th Digit = Variable % 10; //Thousands % Symbol = MOD
Variable = 10bit result
1st Digit = Variable % 10; //Ones % Symbol = MOD
Variable = Variable / 10;
2nd Digit = Variable % 10; //Tens % Symbol = MOD
Variable = Variable / 10;
3rd Digit = Variable % 10; //Hundreds % Symbol = MOD
Variable = Variable / 10;
4th Digit = Variable % 10; //Thousands % Symbol = MOD
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel