Seven Segmented display
Trezitorul
Posts: 68
I am fairly new to the world of electronics and I would like to know how do you setup a seven segmented display on the demo board(rev c) a schematic would very helpfull Thanks
Comments
(b) So you will... First get the pinout from the datasheet. You have 7 segments A, B, ..G sometimes also a "dot". The other side of these LEDs are connectd to an eigth (nineth) pin. This pin is either the cathode or the anode. Find out!
(c) All segments of the display need around 10 mA, so you best connect them through 220 Ohms resistors to 7 of the propeller pins you find appropriate.
(d) The eigth (nineth) pin must be connected to Vdd or Vss depending on whether it's the anode or the cathode.
(e) Generate the patterns you want to display; there is also an object for this in the OBEX as far as I can remember.
(f) The advanced version uses multiplexing the segments with a 1/7 duty cycle current pulses - you omit the resistors in this mode.
Have Fun!
Post Edited (deSilva) : 12/22/2007 6:14:19 PM GMT
Post Edited (Trezitorul) : 12/22/2007 6:58:52 PM GMT
But why do you have two of them? Is it a twin display?
Post Edited (Trezitorul) : 12/22/2007 7:34:07 PM GMT
Lacking 220 Ohms might reduce YOUR resistance for that as well
The idea behind this is to not light all segments at the same time, but check one after another (of the seven) whether it will be his turn for this pattern.
If it is, then turn it on for - lets say - 3 ms; otherwise just wait for 3 ms.
So you will cycle through all segments each 21 ms. The eye will not notice theses breaks... It will be 1/7 dimmer as usual, but....
.... but you can use much more power (=current) during these 3 ms. An LED can be supplied with 50 to 100 mA for this short time, when you give it some time to cool down afterwards.
And the Propeller is pefectly suited to provide that current, so you will need no resistors at all.
But be careful! Your program should be error free before you remove the resistor
Note that with this technique, at most one segment is on, so you can shift the current limiting resistor to the cathode side. Which means you need only ONE rather than 7 - and none at all when you are finished...
The interesting thing of course is the program for this algorithm.
Have fun!
Post Edited (deSilva) : 12/23/2007 12:48:20 AM GMT
I have a quadruple display here which is SIL with 12 pins in a row...
Let's say I have LEDs with 20mA maximum (quite common I think), then I normally give them 10-15mA which seems to be on the safe side.
With multiplexing, is it so easy that 1/2 dutycycle gives 40mA max, 1/4 dutycycle gives 80mA on so on? Or how to know the limits?
Regarding the output of the Propeller, the datasheet says 40mA per pin. Are the pins current limited to this or can I destroy not only the LEDs but also the Propeller?
Another figure I couldn't find: Can all pins supply 40mA simultaneously or what is the max total current?
http://www.lumex.com/pdf/LDQ-M284RI.pdf
Of course it also states that the pulse should be less than 10uS.· Yes, you can average the current to the LED when you multiplex, provided that you don't violate the maximum current.· However, if the display ever goes static (stops multiplexing) you run the risk of damaging the display.· The display can go static if the propeller resets and starts going through its boot sequence, so you probably won't want to push the segments beyond the steady current specification without some kind of watchdog circuit to cut power to the display in the event of a crash.
The propeller does have a maximum limit of 300mA through Vss or Vdd, so you could use the port pins unbuffered to drive the anodes, but you will need a transistor or an array like a ULN2803 to drive the cathodes.·
Here are some character definitions you can use, change the bit positions to match the pins that you have the segments wired to.· To light the anodes you OR or MUX Char0..Char9 onto the port pins
CON 'Segment definitions
· posa = 5····· 'Bit positions of segments
· posb = 4
· posc = 2
· posd = 1
· pose = 0
· posf = 6
· posg = 7
· posh = 3
·
· sega=1<<posa 'Bits of segments
· segb=1<<posb
· segc=1<<posc
· segd=1<<posd
· sege=1<<pose
· segf=1<<posf
· segg=1<<posg
· segh=1<<posh
DAT 'Variables
'Constants
Char0···· long sega|segb|segc|segd|sege|segf
Char1···· long segb|segc
Char2···· long sega|segb|segd|sege|segg
Char3···· long sega|segb|segc|segd|segg
Char4···· long segb|segc|segf|segg
Char5···· long sega|segc|segd|segf|segg
Char6···· long sega|segc|segd|sege|segf|segg
Char7···· long sega|segb|segc
Char8···· long sega|segb|segc|segd|sege|segf|segg
Char9···· long sega|segb|segc|segd|segf|segg
·
--Chuck
(A) The code for multiplexing common anode (or cathode) displays is extraordinary simple. There is a 7-segment example in the OBEX, but I never looked into it. Note that you have THREE possibilities to multiplex:
1. To cycle over the digits (lets say: 4 of them) and set the segments.
2. To cycle through all 7 segments and set the digit
3. To cycle through all - say - 28 elements and set one at a time; this is rarely used as a duty cycle of 1/28 (or 1/14 average) is hardly acceptable... But it allows to work with 5 encoded pins only (2 for the digits, 3 for the segments...)
Generally method 1. is prefered, as the coding tables are simpler, the duty cycle is more acceptable, and the number of digit lines does not desparately call for encoding... So when you have 7+4 lines to spare this is the - simple - methode of choice.
(B) Cautious as you should be, there have been very little accidents with hung-up processors and burned-out displays caused by omitted resistors.
(C) Pulsing with very high current is an accepted way of working whith LEDs, all good data sheets contain related diagrams, which are btw VERY conservative... So multiplexing with - say - some 100 Hz through 4 digits will easily allow 40 or 50 mA...
(D) Though the 7 segment-driving pins will allow this, all the current has to flow into the digit sinking pin rather than to ground. This is the limitation, and it will dim your display considerably when activating all 7 segments. Note that the max current can become 50mA only as ONLY one digit is active at a time!
(E) This of course changes when using digit boosters as recommended..... However note that the ULN drivers are Darlinglingtons, wasting 1.2V for themselves. As you cannot expect the Propeller pins sourcing more that 2.5 Volts @ 40mA - if ever - you stay with 1.3 Volts for the LEDs which is marginal. A well known effect is, that such displays become DIMMER when digit boosters only are used
Work around is to simply use segment boosters as well.
(F) Now we are not far away from using professional LED drivers in the first place
Post Edited (deSilva) : 2/5/2008 2:30:48 AM GMT
The Propeller is quite forgiving of abuse of the output transistors. They seem to survive short circuiting to ground and +3.3V, so would be quite comfortable with LEDs without current limiting resistors or with very low values for multiplexing ... not that one would do this deliberately, but accidents will happen and it's nice to know that the Propeller will survive this sort of accident.
In my case the dutycycle will be about 1/6 so I need all current I can get, so it's good to know that it wood be safe without resistors, as long as I keep the frequency at 1kHz or so (and the processor not hang-up)