Saturday, 24 January 2015

7segmentdisplay - How to display a double digit decimal value on a seven segment display?


I recently finished a 4 bit adder project and I wanted to "extend" it.Right now,the output is represented by 4 led's(1 for each bit).I want to display the answer as a decimal in a seven segment display.The biggest value that the adder can output is 15(since it is a 4 bit adder).I have two single digit seven segment displays.I was thinking of using the 74ls47 chip to do the binary to seven seg conversion.Here is the datasheet for BCD TO 7-SEGMENT CODER/DRIVER


How do I check to see if the addition output is a double digit number?Using this information, how do I "tell" the binary to seven seg converter, that it is double digit?Do I need two of these chips?My final question is:the biggest decimal a single digit seven segment display can represent is 9. When the 74ls47 gets an input greater than this it starts display jibberish:( I got that information from Using the 74xx47 BCD to Seven-segment display.


How would I prevent the jibberish from getting displayed(basically I need a way to check if the output of the addition is 10 or greater.)


Sorry about all the questions this is the first digital logic circuit that I have made.



Answer



What you need to do is convert the binary into something called BCD - Binary Coded Decimal.


Basically BCD is binary, but only takes the values 0-9 for each digit.



If you can still get hold of them (no idea if you can), there was a 7400 series IC that does the conversion. As I recall it was 74185.


Alternatively, if they are not available, you could use a parallel EEPROM IC or something like that. If you store the BCD equivalent values in addresses 0-15 of the EEPROM, then the lower 4 address bits become your 4bit binary input, then 5 of the bits of the data outputs can be your BCD value (the 5th bit being carry - i.e. 10).




Thinking about it, you could even use an 8-bit EEPROM to do the whole thing (including 7-segment). If you use the lower 7 bits for the first 7-segment, and the other data bit can go to segments B&C on the second 7-segment display. Again by storing the equivalent values in addresses 0-15 you can make a lookup table to generate the mapping.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...