8 Digits with Maxim 7219 and Basic Stamp
Okay. So I've searched the forums, google, etc for the past 2 hours I'd say and can't find really anything about this. Everything I've found has been for 4 digits or lower and everything that talks about an 8 digit was never solved or is to complex for me to read it and understand it.
I've been using the AppKit for the Maxim 7219 and BS2 and got 4 digits working just fine, but when I tried to add in the next 4 digits it stopped working. Here's the code I've been using.
Instead of using a counter like it is in the AppKit, I just set the variable myself. When I set dispVal to something more than 1234 (like 12345678) I get an error message saying "Constant exceeds 16 bits." After doing some research I found out that 12345678 is actually 24 bits. How do I send something like this to the 7219?
I've been using the AppKit for the Maxim 7219 and BS2 and got 4 digits working just fine, but when I tried to add in the next 4 digits it stopped working. Here's the code I've been using.
' {$STAMP BS2}
' {$PBASIC 2.5}
DATA_n CON 7
CLK CON 5
Load CON 6
decode CON 9
brite CON 10
scan CON 11
switch CON 12
test CON 15
DecPoint CON 000000
max_dat VAR Word
index VAR Nib
temp VAR Byte
nonZ VAR Bit
dispVal VAR Word
odd VAR index.BIT0
OUTS = 0
DIRS = $FFFF
FOR index = 0 TO 7
LOOKUP index,[scan,4,brite,3,decode,$1F,switch,1], max_dat
SHIFTOUT DATA_n, CLK, MSBFIRST,[max_dat]
IF odd = 0 THEN noLoad
PULSOUT Load,1
NoLoad:
NEXT
dispVal = 1234
MaxDisplay:
nonZ = 0
FOR index = 4 TO 1
SHIFTOUT DATA_n, CLK, MSBFIRST,[index]
temp = dispVal DIG (index - 1)
IF temp = 0 THEN skip1
nonZ = 1
skip1:
IF nonZ = 1 OR temp <> 0 OR index = 1 THEN skip2
temp = 15
skip2:
SHIFTOUT DATA_n, CLK, MSBFIRST,[temp]
PULSOUT Load, 5
NEXT
RETURN
Instead of using a counter like it is in the AppKit, I just set the variable myself. When I set dispVal to something more than 1234 (like 12345678) I get an error message saying "Constant exceeds 16 bits." After doing some research I found out that 12345678 is actually 24 bits. How do I send something like this to the 7219?
Comments
http://classic.parallax.com/Portals/0/Downloads/docs/cols/nv/vol2/col/nv70.pdf
And software attached.
BTW: The Attached file is invalid.
digit_1 = 4 digit_2 = 3 digit_3 = 2 digit_4 = 1 digit_5 = 5 digit_6 = 6 digit_7 = 7 digit_8 = 8 SHIFTOUT DATA_n, CLK, MSBFIRST,[1] SHIFTOUT data_n, CLK, MSBFIRST,[digit_1] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[2] SHIFTOUT data_n, CLK, MSBFIRST,[digit_2] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[3] SHIFTOUT data_n, CLK, MSBFIRST,[digit_3] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[4] SHIFTOUT data_n, CLK, MSBFIRST,[digit_4] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[5] SHIFTOUT data_n, CLK, MSBFIRST,[digit_5] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[6] SHIFTOUT data_n, CLK, MSBFIRST,[digit_6] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[7] SHIFTOUT data_n, CLK, MSBFIRST,[digit_7] PULSOUT Load, 5 SHIFTOUT DATA_n, CLK, MSBFIRST,[8] SHIFTOUT data_n, CLK, MSBFIRST,[digit_8] PULSOUT Load, 5
http://www.savagecircuits.com/binarydigitalclock