Continue to Site

# Multiple 7 Segment displays

Status
Not open for further replies.

#### erikgunit

##### New Member
Hi all. I am currently looking to drive possibly up to twelve 7 segment displays. At least this was my plan, I am hoping for a push in the right direction from all you know it alls(in a good way). I looked at multiplexing and that is an option, that is if i could multiplex 3 sets of 4 displays. Is there an easier method to displaying caracters using a PIC? Just a little push. Its all i need. Thanks!! -Erik

#### k7elp60

##### Active Member
Multiplexing is the way to go. All the individual segments are tied together and then the digit drive determines which digit is illuminated. For 4 digits it only takes 11 lines of drive.

#### solis365

##### New Member
are you limited by the number of pins?

this may or may not work at all but I had read about using a technique called "charlieplexing" to use fewer pins to drive more multiplexed outputs - it uses the THREE possible states of a uC output pin - hi, low, and input (which is high-impedance), thus giving more flexibility. its more complicated, so if you dont need to do it, dont.

#### Boncuk

##### New Member
Check out the MAX6954.

#### kpatz

##### New Member
Charlieplexing won't work with 7-segment displays. If you use a combination of common-anode and common-cathode displays, you could get twice as many digits under the same number of I/O pins.

#### Mike - K8LH

##### Well-Known Member
Charlieplexing works fine with 7-segment displays but I don't think it would be a good solution for Erik's needs.

Dedicated display driver ICs would reduce I/O pin requirements but can be a bit pricey. Multiplexing is a viable solution. Perhaps a modular design? How about three seperate 4-digit modules running off a 5-pin interface with PWM brightness control? Just connect the 'SER' line on each module to a unique line (RB2, RB3, or RB4) and load the shift registers on the three modules in parallel (a bit banged 3-channel SPI bus of sorts) by retasking the column driver lines for use as 'SER' and 'CLK' lines during a short display blanking interval at the beginning of each column update interrupt cycle.

Anybody want to see software for this design?

Attached untested BoostC demo for 16F88 below. Most of the interrupt driver code just sets up the special 8 byte 'srdata' array which is used for a 3-channel SPI update of the three 74HC595 shift registers in parallel in just 24 instruction cycles at the beginning of the next interrupt.

#### Attachments

• temp.PNG
98.8 KB · Views: 16,455
• Modular BoostC Demo.c
9.9 KB · Views: 774
Last edited:

#### erikgunit

##### New Member
alright i see i have some options out there. As far as pin limitations go, i am still looking around to find the right pic for my needs, so i can get one that is robust enough to handle what i want to throw at it. I like the so called charlie plexing, allows more 7's with less pins but simplicity, meaning using more pins, may be a better way to go. Im sure with some more searching and help form all you guys out there i can find a solution. Thanks

#### kpatz

##### New Member
12 Seven segment displays: you would need 7 pins for the segments (or 8 if you want to use the decimal points), plus 1 pin for each display's common, so that would be 12 + 8 = 20 pins.

There's ways to reduce this. For example, if you use 6 common cathode and 6 common anode displays, you could utilize a simplified charlieplexing scheme to reduce the number of common pins to 6, so total pins needed would be 13-14.

Or, use a 1-of-16 decoder such as a 4514/4515 to drive the 12 commons from 4 I/O pins. If you only need digits (not custom characters) you could use a 4056 to decode 4 pins into the 7-segment display. Combine the two and you can drive 16 digits with 8 I/O pins.

With electronics, there's always 10,000,000 ways to accomplish a task. It's picking the simplest/most efficient/cheapest way that's the challenge.

#### Mike - K8LH

##### Well-Known Member
Charlieplexing won't work with 7-segment displays. ...
kpatz said:
...if you use 6 common cathode and 6 common anode displays, you could utilize a simplified charlieplexing scheme to reduce the number of common pins to 6, so total pins needed would be 13-14.

I don't think you know as much about Charlieplexing as you would like to think. First you say "it won't work" and now you're saying you can make it work by breaking the Charlieplexing signal rules.

May I suggest you do a little more research before offering more faulty advice?

Kind regards, Mike

#### kpatz

##### New Member
I don't think you know as much about Charlieplexing as you would like to think. First you say "it won't work" and now you're saying you can make it work by breaking the Charlieplexing signal rules.

May I suggest you do a little more research before offering more faulty advice?

Kind regards, Mike
Only semi-faulty... you can do inverse parallel charlieplexing with a common anode and common cathode 7-segment display, which will give you 2 displays w/the same number of pins as 1 display w/o charlieplexing, but if you know of a way to do tri-state charlieplexing with 7-segment displays, I'm all ears/eyes (referring to LEDs 5 and 6 in this diagram):

Plus, perhaps I did some research after the 1st post and before the 2nd...

Last edited:

#### Mike - K8LH

##### Well-Known Member
kpatz,

Wiring common cathode and common anode displays back-to-back with one line driving the two 'common' lines is not Charlieplexing.

if you know of a way to do tri-state charlieplexing with 7-segment displays, I'm all ears/eyes
So you're willing to be enlightened if someone brings you the info' but not interested enough to find it yourself? LOL, just kidding...

There are plenty of examples for Charlieplexing 7-segment displays. The basic Charlieplexing signal rules still apply so we use active high NPN column drivers for common anode displays or active low PNP column drivers for common cathode displays. In the case of the common anode 7-segment matrix below, only one pin will ever be driven high to turn on one of the active high column drivers. The other pins are either driven low to sink current and light up associated LEDs in that column or tri-stated (high-z) to leave LEDs turned off.

Charlieplexed matrix wiring is peculiar in that we use a "float" pin to drive LEDs that occupy a position in the matrix where the column and row would use the same pin (illegal col/row combinations RB0/RB0, RB1/RB1, etc.).

The driver for a Charlieplexed 7-segment matrix isn't much more complex then the driver for a traditional multiplexed matrix. We use a ring counter variable (only 1 bit high) as the port output pattern and to detect when we need to set the "float" bit then we turn on or turn off individual outputs by manipulating the TRIS register.

Code:
void interrupt()
{ pir1.TMR2IF = 0;              // clear tmr2 interrupt flag
data = display[column];       // new column segment data
trisb = 0xFF;                 // blank the display
portb = colsel;               // new output pattern (only 1 bit hi)
if(data & colsel)             // if 'float' pin required
data.7 = 1;                 // set the 'float' pin (RB7)
data |= colsel;               // pick up column select bit
trisb = ~data;                // display new column (digit)
if(colsel.7)                  // if last column
{ colnbr = 0;                 // reset column number
colsel = 1;                 // reset column select bit
}
else                          // else
{ colnbr++;                   // increment column number
colsel <<= 1;               // shift column select bit
}
}

#### Attachments

• Charlieplexed 7-segment Displays.PNG
41.9 KB · Views: 7,921
Last edited:

#### Asif5955

##### New Member
Charlieplexing works fine with 7-segment displays but I don't think it would be a good solution for Erik's needs.

Dedicated display driver ICs would reduce I/O pin requirements but can be a bit pricey. Multiplexing is a viable solution. Perhaps a modular design? How about three seperate 4-digit modules running off a 5-pin interface with PWM brightness control? Just connect the 'SER' line on each module to a unique line (RB2, RB3, or RB4) and load the shift registers on the three modules in parallel (a bit banged 3-channel SPI bus of sorts) by retasking the column driver lines for use as 'SER' and 'CLK' lines during a short display blanking interval at the beginning of each column update interrupt cycle.

Anybody want to see software for this design?

Attached untested BoostC demo for 16F88 below. Most of the interrupt driver code just sets up the special 8 byte 'srdata' array which is used for a 3-channel SPI update of the three 74HC595 shift registers in parallel in just 24 instruction cycles at the beginning of the next interrupt.

i want to know the names of "driver transistors" below the seven segments.
i am using pic 16f877a and i am unable to create simple zero to 9 digits with ic 74HC595.
i have checked 74hc595 datasheet but did not know how to create 0 to 9 digit pattern

#### BobW

##### Active Member
Just a word of warning. If you're running any timing critical code on your PIC, then multiplexing can become rather complicated, unless you disable the display output during the critical timing section, and that can cause annoying flicker or worse. For that reason, my own preference is to use a simple serial interface to the display. I typically use a bunch of shift registers such as 74C164 and non multiplexed seven segment displays. An advantage is that it only requires two I/O pins, one for clock and one for data. Of course, the downside is that it requires more hardware. I have also used these 4 digit serial interfaced LED displays:
LITE-ON LTM-8328PKR-04
They're very nice to use, require no extra hardware, and just two I/O pins, but are a bit pricey.

#### KeepItSimpleStupid

##### Well-Known Member
when you do multiplex, remember to de-select the current digit, load the value for the new digit and then select the new digit. This avoids ghosting.

#### Ozman

##### New Member
Hello Mike,
I am a newbie. I am using STK500 with ATmega16A and WinAvr4.18 . I want to implement your ModulalBoostCDemo.C to WinAvr (or GCC). Please help me.

Last edited:

#### Ozman

##### New Member
Anybody want to see software for this design?
Attached untested BoostC demo for 16F88 below. Most of the interrupt driver code just sets up the special 8 byte 'srdata' array which is used for a 3-channel SPI update of the three 74HC595 shift registers in parallel in just 24 instruction cycles at the beginning of the next interrupt.

Hello Mike,
I am a newbie. I am using STK500 with ATmega16A and WinAvr4.18 . I want to implement your ModulalBoostCDemo.C to WinAvr (or GCC). Please help me.

#### Mike - K8LH

##### Well-Known Member
Hello Mike,
I am a newbie. I am using STK500 with ATmega16A and WinAvr4.18 . I want to implement your ModulalBoostCDemo.C to WinAvr (or GCC). Please help me.
Not sure what help I could offer. Sorry!

Status
Not open for further replies.

Replies
9
Views
2K
Replies
23
Views
3K
Replies
25
Views
3K
Replies
7
Views
2K
Replies
7
Views
2K