7 Segment Display - Lettering

MearCat

Member
I've done a good search through for the manuals and the forum archives (I love the new vBulletin format) and found and heap of info on interfacing with 7 segment displays, however this is my dillema :

I have 2 x 7 segment displays and want to display "HI", "LO' or a number on them, but also require 2 pins for an ADC input and LED output. I initially thought of using two 4026 drivers and a PICAXE 08M so that I would only have to use 2 output pins but I can't find any documentation to show that you can display letters using the 4026s.

If I use use 2 x 4511 drivers I need 8 pins for the drivers and then another 2 pins for the ADC & LED. The only PICAXE that has 9 outputs is the 28X1 - complete overkill for this simple application.

Can anyone suggest how I can achieve the above on the segment displays whilst retaining the use of something small like the 08M or 14M?? Multipexing the display with one driver with was mentioned in one thread I read, but no more informationwas provided on that this means / how to implement or whether it's even appropriate for my solution.

-Alan
 

andrew_qld

Senior Member
If you are using an 18x or another Picaxe with i2c or SPI you could use an IO expander like the Microchip MCP23017 or Texas Instruments PCF8575. That would give you 16 IO pins for the price of two. The other advantage for a display is that you don't have to continually "strobe" them, the outputs stay on or off until you write to them again. I have examples and codeHere if you are interested.

Cheers, Andrew
 

Michael 2727

Senior Member
The CD4026 are an 0 to 9 driver only.
You could isolate the DP LEDs and flash them for
the High / Low indication.
If you've run out of pins and can't work out a clever
to juggle their I/O uses you may have to move up
to a 14M.
 

moxhamj

New Member
HC164 needs two pins, but the outputs are not latched so the leds will briefly flash in random ways as the data goes out. HC595s use 3 pins - the extra pin is to latch the data out so it comes out cleanly. You can daisy chain HC595s so two would give 16 outputs which is more than enough for 2 led displays plus the led.

I'm not sure this can be done on an 08M but a 14M should work fine. If you multiplex the leds a 14M plus one HC595 or HC164 will work. And if you are multiplexing then can turn off the common of the displays when send out the data, so a single HC164 would work with no random flashing. So this should be possible with one 14M and one HC164.

Multiplexing simply means you turn on one display then the other in turn, usually as quickly as possible. The outputs of, say, a HC164 go to both displays in parallel. Then you send out one number and make one common low, then another number and make the other common low. Most 7 segment displays have a common that is low, but if the common is high then just reverse the polarity.
 

picaxester

Senior Member
What will the 2 x 7 segment displays be displaying? Will they only be displaying "HI and "LO" or will they be displaying numbers too?
 

MearCat

Member
Thank you Dr_Acula - From the sounds of it a 14M & HC164 with will be the way to go and multiplexing 2 x 7 segment displays (via a couple of transistors I think)

Does anyone have any code on how to actually send the letters and/or numbers to the HC164 driver? I've done a google and can only seem to find PIC based code.
 

hippy

Technical Support
Staff member
And then there's the M5450 ( ? I think that's the right code ), 34-Led driver which is basically a very long shift register, would work with an 08 and need no multiplexing transistors etc.
 

picaxester

Senior Member
This should get you started :)
Code:
eeprom 0, (%11111100)
eeprom 1, (%01100000)
eeprom 2, (%11011010)
eeprom 3, (%11110010)
eeprom 4, (%01100110)
eeprom 5, (%10110110)
eeprom 6, (%10111110)
eeprom 7, (%11100000)
eeprom 8, (%11111110)
eeprom 9, (%11110110)

do
	for b2 = 0 to 9
	read b2, b0
	gosub shftout
        pause 1000
	next b2
loop


shftout:
	for b1 = 0 to 7
		low 0		'SCLK
		low 1		'SDA
		if bit7 = 0 then Skiphigh
		high 1	'SDA
		Skiphigh:
		high 0	'SCLK
		b0 = b0 * 2
	next b1
return



I haven't tested this ;)
 

picaxester

Senior Member
This should display "HI", pause for two seconds then display "LO", pause and repeat.
Code:
eeprom 10, (%01101110)	'H
eeprom 11, (%01100000)	'I
eeprom 12, (%00011100)	'L
eeprom 13, (%11111100)	'O



do
	for b2 = 10 to 12 step 2
	
	read b2, b0
	gosub shftout
	
	b3 = b2 + 1
	
	read b3, b0
	gosub shftout
	
	pause 2000
	next b2
loop


shftout:
	for b1 = 0 to 7
		low 0		'SCLK
		low 1		'SDA
		if bit7 = 0 then Skiphigh
		high 1	'SDA
		Skiphigh:
		high 0	'SCLK
		b0 = b0 * 2
	next b1
return
 

MearCat

Member
Awesome - thanks picaxester. That will help heaps.

I have a one final question - When multiplexing the segment displays, should I be using a transistor to to turn then on/off?
 
Last edited:

MearCat

Member
Multiplexing simply means you turn on one display then the other in turn, usually as quickly as possible. The outputs of, say, a HC164 go to both displays in parallel. Then you send out one number and make one common low, then another number and make the other common low. Most 7 segment displays have a common that is low, but if the common is high then just reverse the polarity.
Do I actually need TWO HC164 drivers for driving the 2 segment displays, not just one (as quoted above)? I'm confused - Dr_Acula has said that only ONE HC164 is required and them picaxester shows a diagram that has TWO HC164 drivers.

FYI - The 7 segment displays I have are common cathode
 

hippy

Technical Support
Staff member
Depends if you want to do multiplexing or 'write and forget'.

If you have one driver and use multiplexing, your PICAXE will spend a lot of time alternating between having to put out the driving signals for one display then the other and will have little time to do whatever else you might want it to. Take too long and the display will become unstable, flicker or be dim etc.

With two drivers you output the display(s) you want then leave them there until you want to change them. The time until then can be used by the PICAXE however you want it to be.

I'd normally recommend two drivers, 'write and forget', but in this application there's not a lot you need to be doing between display updates. The only thing is that you need one or two lines to select which digit is displayed during multiplexing. I don't know how many I/O lines you have free.

Added : Just to confuse things further, if you don't need DP control, you could probably use one of the 74HC164 lines as the select control for one or the other displays. So multiplex with just one driver.
 
Last edited:
Top