Working Code for MAX6969
LEDboy
Posts: 21
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
' {$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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen