PDA

View Full Version : Working Code for MAX6969



LEDboy
01-28-2010, 12:46 PM
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, [ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN], value
SHIFTOUT DIN, Clk, MSBFIRST, [value\16]
PULSOUT LE, 5
PAUSE 50
IF idx = 6 THEN GOTO Reveres
NEXT

Reveres:
FOR idx = 6 TO 0
LOOKUP idx, [ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN], value
SHIFTOUT DIN, Clk, MSBFIRST, [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

$WMc%
01-29-2010, 11:10 AM
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

Franklin
01-29-2010, 11:58 AM
I don't have time to write code to test but you might try shiftleft and shiftright ( << and >> )

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen