Shop OBEX P1 Docs P2 Docs Learn Events
MM5450 LED Driver Coding — Parallax Forums

MM5450 LED Driver Coding

JiyatiJiyati Posts: 2
edited 2010-04-30 07:27 in Propeller 1
Hi Josh,

I'm driving 32 LEDs using Jameco's MM5450 chip. Here's the link to that chip's spec sheet.
I want to turn on the LEDs one after the other, serially, completing a loop within a minute. I don't know much about how to code in Spin, but this is what I came up with:
CON

  _clkmode      = xtal1+pll16x
  _xinfreq      = 5_000_000

  clk=1
  data=2
  'will add data neable later
OBJ

VAR


  long LightNum
  
PUB Main

  dira[noparse][[/noparse]clk]:=%10
  LightNum:=TurnLightOn
  waitcnt(clkfreq+cnt)

PUB TurnLightOn
repeat 32
  outa[noparse][[/noparse]clk]~~
  outa[noparse][[/noparse]clk]~
  LightBits:=(LightBits<<1)+ina[noparse][[/noparse]data]




I know I'm supposed to turn on the pins one after the other using outa[noparse][[/noparse]datapin], but I don't know where to do this... or am I already doing that with this code?
What do you think? Will this do the trick?

Comments

  • kwinnkwinn Posts: 8,697
    edited 2010-04-27 02:51
    If you want to turn on one led at a time you need to:

    1 - Make sure the /data enable pin on the 5450 is low (could be tied always low)

    2 - Set the serial data pin high

    3 - Set the clock pin high, then back to low ( this lights led 34/35)

    4 - wait for 1.875 seconds

    5 - Set the serial data pin low

    6 - Set the clock pin high, then back to low
    7 - wait for 1.875 seconds

    8 - Repeat 6 and 7 30 more times
  • JiyatiJiyati Posts: 2
    edited 2010-04-29 21:26
    ok so my new code is:
    CON
      _clkmode      = xtal1+pll16x
      _xinfreq      = 5_000_000
      clk=1
      data=2
      'will add data enable later
    OBJ
    
    VAR
      long LightNum
      
    PUB Main
      dira[noparse][[/noparse]clk]:=%1
      LightNum:=TurnLightOn
      waitcnt(clkfreq+cnt)
    
    PUB TurnLightOn
      outa[noparse][[/noparse]data]~~
      outa[noparse][[/noparse]clk]~~
      outa[noparse][[/noparse]clk]~
      waitcnt(clkfreq*1.875+cnt)
      outa[noparse][[/noparse]data]~
      outa[noparse][[/noparse]clk]~~
    repeat 30
      outa[noparse][[/noparse]clk]~
      waitcnt(clkfreq*1.875+cnt)
      LightBits:=(LightBits<<1)+ina[noparse][[/noparse]data]
    
    



    but i tested this out and still, nothing is working. also i connected the data enable pin to ground and i hooked up the the brightness control pin to the power supply. are there any other corrections i could make?
  • pullmollpullmoll Posts: 817
    edited 2010-04-30 07:27
    Jiyati said...
    ok so my new code is:
    ...
      dira[noparse][[/noparse]clk]:=%1
    ...
    
    



    but i tested this out and still, nothing is working. also i connected the data enable pin to ground and i hooked up the the brightness control pin to the power supply. are there any other corrections i could make?

    I see no dira[noparse][[/noparse]data] := 1 anywhere, so the data pin is input all the time!?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pullmoll's Propeller Projects
Sign In or Register to comment.