Shop OBEX P1 Docs P2 Docs Learn Events
max 7219 code — Parallax Forums

max 7219 code

ArchiverArchiver Posts: 46,084
edited 2003-12-15 02:29 in General Discussion
Does anyone have any simple working code for a Max7219 with BS2?
Mine doesn't work (it's listed at the bottom of this message). It
just doesn't seem to sync properly.

It acts like their's no common ground connection between the 7219
board and the Stamp board, but there IS a ground wire connecting
them.

******************************************

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

SCK CON 6 'Clock pin
LOAD CON 7 'Load pin
DIN CON 8 'Data pin

x VAR Byte

OUTPUT 6:OUTPUT 7:OUTPUT 8
LOW LOAD:LOW SCK:LOW DIN

PAUSE 100

SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$0a] 'intensity = full
SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$0f]
PULSOUT LOAD,1

SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$0b] 'scan limit 4 digits
SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$03]
PULSOUT LOAD,1

SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$09] 'decode mode for 4 digits
SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$0f]
PULSOUT LOAD,1

SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$0c] 'normal operation
SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$01]
PULSOUT LOAD,1

SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$03]
SHIFTOUT DIN,SCK,MSBFIRST,[noparse][[/noparse]$09]
PULSOUT LOAD,1

END
Sign In or Register to comment.