I am working on a project where I have to display different letters (r, g, b, u and n) on a seven segment display using a PIC18F45K20 microcontroller and assembly language. This is as simple as connecting each of the segments to 8 pins of the PIC and then outputting the right logic values on these pins to get the character I want however that is rather costly on the pin count and I'd like to use as little of these pins as possible to drive the common anode seven segment. Any suggestions on how I could reduce the pin count? I'm thinking I should maybe use a bcd to seven segment display driver such as a 74LS47 to do this, that way I could get it down to 4 pins. I'm not quite sure how I would do characters with the driver though?

Are there any other better ways to do this?

  • 1
    \$\begingroup\$ Not necessarily "better", but you could use a shift register. Moves complexity to software, but would only use two or three pins. \$\endgroup\$ – awjlogan Mar 31 '18 at 17:20
  • \$\begingroup\$ I would first make a truth table to see if there are combinations. Also check for inversions: segments which are always opposite, as you can drive two opposite LEDs with one pin. By the way if you omit the dot you need only 7 signals. \$\endgroup\$ – Oldfart Mar 31 '18 at 17:43

One strategy used to reduce pin count uses a 74HC164-type shift register that only requires two pins (data and clock) to shift out at least 8 bits. More chips can be daisy-chained for more output.
The processor would contain table lookup that could emulate a 74LS47. Or you can invent your own segment sequences.
Dout1 and Dout2 are general-purpose GPIO pins, set to be "digital output" pins.
Shifting can be done quite quickly, so that the LED segments are barely lit as the bit sequence is shifted out. However, a ghost image is hard to avoid.


simulate this circuit – Schematic created using CircuitLab


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.