chupa
Member
I have an application where I am converting a binary 2 digit number (00-99) to BCD to display on a 7 segment display. Unfortunately I don't have the ladder here to post as I left it at work today.
I am currently doing this by converting the binary number to BCD.
To get the least significant digit I mask to only show the first 4 bits, then just use a lookup table to set the outputs to the correct value.
I am drawing a blank on how to do the most significant digit. I guess the main problem is the 2nd BCD value is not "right justified" in the word. If it were I would just do the same thing as above. I have thought about bit shifting it 4 bits to the right then just doing that but I'm not sure exactly how to achieve that. Would I just use a timer to give me 4 pulses? is there an easier way to do it?
I am currently doing this by converting the binary number to BCD.
To get the least significant digit I mask to only show the first 4 bits, then just use a lookup table to set the outputs to the correct value.
I am drawing a blank on how to do the most significant digit. I guess the main problem is the 2nd BCD value is not "right justified" in the word. If it were I would just do the same thing as above. I have thought about bit shifting it 4 bits to the right then just doing that but I'm not sure exactly how to achieve that. Would I just use a timer to give me 4 pulses? is there an easier way to do it?