+ Reply to Thread
Results 1 to 13 of 13

Thread: Led matrix I/O pin setup ?

  1. #1

    Default Led matrix I/O pin setup ?

    и
    Ok, I’m a newbe at this and I don’t want to blow up allot of
    Led’s so I need some help.
    и
    I’ve made a led matrix of 10 rows and 10 cols or so of иleds
    и
    There are 10 rows that all the anodes on that row are connected to, and there are 10 columns that all the cathodes on that column are connected to.
    и
    Now, if I apply current to a row and then ground a single column pin I can turn ONE(1)
    Led on, however if I ground all the cathodes the whole row will come on.
    и
    QUESTION:
    и
    How to I wire the leds for the propeller so I can toggle a I/O pin and only have 1 led on a row come on based on the column (how do I set up the column pin to ground)? Do I need to use two pins in order to turn one led on ? How do I ?
    и
    QUESTION #2
    и
    Do I still need to use a resistor, I know this is common knowledge, but I’ve not worked with the propeller in a while.
    и
    Please help,
    Thanks,
    -Areal
    и
    и

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I have a tree growing out of my head, but

    what do you expect ? I'm a programmer.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  2. #2

    Default

    Have a look at the recent thread about "Charlyplexing" you will learn a lot, following the links given there.

    WRT the propeller, the pins are assumed to be current limited @ 40 mA, but this is much to much for most LEDs. However a good technique is using PW-modulation with a duty cycle so that the mean current comes arount the LEDs capacity.

    This is risky however, for the smallest progarmming error will most likely burn your LEDs so take resistors .

    Post Edited (deSilva) : 8/17/2007 7:04:15 PM GMT
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  3. #3

    Default

    I must be confused about how to toggle a single led in a row
    where the all the leds anodes are on the same i/o pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I have a tree growing out of my head, but

    what do you expect ? I'm a programmer.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  4. #4

    Default

    Simply connect the 10 row wires each through a 39 ohm resistor to 10 Propeller I/O pins and the 10 column wires each through a 39 ohm resistor to another 10 Propeller I/O pins. That will limit the LED current to about 20ma and protect the Propeller I/O pins from destruction from the impossible programming error.

    To light up an LED, set DIRA for the row and column pins you want to use to output (1). Set the OUTA for the row to high (1) and for the column to low (0). This will light one LED.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  5. #5

    Default

    Thanks Mike ! Your my hero !

    Is 410ohm resistor ok ?

    I could not be successful without everyone’s help, I really am new to electronics.
    Actually this is my first electronics project ever !

    I’m thinking about making a utube video in a day or so, I’m almost finished with this
    project. I’ll post the link asap.

    I had to build a DIY CNC machine to mill the PCB and also drill the black acrylic panel
    for the cover.

    And it's actualy a 15x9 RGB Led Matrix Panel 19mm dot pitch

    Thanks,
    -Areal

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I have a tree growing out of my head, but

    what do you expect ? I'm a programmer.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  6. #6

    Default

    You have to figure out your own resistors ...

    I'm assuming these are red LEDs with a Vf (forward voltage) of 1.7V. Other colors will have different forward voltages.

    The Propeller pins go from about 0.3V to about 3.0V, so you have to drop about 3.0V - 0.3V - 1.7V using the resistor = 1.0V.

    Ohm's Law is: E = I R or I = E / R or R = E / I. In this case: R = 1.0V / 0.02A = 50 ohms. Using 1/2 in the anode circuit and 1/2 in the cathode circuit give you about 25 ohms. The nearest standard value is 27 ohms.

    If you use a 410 ohm resistor, you'll get: I = E / R = 1.0V / (2 * 410 ohms) = 1.0V / 820 ohms = 1.2ma.
    That will give enough light to notice in a dim room, but not much more. You need a minimum of 5-10ma for decent light.

    Go with the 27 ohm resistors. That will give you the maximum constant current for most LEDs and will let you
    experiment with dimming using PWM and scanning the matrix.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  7. #7

    Default

    Ok, is this correct, I can't get to work



    -Areal

    ----------------

    CON
    'Set clock speed to 80 MHz
    и _clkmode = xtal1 + pll16xиииииии 'Sets the clock speed to 80 MHz using a times 16 multiplier
    и _xinfreq = 5_000_000ииииииииииии 'Crystal speed: 5 MHz
    '
    и High = 1ииииииииииииииииииииииии 'A CONstant used to set an output port to about 3 volts
    и Lowи = 0ииииииииииииииииииииииии 'A CONstant used to set an output port to about 0 volts
    и Out = %1ииииииииииииииииииииииии 'A CONstant used to set a port's direction to Out
    '
    VAR
    и Byte Rowииииииииииииииииииииииии 'Declares Pin to be a global VARiable of a type Byte
    и Byte Colииииииииииииииииииииииии 'Declares Pin to be a global VARiable of a type Byte
    '
    PUB Startиииииииииииииииииииииииии 'A PUBlick procedure named Startииииииииииииииииииииииииииииииииииииииииииииииииии ииииииииии
    и FlashLEDSииииииииииииииииииии
    'ииииииииииииииииииииииииииииииииииииииииииииииииии ииииииииииииииииииииииииииииииииииииииииииииииииии ииииииииииииииииииииииииии
    PRI FlashLEDSииииииииииииииииииии
    и Row := 17иииииииииииииииииииииии 'Assigns 17 to the variable Pin
    и Col := 16иииииииииииииииииииииии 'Assigns 16 to the variable Pin
    ииииииииииииииииииииииииииииииииииии
    и DirA[Row] := Outииииииииииииииии 'Makes port A16 an output port
    и DirA[Col] := Outииииииииииииииии 'Makes port A17 an output port
    и OutA[Row] := Highиииииииииииииииииииииииииииииииииииииииииии
    и OutA[Col] := Lowииииииии
    и


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I have a tree growing out of my head, but

    what do you expect ? I'm a programmer.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  8. #8

    Default

    Your program will light the LED for about 20 microseconds, then turn it off.

    The problem is that the start routine calls FlashLEDS, then exits which resets the cog it's running on.
    That makes all the I/O pins inputs. At least put a "WAITCNT(CLKFREQ + CNT)" after the call to
    FlashLEDS. That will pause the cog for a second after turning the LEDs on.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  9. #9

    Default

    Ok, Thanks Mike, I got it !

    -Areal

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I have a tree growing out of my head, but

    what do you expect ? I'm a programmer.
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  10. #10

    Default

    Just some remarks, when you will have time for it...
    Many persons prefer a SPIN operation, written ~ and ~~
    This - used in a postfix position - will clear or set the bits of a variable or I/O pin or pins independent of their length.

    Example:
    OUTA[ 3 ]~ is OUTA[ 3 ] := 0
    DIRA[ 3 ]~~ is DIRA[ 3 ] := 1
    DIRA[ 0..3 ]~~ is DIRA[ 0..3 ] := %1111 (or DIRA | $F)

    ROW ~~ is ROW := $FF

    Nb. It is not my intention to recommend this; I think the "old fashioned" way is much clearer. But I have the impression you will have A LOT to set and clear....

    Memory hook: ~~ is "more" than ~ as 1 is "more" than 0
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  11. #11

    Default

    Regarding an earlier message about the use of = vs :=

    In the CON section, only an equal sign is used. The single equal sign is used to imply "is defined as" while the colon-equals is used to indicate the assignment operation.и The single equal sign functions as a compile-time operation while the colon-equals works only at run-time.и I know some languages don't make the distinction, but in Spin (and in Pascal for instance) this convention is used.

    Post Edited (Mike Green) : 8/18/2007 12:13:06 AM GMT
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  12. #12

    Default

    @Mike, Huh... I will learn. Killing message to clean up thread.

    (mutter, mutter. Another Hairshirt to wear. mutter, mutter)
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

  13. #13

    Default

    Mike Green said...
    Regarding an earlier message about the use of = vs :=
    This is OT:
    I think this is one of the 10 or 12 wrong decisions taken during the design of SPIN. There is no need for it, as constant expressions are constrained to the CON section and there can never be any doubt. The reasons ALGOL-like languages used this notation have long been forgotten by the global use of "=" as assigment operation.

    But there is one merrit (And I thinkl this could have been one of the reasons for Parallax's decision): There can be no undetected "=" within a condition expression. (Which contributes about 10% of all bugs in C programs )
    Last edited by ForumTools; 09-30-2010 at 05:18 AM. Reason: Forum Migration

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts