A PIC is multiplexing multiple common anode 7-segment displays.

An LED driver is being used so PIC does not have to source/sink a lot of current.

To help with multiplexing, each 7-segment display has a PNP transistor connected to its anode. The PIC can control the 7-segment display brightness by controlling duration for which the PNP is on. So basically with 6 7-segment displays, one of them will be on a time, however, on top of that I want to further implement a mechanism like modulated pulse output to the PNP to control the brightness.

I am sure there are multiple ways to do this. What is the most appropriate way to achieve this?

  • \$\begingroup\$ I've done a 5position 7segment display where only 1 of the positions could be displayed correctly at a time. I had the MCU cycle the display positions at ~60Hz so the transition was not visible and controlled the brightness with the 32kHz PWM duty cycle. I think this is what you are talking about. \$\endgroup\$
    – Tony
    Commented Jan 17, 2017 at 1:41
  • \$\begingroup\$ you mean I should use the PWM internal peripheral? \$\endgroup\$
    – quantum231
    Commented Jan 17, 2017 at 1:48
  • \$\begingroup\$ "An LED driver is being used" - which LED driver? \$\endgroup\$ Commented Jan 17, 2017 at 3:49
  • \$\begingroup\$ The led driver is the sn54ls47 from ti \$\endgroup\$
    – quantum231
    Commented Jan 17, 2017 at 13:02

1 Answer 1


You already have a scheduler that changes your PNP drive (all on separate outputs one assumes), all you need to do is start a Timer that gets triggered each time you change from one digit to the next. The length of the Timer will be from 0 - something just less than your interdigit time.
Your scheduler will output for example a '1' to turn on the PNP digit drive and '0' to turn it off for each of your digits. Your timer value becomes your brightness control and when it times out you set the PNP driver (or all the PNP drivers if that's easier) to off.
The Timer could be either scanned or interrupt driven, your choice.

The waveforms might look like this:

enter image description here

  • \$\begingroup\$ what do you mean by the timer "could be scanned"? \$\endgroup\$
    – quantum231
    Commented Jan 17, 2017 at 22:08
  • \$\begingroup\$ You could set up a brightness timer to either interrupt at the end of it's period (perhaps a comparator interrupt) or you could simply sit in a tight loop waiting for it to reach terminal count. Since visually we (humans) are not very sensitive to brightness changes of only a few percent you don't need high accuracy, and any difference between timer counts for each digit unlikely to impact the solution. \$\endgroup\$ Commented Jan 17, 2017 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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