Saturday, September 15, 2007

Driving a 7-segment display


I found an old keyboard with a 7-segment display. Lots of other interesting things in the device, but sadly most of it was a huge 100-pin surface-mount chip. I did get this 7-segment going though, driven by a 74hc4511 (also from the keyboard) and the Arduino.

The 74hc4511 takes BCD digits and drives the 7-segment. It also handles source current for the LEDs, so I don't have to worry about the ATmega in the Arduino and/or a transistor array. Right now it's only driving a single digit, but with a small modification it can drive all three.

If I wire all the common segments together (all the A segments, B segments, etc) and add a sink transistor controlled by an output pin on the Arduino, all three digits can be driven. If you alternate between the three fast enough, there's no flicker and you can drive all three. Of course that takes a lot of work.

Another way would be to use 3 shift registers. Shift in 3 bytes and just forget about it. They won't do BCD conversion, but that's just a nifty plus anyway. It's easy enough to do in software. You can also drive as many digits as you want that way.

There are two ways of wiring it up. You can either wire the shift out pin of one register to the shift in pin of another register. This will allow you to drive all the digits with just one pin, but means you have to shift out all the digits every time you want to update the display. Or you can wire each shift in pin to an IO pin. This takes more IO pins, but could be handy if there are multiple, unrelated displays.

No comments: