Shop OBEX P1 Docs P2 Docs Learn Events
programming LEDs in an XY matrix — Parallax Forums

programming LEDs in an XY matrix

ArchiverArchiver Posts: 46,084
edited 2004-04-05 17:04 in General Discussion
hello everyone,

thanks to your input, i was able get my 49 LEDs working, via a double sided
printed circuit configuring the LEDs in an XY matrix, with the MAX7219 led
driver.

now, i need to know how to program the stamp to control them.

i know theoretically how to do this using the matrix, but don't know the syntax
of the stamp (as this is my very first attempt at programming for it). if anyone

has done anything similar, maybe you can offer some advice/code?

the leds are in a 7x7 square, and i need to be able to make them run a
'psuedo random' on/off shift register pattern (i.e. each LED is either on or
off,
somewhat randomly). the pattern would preferably run from top to bottom- so
one row would be, say, 0110101, and that sequence would move down the
rows until it got to the end, then drop off. each sequence would be
continuously followed by different sequences after it, running down in the
same way.

any tips?

i also need to make all the LEDs glow 'analog' from dim to bright at a
repetitive speed. that would be for a different part of the program, though, so
obviously doesn't need to happen at the same time as the above shift register
sequence.

curse me and my long inquiries... [noparse]:)[/noparse]



heather

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-05 01:18
    Tips? Read the manual! [noparse];)[/noparse] Okay, it's a bit dry, but we have lots of
    free downloads: books from our Educator's series, Nuts & Volts reprints
    ... the training material you need to turn your theory into real work is
    available.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: myamygdala [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JjwwIyP-Kv55Bthv6ilUy5o8he7yQ_Hnz0pwry-GfxJUr7ZeWINZqRwbwtaeG4nh560dys3XjG17DzxD]myamygdala@y...[/url
    Sent: Sunday, April 04, 2004 2:43 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] programming LEDs in an XY matrix


    hello everyone,

    thanks to your input, i was able get my 49 LEDs working, via a double
    sided
    printed circuit configuring the LEDs in an XY matrix, with the MAX7219
    led
    driver.

    now, i need to know how to program the stamp to control them.

    i know theoretically how to do this using the matrix, but don't know the
    syntax
    of the stamp (as this is my very first attempt at programming for it).
    if anyone
    has done anything similar, maybe you can offer some advice/code?

    the leds are in a 7x7 square, and i need to be able to make them run a
    'psuedo random' on/off shift register pattern (i.e. each LED is either
    on or off,
    somewhat randomly). the pattern would preferably run from top to bottom-
    so
    one row would be, say, 0110101, and that sequence would move down the
    rows until it got to the end, then drop off. each sequence would be
    continuously followed by different sequences after it, running down in
    the
    same way.

    any tips?

    i also need to make all the LEDs glow 'analog' from dim to bright at a
    repetitive speed. that would be for a different part of the program,
    though, so
    obviously doesn't need to happen at the same time as the above shift
    register
    sequence.

    curse me and my long inquiries... [noparse]:)[/noparse]



    heather
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-05 05:35
    Hi Heather,

    Start with the Parallax application kit for the max7219

    http://www.parallax.com/dl/docs/prod/appkit/max7298leddisplaydvr.pdf

    Read the documentation about how to set up the hardware and the mode registers.

    On the Stamp, you will become familiar with the SHIFTOUT command. For example,
    SHIFTOUT 0,1,[noparse][[/noparse]$0357\]
    PULSOUT 2,4 ' load it

    would set the pattern in row 3 to $57 = %01011110.

    You can break the data into two separate variables, a line number and
    a pattern.
    DO
    I=5
    RANDOM pattern ' make pattern
    SHIFTOUT 0,1,[noparse][[/noparse]I, pattern]
    PULSOUT 2,4 ' load it
    PAUSE 100
    LOOP

    Also look at array table to hold seven patterns that will shift:

    pattern var byte(7) array of 7 patterns

    DO
    J=J+8//7 ' location pointer
    RANDOM pattern(J) ' new pattern at Jth location
    FOR I=0 TO 6
    SHIFTOUT 0,1,[noparse][[/noparse]I, pattern(J+I//7)] ' start new one at top
    PULSOUT 2,4 ' load it
    NEXT
    PAUSE 100
    LOOP

    The // operator is modular arithmetic on the Stamp, and allows the
    location pointer to move around the circular table modulo 7.

    I hope that helps get you started with the Stamp. (Those are not
    working examples, just snippets!)

    -- Tracy



    >hello everyone,
    >
    >thanks to your input, i was able get my 49 LEDs working, via a double sided
    >printed circuit configuring the LEDs in an XY matrix, with the MAX7219 led
    >driver.
    >
    >now, i need to know how to program the stamp to control them.
    >
    >i know theoretically how to do this using the matrix, but don't know
    >the syntax
    >of the stamp (as this is my very first attempt at programming for
    >it). if anyone
    >has done anything similar, maybe you can offer some advice/code?
    >
    >the leds are in a 7x7 square, and i need to be able to make them run a
    >'psuedo random' on/off shift register pattern (i.e. each LED is
    >either on or off,
    >somewhat randomly). the pattern would preferably run from top to bottom- so
    >one row would be, say, 0110101, and that sequence would move down the
    >rows until it got to the end, then drop off. each sequence would be
    >continuously followed by different sequences after it, running down in the
    >same way.
    >
    >any tips?
    >
    >i also need to make all the LEDs glow 'analog' from dim to bright at a
    >repetitive speed. that would be for a different part of the program,
    >though, so
    >obviously doesn't need to happen at the same time as the above shift register
    >sequence.
    >
    >curse me and my long inquiries... [noparse]:)[/noparse]
    >
    >heather

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-05 17:04
    Thanks Tracy, that application kit is exactly what I need. I didn't even think
    to
    look for something like that.

    And your tips will probably prove helpful when I get through the kit.

    Thanks so much,

    Heather


    --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    > Hi Heather,
    >
    > Start with the Parallax application kit for the max7219
    >
    > http://www.parallax.com/dl/docs/prod/appkit/max7298leddisplaydvr.pdf
    >
    > Read the documentation about how to set up the hardware and the mode
    registers.
    >
    > On the Stamp, you will become familiar with the SHIFTOUT command. For
    example,
    > SHIFTOUT 0,1,[noparse][[/noparse]$0357\]
    > PULSOUT 2,4 ' load it
    >
    > would set the pattern in row 3 to $57 = %01011110.
    >
    > You can break the data into two separate variables, a line number and
    > a pattern.
    > DO
    > I=5
    > RANDOM pattern ' make pattern
    > SHIFTOUT 0,1,[noparse][[/noparse]I, pattern]
    > PULSOUT 2,4 ' load it
    > PAUSE 100
    > LOOP
    >
    > Also look at array table to hold seven patterns that will shift:
    >
    > pattern var byte(7) array of 7 patterns
    >
    > DO
    > J=J+8//7 ' location pointer
    > RANDOM pattern(J) ' new pattern at Jth location
    > FOR I=0 TO 6
    > SHIFTOUT 0,1,[noparse][[/noparse]I, pattern(J+I//7)] ' start new one at top
    > PULSOUT 2,4 ' load it
    > NEXT
    > PAUSE 100
    > LOOP
    >
    > The // operator is modular arithmetic on the Stamp, and allows the
    > location pointer to move around the circular table modulo 7.
    >
    > I hope that helps get you started with the Stamp. (Those are not
    > working examples, just snippets!)
    >
    > -- Tracy
    >
    >
    >
    > >hello everyone,
    > >
    > >thanks to your input, i was able get my 49 LEDs working, via a double
    sided
    > >printed circuit configuring the LEDs in an XY matrix, with the MAX7219 led
    > >driver.
    > >
    > >now, i need to know how to program the stamp to control them.
    > >
    > >i know theoretically how to do this using the matrix, but don't know
    > >the syntax
    > >of the stamp (as this is my very first attempt at programming for
    > >it). if anyone
    > >has done anything similar, maybe you can offer some advice/code?
    > >
    > >the leds are in a 7x7 square, and i need to be able to make them run a
    > >'psuedo random' on/off shift register pattern (i.e. each LED is
    > >either on or off,
    > >somewhat randomly). the pattern would preferably run from top to bottom-
    so
    > >one row would be, say, 0110101, and that sequence would move down
    the
    > >rows until it got to the end, then drop off. each sequence would be
    > >continuously followed by different sequences after it, running down in the
    > >same way.
    > >
    > >any tips?
    > >
    > >i also need to make all the LEDs glow 'analog' from dim to bright at a
    > >repetitive speed. that would be for a different part of the program,
    > >though, so
    > >obviously doesn't need to happen at the same time as the above shift
    register
    > >sequence.
    > >
    > >curse me and my long inquiries... [noparse]:)[/noparse]
    > >
    > >heather
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.