I have a 7 segment display that has 4 digits. What will I need to make use of this? Can a single microcontroller handle the operation? I mean PIC16F690...I saw also a MAXIM chip that drives these kind of displays...is it absolutely required?

Here is a picture from the datasheet, I don't know why there are 2 pin diagrams? enter image description here enter image description here

Here is a link to the datasheet


1 Answer 1


The two schematics are two versions of the display, common cathode at the top, common anode at the bottom. I'll assume you have the common cathode version.

You connect the segments A..G, DP via 8 series resistors to 8 I/O pins of the microcontroller. Driving a pin high will light that LED on the selected digit. To select any of the 4 digits you make the corresponding common cathode low via an NPN transistor, which you again drive from an I/O pin via a resistor.

enter image description here

If your supply voltage is 5 V and you're using red LEDs then you can use 150 Ω resistors instead of 330. Also decrease the transistor's base resistor values to 2.2 kΩ, and use for instance BC337s for the transistors.

To drive the full display you first make pin 12 low by driving its transistor with a high level, and set the I/Os for the segments of that digit. Some time later you switch pin 12 and the segments off, and switch 9 on, and again the segments for the second digit. And so on. If you go from 1 digit to another in less than 2.5 ms, then the whole display cycles at 10 ms, or 100 Hz, which is enough to avoid noticeable flicker.

You can use the Maxim driver, like the MAX7219, but it's Damn Expensive™: 12.80 dollar in 1s at Digikey. The good thing about it is that it takes care of the multiplexing for you, so you just have to load it with the segment data for the 4 digits. It also has software brightness control.

I checked the PIC16F690 datasheet, and unlike other microcontrollers its I/Os don't seem to be able to source 20 mA (which is disappointing). So you'll need transistors on port 2 as well:

enter image description here

R1 was one of the resistors on port 2. So you insert Q1 and R2 between them, and repeat that for each of the 8 segments. Attention, Q2 is a PNP! Any general purpose PNP transistor will do.

  • \$\begingroup\$ Just one thing, do you recommend using a relay driver like UNL2803 instead of transistors? \$\endgroup\$
    – Sean87
    Jun 30, 2012 at 19:15
  • \$\begingroup\$ It's more or less the same. The 2803 has clamping diodes, but that's only an advantage for switching relays or motors. If you buy 100 BC337s (they're always useful) 4 of them are cheaper than the 2803. Unfortunately there's no PNP equivalent of the 2803, so you'll have to use transistors there anyway. BTW, is your display the common cathode like in my answer, or the common anode. If it's the latter you would need 8 NPNs for the segments, and then the 2803 may be a better option. \$\endgroup\$
    – stevenvh
    Jul 1, 2012 at 5:27
  • \$\begingroup\$ Got the idea, luckly it is common anode, I have some 2803 chips laying around I will use them then. Thanks again. \$\endgroup\$
    – Sean87
    Jul 1, 2012 at 10:07
  • \$\begingroup\$ IC (MCU included) usually are able to sink more current than source it. Thererfore, if you take a common anode version, you can modify your schematics to sink current in PORT2, and use PNP for PORT1. Note that the logic is then reversed, as it is active when low. \$\endgroup\$ Jun 23 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.