Shop OBEX P1 Docs P2 Docs Learn Events
Working Code for MAX6969 — Parallax Forums

Working Code for MAX6969

LEDboyLEDboy Posts: 21
edited 2010-01-29 03:58 in BASIC Stamp
This code is just an example of how to make a "Knight Rider Light"...All you need to use is the DIN, CLK, and LE pin....tie OE to ground and the DOUT pin unconneted.

' {$STAMP BS2}
' {$PBASIC 2.5}

DIN CON 1
Clk CON 0
LE CON 2

idx·· VAR Nib
value VAR Word

ONE·· CON %0000000000000001
TWO·· CON %0000000000000010
THREE CON %0000000000000100
FOUR· CON %0000000000001000
FIVE· CON %0000000000010000
SIX·· CON %0000000000100000
SEVEN CON %0000000001000000

LOW LE

Main:
FOR idx = 0 TO 6
LOOKUP idx, [noparse][[/noparse]ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN], value
SHIFTOUT DIN, Clk, MSBFIRST, [noparse][[/noparse]value\16]
PULSOUT LE, 5
PAUSE 50
IF idx = 6 THEN GOTO Reveres
NEXT

Reveres:
FOR idx = 6 TO 0
LOOKUP idx, [noparse][[/noparse]ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN], value
SHIFTOUT DIN, Clk, MSBFIRST, [noparse][[/noparse]value\16]
PULSOUT LE, 5
PAUSE 50
IF idx = 0 THEN GOTO Main
NEXT

Post Edited (LEDboy) : 1/28/2010 4:52:33 AM GMT

Comments

  • $WMc%$WMc% Posts: 1,884
    edited 2010-01-29 03:10
    LEDboy

    Now do this with a output shift register like the 74HC595 to save I/O pins on the Stamp

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
  • FranklinFranklin Posts: 4,747
    edited 2010-01-29 03:58
    I don't have time to write code to test but you might try shiftleft and shiftright ( << and >> )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.