Shop OBEX P1 Docs P2 Docs Learn Events
Seven Segmented display — Parallax Forums

Seven Segmented display

TrezitorulTrezitorul Posts: 68
edited 2008-02-05 11:10 in Propeller 1
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

  • deSilvadeSilva Posts: 2,967
    edited 2007-12-22 18:06
    (a) Congratulations to your Demo Board - the "Porsche" of the Parallax boards! You now have a lot of possibilities at your fingertips.. Do you really want to add a 7-segment display?

    (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
  • TrezitorulTrezitorul Posts: 68
    edited 2007-12-22 18:45
    Thanks deSilva so the anodes are actually a segment of the display and are just turned on and off by separate pins. Also my setup has two common cathode pins do I connect both of them to the vss or vdd. Also my precise setup is1. Anode F 2. Anode G 3. No pin 4.common cathode 5. no pin 6. Anode E 7. Anode D 8. Anode C 9. Anode RHDP(right hand decimal point) 10. no pin 11. no pin 12. common cathode 13. Anode B 14. Anode A.· So each of the Anodes I connect to pins with a 220 Ohm·resistor inbetween. The Common Cathods I connect to Vdd. Right?

    Post Edited (Trezitorul) : 12/22/2007 6:58:52 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-22 18:58
    You should be able to answer that yourself. Why do you think are they called "cathodes"? It's minus, isn't it?

    But why do you have two of them? Is it a twin display?
  • TrezitorulTrezitorul Posts: 68
    edited 2007-12-22 19:28
    No it is a single display but for some reason it has two common cathodes my theory is that there is one for each side of the display. The cathode would connect to the vss. The display is from radio shack with part number 276 - 0075

    Post Edited (Trezitorul) : 12/22/2007 7:34:07 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-22 20:21
    Does it work? You had two hours now to make it... smile.gif
  • TrezitorulTrezitorul Posts: 68
    edited 2007-12-22 22:51
    I have completed it but I need to get some 220 Ohm resistors because right now I am subing a 2200 Ohm resistor in its place but it does work. Now I see how could I have been so blind this is just a bunch of leds and is set up the exact same way. Any way thanks deSilva for all your help
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-22 23:12
    If you are very daring, you can now start the adventure of MULTIPLEXING ...
    Lacking 220 Ohms might reduce YOUR resistance for that as well smile.gif

    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 smile.gif

    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
  • PhilldapillPhilldapill Posts: 1,283
    edited 2007-12-23 18:59
    Just FYI, I have some 7-segments that are 14 pin. They have two common cathodes and I believe a few pins that are NC, so I guess what he's saying is normal.
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-23 20:24
    There is nothing normal with 7-segment displays! A common pinout is 2x4, 2x5, or even 2x7. Sometimes one row misses some pins. NC for one or two is the rule rather than the exception. If there are two common cathodes (or anodes) they can be also connected internally.
    I have a quadruple display here which is SIL with 12 pins in a row...
  • PhilldapillPhilldapill Posts: 1,283
    edited 2007-12-23 22:26
    I have the same quad display. I think it's something like 4 cathodes, 1 for each digit, and eight common anodes, 1 for each segment including the decimal. You're right I guess, no COMMON display - just whatever the 1 in 5000 display models you might have.
  • PengPeng Posts: 2
    edited 2008-02-04 02:21
    deSilva, you mention the interesting program for a multiplex algorithm for seven segments. Is there an example of this in obex or elsewhere? I am wanting to drive 2 pairs of 2 7-segment displays from prop but I don't think I will have enough spare pins.
  • nohabnohab Posts: 96
    edited 2008-02-04 11:40
    How to I calculate appropriate current to LEDs when multiplexing?

    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?
  • tekochiptekochip Posts: 56
    edited 2008-02-04 14:37
    The spec sheet for the LED might have a peak forward current like this one does:

    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 McManisChuck McManis Posts: 65
    edited 2008-02-04 21:54
    I realize this is late, but Parallax used to have an excellent 7 segment display driver "kit" that you could use with your BASIC Stamp. It could drive 8 digits using a display driver chip from MAXIM I think (and it was serial so you only needed 2 pins to drive 8 digits!) If they still sell it that might be worth a look.

    --Chuck
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-05 01:39
    To add:
    (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 smile.gifsmile.gif
    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 smile.gif

    Post Edited (deSilva) : 2/5/2008 2:30:48 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-05 02:01
    To add to deSilva's comments ...

    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.
  • PengPeng Posts: 2
    edited 2008-02-05 03:27
    Thanks all for the feedback. I should be able to sort it out now. smile.gif
  • nohabnohab Posts: 96
    edited 2008-02-05 10:55
    I wood also like to thank for feedback and information!

    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)
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-05 11:10
    Here is part of a data sheet for one of the many common anode displays. The 5 small diagrams show you the relation between the interesting parameters. Note that this display is a little bit unusual, as it has a higher forward voltage... But applying - say - 100 mA for 10% of the time is all right. There are second order effects of course: the aging is faster, and after 3 or 4 years of working they might become dimmer smile.gif
    775 x 670 - 76K
Sign In or Register to comment.