4 digit 12volt Horseshoe scoreboard
Hello all,
Well I finally completed the code for my 12volt 4-digit seven segment display horseshoe scoreboard!
The scoreboard uses 6 momentary switches:
player 1· UP/DOWN switches
player 2· UP/DOWN switches
a switch that lights an arrow that points at player 1 or player 2
and a reset button.
There are two separate two digit displays for each players score that goes to 25.· It could go higher but you would have to enter all the digit codes to increse the digits to 99!·
The components:
BS2p40 = 1
4511 -·BCD to digit chip = 4
UDN2981 - 8 channel source driver chip = 4
two 7905 regulator chips
12volt power supply
assorted connectors for ribbon·cables
All chips·used·chip sockets for easy replacement.
I will include photos when I have the case made!
I used the Proteus 7 simulation software for simulate the code.
' {$STAMP BS2p}
' {$PBASIC 2.5}
index1·········· VAR···· Word
index2·········· VAR···· Word
arrow·· VAR···· Word
index1 = 0
index2 = 0
arrow· = 1
main:
MAINIO
HIGH 6
HIGH 7
AUXIO
LOW 6
HIGH 7
MAINIO
DO
· 'If you press button [noparse][[/noparse]0] the index count will increase from 1 to 9 and stop
·IF IN0 = 1 THEN
· MAINIO
·· DIRH=$ff
··· ·· index1 = index1 + 1
····· ·· IF index1 >= 25 THEN
····· ···· index1 = 25
······ ···
····· ·· ENDIF
· LOOKUP index1,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
·DEBUG BIN8 OUTH
······· PAUSE 500
· 'If you press button [noparse][[/noparse]1] the index count will decrease from 9 to 1 and stop
···
·ELSEIF IN1 = 1· THEN
· · MAINIO·
·· DIRH=$ff
·· index1 = index1 - 1
·· ··IF index1 <= 0 THEN
···· ··· index1 = 1
····· ···
·· ··ENDIF
·· LOOKUP index1,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
· DEBUG BIN8 OUTH
······· PAUSE 500
· 'If you press button [noparse][[/noparse]2] the index count will decrease from 9 to 1 and stop
·ELSEIF IN2 = 1· THEN
·· AUXIO
·· DIRH=$ff
··· ·· index2 = index2 + 1
····· ·· IF index2 >= 25 THEN
····· ···· index2 = 25
······ ····
··
····· ·· ENDIF
· LOOKUP index2,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
·DEBUG BIN8 OUTH
······· PAUSE 500
· 'If you press button [noparse][[/noparse]3] the index count will decrease from 9 to 1 and stop
·ELSEIF IN3 = 1· THEN
· AUXIO
·· DIRH=$ff
· ·· index2 = index2 - 1
·· ··IF index2 <= 1 THEN
···· ··· index2 = 1
·····
·· ··ENDIF
·· LOOKUP index2,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
· DEBUG BIN8 OUTH
······· PAUSE 500
'If you press button [noparse][[/noparse]4] RESTART SCOREBOARD
···
·ELSEIF IN4 = 1· THEN
· ··index1 = 0
··index2 = 0
······· MAINIO
··· LOW 7
··· LOW 6
··AUXIO
··· LOW 6
·········· LOW 7
······ pause 1000
··MAINIO
··· HIGH 6
··· HIGH 7
··MAINIO
··OUTH=%00000000
··AUXIO
··OUTH=%00000000
··AUXIO
····· LOW 6
····· HIGH 7
··arrow = 1
'If you press button [noparse][[/noparse]5] CHANGE DIRECTION OF ARROW
···
· ELSEIF IN5 = 1 THEN
·· arrow = arrow + 1
··IF arrow = 2 THEN
·· AUXIO
··· LOW 7
··· HIGH 6
·· arrow = 0
··pause 500
··ELSE
··· AUXIO
····· LOW 6
····· HIGH 7
··pause 500·
··ENDIF·
·ENDIF
LOOP
END
If you have any questions please don't hesitate to ask!
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“Intellectual growth should commence at birth and cease only at death”
Albert Einstein
Post Edited (kingspud) : 5/1/2008 2:17:48 PM GMT
Well I finally completed the code for my 12volt 4-digit seven segment display horseshoe scoreboard!
The scoreboard uses 6 momentary switches:
player 1· UP/DOWN switches
player 2· UP/DOWN switches
a switch that lights an arrow that points at player 1 or player 2
and a reset button.
There are two separate two digit displays for each players score that goes to 25.· It could go higher but you would have to enter all the digit codes to increse the digits to 99!·
The components:
BS2p40 = 1
4511 -·BCD to digit chip = 4
UDN2981 - 8 channel source driver chip = 4
two 7905 regulator chips
12volt power supply
assorted connectors for ribbon·cables
All chips·used·chip sockets for easy replacement.
I will include photos when I have the case made!
I used the Proteus 7 simulation software for simulate the code.
' {$STAMP BS2p}
' {$PBASIC 2.5}
index1·········· VAR···· Word
index2·········· VAR···· Word
arrow·· VAR···· Word
index1 = 0
index2 = 0
arrow· = 1
main:
MAINIO
HIGH 6
HIGH 7
AUXIO
LOW 6
HIGH 7
MAINIO
DO
· 'If you press button [noparse][[/noparse]0] the index count will increase from 1 to 9 and stop
·IF IN0 = 1 THEN
· MAINIO
·· DIRH=$ff
··· ·· index1 = index1 + 1
····· ·· IF index1 >= 25 THEN
····· ···· index1 = 25
······ ···
····· ·· ENDIF
· LOOKUP index1,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
·DEBUG BIN8 OUTH
······· PAUSE 500
· 'If you press button [noparse][[/noparse]1] the index count will decrease from 9 to 1 and stop
···
·ELSEIF IN1 = 1· THEN
· · MAINIO·
·· DIRH=$ff
·· index1 = index1 - 1
·· ··IF index1 <= 0 THEN
···· ··· index1 = 1
····· ···
·· ··ENDIF
·· LOOKUP index1,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
· DEBUG BIN8 OUTH
······· PAUSE 500
· 'If you press button [noparse][[/noparse]2] the index count will decrease from 9 to 1 and stop
·ELSEIF IN2 = 1· THEN
·· AUXIO
·· DIRH=$ff
··· ·· index2 = index2 + 1
····· ·· IF index2 >= 25 THEN
····· ···· index2 = 25
······ ····
··
····· ·· ENDIF
· LOOKUP index2,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
·DEBUG BIN8 OUTH
······· PAUSE 500
· 'If you press button [noparse][[/noparse]3] the index count will decrease from 9 to 1 and stop
·ELSEIF IN3 = 1· THEN
· AUXIO
·· DIRH=$ff
· ·· index2 = index2 - 1
·· ··IF index2 <= 1 THEN
···· ··· index2 = 1
·····
·· ··ENDIF
·· LOOKUP index2,· [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110,%01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001,%01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH
· DEBUG BIN8 OUTH
······· PAUSE 500
'If you press button [noparse][[/noparse]4] RESTART SCOREBOARD
···
·ELSEIF IN4 = 1· THEN
· ··index1 = 0
··index2 = 0
······· MAINIO
··· LOW 7
··· LOW 6
··AUXIO
··· LOW 6
·········· LOW 7
······ pause 1000
··MAINIO
··· HIGH 6
··· HIGH 7
··MAINIO
··OUTH=%00000000
··AUXIO
··OUTH=%00000000
··AUXIO
····· LOW 6
····· HIGH 7
··arrow = 1
'If you press button [noparse][[/noparse]5] CHANGE DIRECTION OF ARROW
···
· ELSEIF IN5 = 1 THEN
·· arrow = arrow + 1
··IF arrow = 2 THEN
·· AUXIO
··· LOW 7
··· HIGH 6
·· arrow = 0
··pause 500
··ELSE
··· AUXIO
····· LOW 6
····· HIGH 7
··pause 500·
··ENDIF·
·ENDIF
LOOP
END
If you have any questions please don't hesitate to ask!
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“Intellectual growth should commence at birth and cease only at death”
Albert Einstein
Post Edited (kingspud) : 5/1/2008 2:17:48 PM GMT


Comments
At a quick glance, you should be able to save a bunch of memory by making a LOOKUP subroutine. It may not work
' {$STAMP BS2p} ' {$PBASIC 2.5} index1 VAR Word index2 VAR Word index VAR Word arrow VAR Word index1 = 0 index2 = 0 arrow = 1 main: MAINIO HIGH 6 HIGH 7 AUXIO LOW 6 HIGH 7 MAINIO DO 'If you press button [noparse][[/noparse]0] the index count will increase from 1 to 9 and stop IF IN0 = 1 THEN MAINIO DIRH=$ff index1 = index1 + 1 IF index1 >= 25 THEN index1 = 25 ENDIF index = index1 GOSUB lookup_button 'Go and look up the button DEBUG BIN8 OUTH PAUSE 500 'If you press button the index count will decrease from 9 to 1 and stop ELSEIF IN1 = 1 THEN MAINIO DIRH=$ff index1 = index1 - 1 IF index1 <= 0 THEN index1 = 1 ENDIF index = index1 GOSUB lookup_button 'Go and look up the button DEBUG BIN8 OUTH PAUSE 500 'If you press button the index count will decrease from 9 to 1 and stop ELSEIF IN2 = 1 THEN AUXIO DIRH=$ff index2 = index2 + 1 IF index2 >= 25 THEN index2 = 25 ENDIF index = index2 GOSUB lookup_button 'Go and look up the button DEBUG BIN8 OUTH PAUSE 500 'If you press button the index count will decrease from 9 to 1 and stop ELSEIF IN3 = 1 THEN AUXIO DIRH=$ff index2 = index2 - 1 IF index2 <= 1 THEN index2 = 1 ENDIF GOSUB lookup_button 'Go and look up the button index = index2 DEBUG BIN8 OUTH PAUSE 500 'If you press button RESTART SCOREBOARD ELSEIF IN4 = 1 THEN index1 = 0 index2 = 0 MAINIO LOW 7 LOW 6 AUXIO LOW 6 LOW 7 pause 1000 MAINIO HIGH 6 HIGH 7 MAINIO OUTH=%00000000 AUXIO OUTH=%00000000 AUXIO LOW 6 HIGH 7 arrow = 1 'If you press button CHANGE DIRECTION OF ARROW ELSEIF IN5 = 1 THEN arrow = arrow + 1 IF arrow = 2 THEN AUXIO LOW 7 HIGH 6 arrow = 0 pause 500 ELSE AUXIO LOW 6 HIGH 7 pause 500 ENDIF ENDIF LOOP END lookup_disp LOOKUP index, [noparse][[/noparse] %00000000, %00011110, %00101110,%00111110,%01001110,%01011110,%01101110, %01111110,%10001110,%10011110,%00000001,%00010001,%00100001,%00110001,%01000001,%01010001, %01100001,%01110001,%10000001,%10010001,%00000010,%00010010,%00100010,%00110010,%01000010,%01010010], OUTH RETURN▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1010, so be surprised!