Hello.
I am trying to make a program for a microcontroller in C language which covers operation of bits representing decimal numbers.
What I mean with this is:
I have x number of LEDs which will work as outputs and x number of input buttons to perform operations which will then create results both in whole numbers and percentage numbers (fractions such as 5.25, 5.50, 5.75) From the little knowledge I have I know that this can be done using bitwise operations such as shifts and &, oring, and xoring.
I am having trouble creating an algorithm that will input said numbers to be calculated....
x = 15 (1111) / y = 4 (0100) = 3.75 (Which I know that will require per se (3 LEDs that represent the decimal 111 = .75, 010 = .50, 001 = .25) and (4 LEDS or more to represent the whole number).
I do not know if I am right with the kind of algorithm I want to create but I am kind of stuck on how shifts can create the operations of binary numbers representing decimal numbers and to conserve the desired results in binary.
I am trying to make a program for a microcontroller in C language which covers operation of bits representing decimal numbers.
What I mean with this is:
I have x number of LEDs which will work as outputs and x number of input buttons to perform operations which will then create results both in whole numbers and percentage numbers (fractions such as 5.25, 5.50, 5.75) From the little knowledge I have I know that this can be done using bitwise operations such as shifts and &, oring, and xoring.
I am having trouble creating an algorithm that will input said numbers to be calculated....
x = 15 (1111) / y = 4 (0100) = 3.75 (Which I know that will require per se (3 LEDs that represent the decimal 111 = .75, 010 = .50, 001 = .25) and (4 LEDS or more to represent the whole number).
I do not know if I am right with the kind of algorithm I want to create but I am kind of stuck on how shifts can create the operations of binary numbers representing decimal numbers and to conserve the desired results in binary.