Shop OBEX P1 Docs P2 Docs Learn Events
displaying variables on a led screen — Parallax Forums

displaying variables on a led screen

P!-RoP!-Ro Posts: 1,189
edited 2008-09-01 11:30 in Propeller 1
Is there an easy way to display large variables on an led screen? I know when you use a display such as lcd screen you can just serially send variables to display, but I want it to be done on a led screen instead run entirely by the propeller.·I want to be able to just take variables I get,·such as that of a small thermometer or photoresistor, and display it on the screen easily. I was thinking of breaking each variables into parts, such as the·ones, tens, hundreds, and thousands, but I don't know how to do that and·I'm not going to make a pub for each number I want displayed up into the thousands.·Any·ideas?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Pi Guy

Comments

  • AleAle Posts: 2,363
    edited 2008-08-23 09:43
    Di you mean by "screen" a number of LED 7 segment digits ?... well some people had success with external LED controllers from maxim (that do all the multiplex and current control).
    If you want to do that yourself you need one output transistor per digit (for the common anode or kathode), and some output buffer (recommended in the case of many digits and safety) and some small resistors. for the no common ends of the leds. The rest is software multpilexing. It is totally possible and also already done.

    Edit: I mean MAX7221 and friends
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-23 17:43
    It's just a regular led display I took out of an old game that can display the two digits on each side with a colon in the center incase you want to use it for clock perposes. I realize displaying variables on it has already been done, but I need the code to do it or the concept of how to easily do it so I can make the code myself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • SawmillerSawmiller Posts: 276
    edited 2008-08-24 19:53
    bean, of hitt consulting sells a 4 led display(surplus), he wrote some code for it to have it display varibles, and count... it's up here some place, and would probally give you the idea for the type of code you want.
    he wrote it for the stamp,sx, and prop.

    i got several of those displays off him, and have used them well
    dan
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-24 22:46
    Great! I'll have to ask him for his code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • DroneDrone Posts: 433
    edited 2008-08-25 01:22
    If you can access each of the LED's display segments (plus the common anode or cathode) then you should be able to use the seven segment LED driver in the Object Exchange:

    obex.parallax.com/objects/142/

    Pay attention to whether your LED's have common anode or cathode and tweak the LED object accordingly. If you find the 7 segment LED driver problematic at-first, then just try accessing each LED segment as you would with any other LED. Use a lookup table to map between the number you wish to display and the set of LEDs that must be turned on to show the number.

    Good Luck,

    David
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-25 01:32
    This is for the "HC4LED" units that sawmiller noted, by tpw_man
    http://forums.parallax.com/showthread.php?p=745452

    Post Edit -- Here's where you get the goods:
    http://www.hittconsulting.com/miscforsale.html

    Post Edited (PJ Allen) : 8/25/2008 1:40:41 AM GMT
  • SawmillerSawmiller Posts: 276
    edited 2008-08-25 02:10
    heres the one i was talking about, jon did it.
    shows how to break numbers down, hope its what ya need
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-25 04:03
    I tried using the object drone supplied, but I can't get it to work. I think I know the reason why, but I'm not sure. In the programming, I had to get rid of _xinfreq = 5_000_000 and _clkmode = xtal1 + pll16x because lately I've not had the programs work with it in them (I think I burned out the cristal by having the pins bend and touch the metal outside) so I had to get rid of it. Does it really matter much if it is in there? Or is my problem in the programming somewhere? I know it can't (or shouldn't) be my connections because it will work if I apply power to the pins.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • AleAle Posts: 2,363
    edited 2008-08-25 10:24
    You can test if the crystal output pin of the propeller is working, use a crystal without pll and set a pin to output a square wave with known periods... and measure them. The frequency will not make much difference unless you want to use a serial port or something like that. Download of programs to RAM or EEPROM is done using the internal fast oscillator (around 12 MHz).
  • DroneDrone Posts: 433
    edited 2008-08-25 15:46
    I LIKE PI,

    Hi this is David [noparse][[/noparse]@Drone]. I didn't write the 7-segment object on the Object Exchange (ObEx). But the referenced object did help me at-first with basic hard-wired LED displays on the Propeller. I think we need to know more about what you're schematic looks like. Are you in-fact using the HC4LED module mentioned by others in this thread? If so the 7-segment object I referenced won't help you. The HC4LED module uses a serial (SPI) interface. Upload a schematic or block diagram as a .jpg or .gif for-example.

    I agree with Ale, if you suspect the crystal, test it first.

    Rgds, DR
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-08-25 18:38
    I just have four 68ohm resistors connected to in on pins 1-4, a connection to it on pins 6 and 7 for the two center dots, and 8-15 are connected to it for the regular numbers.

    @ale: I only have one crystal so I don't know if I'll be able to measure it like you said, but I do know that before I made the pins touch on it, a program I had to run servos before suddenly wouldn't work anymore unless I god rid of that first part, and even then it didn't seem to work like it used to.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • DroneDrone Posts: 433
    edited 2008-08-26 02:22
    Hello Pi Guy,

    * The LED Display [noparse][[/noparse]Refer to the Attached Drawing]:

    It seems from your description your LEDs are standard parallel-driven 7-segment with common anode or cathode. There are lots of ways to drive 7-segment displays, two of the most common are shown in the attached drawing. We show common cathode displays in this drawing just because that's what I had on-hand.

    Circuit type-A requires a few more resistors. However, if you multiplex the digits only, the software is significantly less complex. When connected directly to the propeller, the circuit shown in type-A is completely safe provided you select resistors so that the 40mA maximum allowable current per pin is not exceeded with all segments on.

    Lets say there is one LED per segment (large digit displays may have more than one LED per segment), the I/O output high is 3.3V, a single LED forward drop is 2.2V (yours may be different), the maximum number of segments on at any one time is seven, and the maximum allowable current per pin is 40mA. The maximum current per segment is 40/7=5.7mA. Therefore a single current limit resistor calculates to be (3.3-2.2)/0.0057)=192 Ohms. It's safer to use a 200 or 220 Ohm resistor.

    However the 5.7mA current per segment in this example is pretty low. You typically want at least 10mA or 20mA per LED, especially if you want to view the display in bright ambient light. Therefore, you would use a transistor to buffer the input pin. An example of this is shown on the right-most digit of the type-A circuit diagram. Remember when using a NPN transistor buffer as shown, you need to invert the logic of the input pin in your software. So with the transistor and 10mA per segment; seven segments on at the same time is 70mA and a single current limit resistor is approximately (3.3-2.2)/0.01=110 Ohms. The maximum the display will draw at any given time is 70mA even though you have four digits, this is because you are multiplexing the digits.

    Circuit type-B requires that you multiplex both the digits and the segments, plus with directly connected input pins, there is the possibility that errors in your programming may turn on too many segments and/or digits at any given time thereby exceeding the 40mA maximum allowable current for a single I/O pin. Like with circuit type-A, use a transistors to buffer the pin current.

    From your description, it seems you are using the circuit shown as type-B, perhaps it would be better to start with circuit type-A. Once your circuit is working, manually select the series resistor for the separator colon so the brightness of the colon matches the digit brightness. I show the colon LEDs connected to an I/O pin, that's because I would typically blink the colon on and off to indicate the seconds in a four-digit clock display. If you're using a lot of current per segment and/or lots of digits, keep in mind the total package dissipation for the propeller is 300mA, I'm not sure if there is a maximum allowable current for groups of I/O pins as well.

    * Your Crystal Problem:

    I don't understand what you mean about a bad crystal, the propeller must be working if you can load a program from the propeller tool. Anyway, before you start trying to drive the LED display module, perhaps you should sort-out your crystal issue first with a simple blinking LED.

    Try removing the crystal and running the Propeller on the internal RC clock. See Exercise-9, "Clock Settings" in the Propeller manual. Once you're running on the internal clock, simply blink an LED. Look in the Propeller manual for "Exercise 1: Output.spin – Our First Object" on how to toggle an I/O pin. Once you're blinking, put the crystal back in (don't forget to change back to the crystal clock settings in your spin program) and see if the blinking LED still works. If not, then either your crystal or something associated with the propeller clock pins is not working. Time your LED blinks and compare to what you expect from your program's blink delay statement.
    800 x 574 - 89K
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-09-01 05:20

    Sorry about the late response Drone. Schools kept me busy.

    You said I should try testing it with the external crystal and the internal. I haven’t had time to check chapter 9, but I do know the code I have for blinking an led used to work just fine. Suddenly, when the pins on the crystal touched, it stopped working. When I delete that part asking to use the external crystal, it works.

    I looked at the pic you have for me, and I don't think it is the same thing. My led display has four pins that need to be negative with the first for the first number, second for the second number, and so on to the fourth. It has two extra pins, both between the pins for digits 1 & 2, and 3 & 4. When digit 3 is connected to ground and one of the two extra pins are connected, one colon lights up. When pin 4 is connected to ground and the second pin is connected, the other colon lights up. The other 7 pins are used for lighting up the digits for the numbers.

    Sorry if this is confusing for you. I’ve got some pics to hopefully help a little.

    P.S., please ignore the numbers for pins I put in the drawing, they are backwards from what I stated above, which refers to what propeller pin it is attached to.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • DroneDrone Posts: 433
    edited 2008-09-01 11:30
    OK Pi Guy,

    * Propeller Crystal:

    It sounds like the pins that drive the external crystal where fried when you shorted them together. I've never shorted the crystal pins, so can't say what the effect would be - and I don't want to try. Maybe someone here more familiar with the hardware can comment. Sounds like it is working with the internal RC timing though.

    If nobody comments back in this thread about shorting the crystal pins. Just make a new post and ask the question, "What happens if you short the crystal pins together when operating on external crystal?"

    * LED Display

    I think the pictures I provided are very close to what you have. The only difference is that the common pin for digit 3 is connected to the cathode of one colon LED, and the common pin for digit 4 is connected to the cathode of the other colon LED. So your colon LEDs will multiplex with the third and fourth digits. Just connect the two colon pins to the positive supply through two current limit resistors, no need to connect the colon LEDs to propeller I/O pins. The colon LEDs will get turned on automatically any time you display digits 3 & 4 by pulling their respective common cathode pins to ground.

    The rest of the display seems to be just like my drawing, common cathode with four digit select pins and seven segment select pins which are wired in parallel across the digits. You should have no problem driving this display. Use the circuit Type-A drawing for the reasons explained in my previous post. Use a lookup table in the DAT section to map between the numbers 0-9 and the respective segments on your display. Then multiplex through the four digits in a loop looking up and sending the proper segments to each digit in turn. Remember the segment-to-pin assignments for the segments on your display may be different from the assignments shown on my drawing. You can easily determine your assignments with an ohm-meter or by manually lighting the segments one at a time.

    You are lucky your display is so simple to access. Many if not most four digit clock displays are wired in very strange ways to accommodate multiplexing schemes employed by proprietary ASIC clock chips. You usually find these weird displays in cheap desktop alarm clocks. They are a real hassle to reverse-engineer and code for.

    Hope this helps... Best Regards, David
Sign In or Register to comment.