Electronic Scoreboard

Thread Starter

neilgr

Joined Apr 20, 2016
11
Hi guys, a bit of an update....after tons of research I've actually found and altered some code to suit my requirements. The problem that I'm having now is that I need a suitable program to test my code. I will be using a PICAXE-28X1, and three MAX7219s to drive my 19 digit display. Used BASIC programming language as it was fairly straight forward to use. Can you recommend a suitable program that I can use to simulate (preferable a free one)? Please see code below...
 

Thread Starter

neilgr

Joined Apr 20, 2016
11
Code:
symbol total = w5  
symbol batr    = b3  
symbol wkts = b4  
symbol overs = b5  
symbol innings_no = b6
symbol batl_display = b7
symbol batr_display = b8
symbol runs_required = b9
symbol loop_count = b12  
symbol trailby = b13
symbol leadby = b14
symbol org_trailby = b15
symbol follow_on = b16
symbol score = b17
symbol innings_type = b18
symbol batl    = b19
symbol buadrate = N2400  


symbol total_mem = 100  
symbol batl_mem = 104  
symbol batr_mem = 105  
symbol wkts_mem = 106  
symbol overs_mem = 107  
symbol innings_no_mem = 108
symbol batl_display_mem = 109
symbol batr_display_mem = 110
symbol runs_required_mem = 111
symbol trailby_mem = 112
symbol leadby_mem = 113
symbol org_trailby_mem = 114
symbol follow_on_mem = 115
symbol innings_type_mem = 116
symbol batl_display_hundred = 117
symbol batl_display_ten = 118
symbol batl_display_unit = 119
symbol batr_display_hundred = 120
symbol batr_display_ten = 121
symbol batr_display_unit = 122
symbol over_display_ten = 123
symbol over_display_unit = 124
symbol total_display_hundred = 125
symbol total_display_ten = 126
symbol total_display_unit = 127
symbol wkt_display = 128
symbol OLD_batl_display_hundred = 131
symbol OLD_batl_display_ten = 132
symbol OLD_batl_display_unit = 133
symbol OLD_batr_display_hundred = 134
symbol OLD_batr_display_ten = 135
symbol OLD_batr_display_unit = 136
symbol OLD_over_display_ten = 137
symbol OLD_over_display_unit = 138
symbol OLD_total_display_hundred = 139
symbol OLD_total_display_ten = 140
symbol OLD_total_display_unit = 141
symbol OLD_wkt_display = 142
symbol trail_disp_hundred = 143
symbol trail_disp_ten = 144
symbol trail_disp_unit = 145
symbol lead_disp_hundred = 146
symbol lead_disp_ten = 147
symbol lead_disp_unit = 148
symbol OLD_trail_disp_hundred = 149
symbol OLD_trail_disp_ten = 150
symbol OLD_trail_disp_unit = 151
symbol OLD_lead_disp_hundred = 152
symbol OLD_lead_disp_ten = 153
symbol OLD_lead_disp_unit = 154
symbol win_disp_hundred = 155
symbol win_disp_ten = 156
symbol win_disp_unit = 157
symbol OLD_win_disp_hundred = 158
symbol OLD_win_disp_ten = 159
symbol OLD_win_disp_unit = 160


write batl_display_mem, 1
write batr_display_mem, 2
write innings_no_mem, innings_no, 1


'7-segment multiplexing
symbol LOAD_7219    = 0    ' output pin 0
symbol DIN_7219    = 1    ' output pin 1
symbol CLK_7219    = 2    ' output pin 2


'MAX7219 registers
symbol DECODE_MODE    = $09
symbol INTENSITY    = $0a
symbol SCAN_LIMIT    = $0b
symbol SHUTDOWN    = $0c
symbol DIGIT_TEST    = $0f


'Start Up ==================================================


low output0
serout 7,buadrate,(254,1)
pause 10  
serout 7,buadrate,(254,128," GVFRcc SCOREBOARD ")  
serout 7,buadrate,(254,192," by Neil Ramdass ")
wait 5
goto initialise


'Powerdown =================================================

powerdown:
high 0
pause 10
serout 7,buadrate,(254,1)
'if portc input5 = 0 then innings_select  
serout 7,buadrate,(254,128, " POWERING DOWN! ")  
pause 100  
for loop_count = 1 to 720  
'if pin7 = 0 then innings_select
pause 500  
next loop_count  
serout 7,buadrate,(254,1)
end


'Setting Displays========================================== ================

initialise:
low 0
serout 7,buadrate,(254,1)  
serout 7,buadrate,(254,128," INITIALISING SCOREBOARD... ")

'Initialise the 1st 7219

b0 = DECODE_MODE
b1 = $FF    'code B decode for all digits
gosub send_data_7219_1

b0 = INTENSITY
b1 = $0F    'full brightness
gosub send_data_7219_1

b0 = SCAN_LIMIT
b1 = $06    'display digits 0 to 6 (Seven digits)
gosub send_data_7219_1

b0 = SHUTDOWN
b1 = $01    'normal operation
gosub send_data_7219_1


'Initialise the 2nd 7219

b0 = DECODE_MODE
b1 = $FF    'code B decode for all digits
gosub send_data_7219_2

b0 = INTENSITY
b1 = $0F    'full brightness
gosub send_data_7219_2

b0 = SCAN_LIMIT
b1 = $06    'display digits 0 to 6 (Seven digits)
gosub send_data_7219_2

b0 = SHUTDOWN
b1 = $01    'normal operation
gosub send_data_7219_2


'Initialise the 3rd 7219

b0 = DECODE_MODE
b1 = $FF    'code B decode for all digits
gosub send_data_7219_3

b0 = INTENSITY
b1 = $0F    'full brightness
gosub send_data_7219_3

b0 = SCAN_LIMIT
b1 = $06    'display digits 0 to 6 (Seven digits)
gosub send_data_7219_3

b0 = SHUTDOWN
b1 = $01    'normal operation
gosub send_data_7219_3

goto innings_select


'Select Innings 1/2 ================================================== ======

innings_select:
low 0  
serout 7,buadrate,(254,1)
serout 7,buadrate,(254,128," Limited overs or 3-Day match? ")  
pause 100  
if pin1 = 1 then ltd_ovrs ' pin1 will select the "Limited overs" option which is a 2-innings match
if pin5 = 1 then ' pin5 will select the "3-Day match" option which a 4-innings match
    goto testmtch
else goto innings_select  
endif

'Limited overs only have 2 innings while 3-day matches have more than 2 innings (usually 4 innings)
ltd_ovrs:
serout 7,buadrate,(254,128," Limited overs? ")
pause 100
for loop_count = 1 to 5
if pin2 = 1 then innings_select ' if pin2 activates it returns to the "innings select" sub-routine
pause 1000
next loop_count
innings_type = 2
write innings_type_mem, innings_type
goto clear_scoreboard

testmtch:
serout 7,buadrate,(254,128," 3-Day Match? ")
pause 100
for loop_count = 1 to 5
if pin6 = 1 then innings_select ' if pin6 activates it returns to the "innings select" sub-routine
pause 1000
next loop_count
innings_type = 4
write innings_type_mem, innings_type
goto clear_scoreboard


'Scanning Remote Scorring Unit ===========================================

scanning_keys:
if pin0 = 1 then batlout
if pin1 = 1 then batlplus  
'if pin2 = 1 then clear_display  
if pin3 = 1 then totalminus
if pin4 = 1 then totalplus
if pin5 = 1 then batrplus
if pin6 = 1 then batrout
if porta input3 = 1 then oversplus
pause 50
goto scanning_keys


'Innings Clear Display =====================================================

innings:
read innings_type_mem, innings_type
read innings_no_mem, innings_no
if innings_type = 2 then ltdovrs_innings2
if innings_no = 1 then innings2
if innings_no = 2 then innings3
goto innings4

innings2:
read total_mem,total
read trailby_mem, trailby
trailby = total 'set "trail by" = to the "total" value of the 1st innings
write trailby_mem, trailby
goto clear_scoreboard

'Innings3:
innings3:
read trailby_mem, trailby
if org_trailby <= 0 then innings2lead 'checks whether Team 2 (team batting in the 2nd innings) has a lead or deficit
goto innings2deficit

'If team 2 obtained a lead
innings2lead:
read leadby_mem, leadby
read trailby_mem, trailby
trailby = leadby
write trailby_mem,trailby
leadby = 0
write leadby_mem, leadby
goto clear_scoreboard

'if team 2 is trailing
innings2deficit:
if org_trailby >= 150 then inningsfon 'determines whether follow-on was enforced
goto innings3lead

'if team 2 has followed on
inningsfon:
serout 7, buadrate,(254, 128, "Did Team 2 follow-on?")
pause 1000
for loop_count = 1 to 7
if pin7 = 1 then addfon
pause 1000
next loop_count
goto innings3lead

addfon:
read follow_on_mem, follow_on
follow_on = 1
write follow_on_mem, follow_on
goto fwon

fwon:
write trailby_mem, trailby
leadby = 0
write leadby_mem, leadby
goto clear_scoreboard

'if team 1 has a lead
innings3lead:
read trailby_mem, trailby
read leadby_mem, leadby
leadby = trailby
write leadby_mem, leadby
trailby = 0
write trailby_mem, trailby
goto clear_scoreboard

'Innings 4:
innings4:
read leadby_mem, leadby
read runs_required_mem, runs_required
runs_required = leadby + 1
write runs_required_mem, runs_required
goto clear_scoreboard

ltdovrs_innings2:
read total_mem,total
read runs_required_mem, runs_required
runs_required = total + 1
write runs_required_mem, runs_required
goto clear_scoreboard


'Display LCD Score =========================================================

display:
low 0
read total_mem, total
read batl_mem, batl
read batr_mem, batr
read wkts_mem, wkts
read overs_mem, overs
read batl_display_mem, batl_display
read batr_display_mem, batr_display
read runs_required_mem, runs_required
read org_trailby_mem, org_trailby
read trailby_mem, trailby
read leadby_mem, leadby
read innings_no_mem, innings_no
read innings_type_mem, innings_type

'determine which innings is active and selects apporpriate display
if innings_no = 1 then display_2
if innings_no = 2 then display_3
if innings_no = 3 then display_4
goto display_1

'1st Innings display ===============================================================================

display_1:
serout 7,buadrate,(254,128," BAT",#batl_display,": ",#batl," "," TOTAL:",#total," "," BAT",#batr_display,": ",#batr," ")
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," " )
gosub show_display
goto scanning_keys

'2nd Innings display ===============================================================================

display_2:
if innings_type = 2 then display_4 'determines whether it's a limited overs or multi innings match. If it's limited overs then it goes straight to the innings 4 disply

serout 7, buadrate, (254,128," BAT",#batl_display,": ",#batl," "," TOTAL:",#total," "," BAT",#batr_display,"; ",#batr," ")
if trailby <= 0 then display_2_lead
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","TRAIL BY:",#trailby," " )
goto scanning_keys

'if team 2 obtains a lead while still batting, the display_2_lead is displayed
display_2_lead:
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","LEAD BY:",#leadby," " )
goto scanning_keys

'3rd Innings display ==============================================================================

display_3:
serout 7, buadrate, (254,128," BAT",#batl_display,": ",#batl," "," TOTAL:",#total," "," BAT",#batr_display,"; ",#batr," ")
if org_trailby <= 0 then display_team2_lead
goto display_2_deficit

'if team 2 has obtained a lead and their innings has ended, then display_2_lead is displayed
display_team2_lead:
if trailby <= 0 then display_3_lead 'if team 1 surpasses the deficit (ie Team 2 lead) then displays team 1 lead, idsplays display_3_lead
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","TRAIL BY:",#trailby," " )
goto scanning_keys

'if team 2 HASN'T obtained a lead and their innings has ended, then display_2_deficit is displayed
display_2_deficit:
if follow_on = 1 then display_fon 'determines whether team 2 has surpassed the follow-on score
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","LEAD BY:",#leadby," " )
goto scanning_keys

display_3_lead:
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","LEAD BY:",#leadby," " )
goto scanning_keys

display_fon:
if trailby <= 0 then display_3_lead
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","TRAIL BY:",#trailby," " )
goto scanning_keys

'4th Innings display =============================================================================

display_4:
serout 7, buadrate, (254,128," BAT",#batl_display,": ",#batl," "," TOTAL:",#total," "," BAT",#batr_display,"; ",#batr," ")
serout 7,buadrate,(254,192," WKTS:",#wkts," "," OVERS:",#overs," ","TO WIN:",#runs_required," ")
goto scanning_keys


'Main Scoreing Program =====================================================


'decreases the target score (the amount needed to win) by one
to_win_plus:
read runs_required_mem, runs_required
runs_required = runs_required - 1
write runs_required_mem, runs_required
b0 = runs_required / 100
write win_disp_hundred, b0
b0 = runs_required // 100 / 10
write win_disp_ten, b0
b0 = runs_required // 10
write win_disp_unit, b0
goto display

to_win_minus:
read runs_required_mem, runs_required
runs_required = runs_required + 1
write runs_required_mem, runs_required
b0 = runs_required / 100
write win_disp_hundred, b0
b0 = runs_required // 100 / 10
write win_disp_ten, b0
b0 = runs_required // 10
write win_disp_unit, b0
goto display

'when the batsman's score and/or total is incremented, the "trail by" decreases by one
deficit_plus:
read trailby_mem, trailby
if trailby <= 0 then surplus_plus
trailby = trailby - 1
write trailby_mem, trailby
b0 = trailby / 100
write trail_disp_hundred, b0
b0 = trailby // 100 / 10
write trail_disp_ten, b0
b0 = trailby // 10
write trail_disp_unit, b0
goto display

'when the batsman's score and/or total is decremented, the "trail by" increases by one
deficit_minus:
read trailby_mem, trailby
trailby = trailby + 1
write trailby_mem, trailby
b0 = trailby / 100
write trail_disp_hundred, b0
b0 = trailby // 100 / 10
write trail_disp_ten, b0
b0 = trailby // 10
write trail_disp_unit, b0
goto display

'when the batsman's score and/or total is incremented, the "lead by" increases by one
surplus_plus:
read leadby_mem, leadby
leadby = leadby + 1
write leadby_mem, leadby
b0 = leadby / 100
write lead_disp_hundred, b0
b0 = leadby // 100 / 10
write lead_disp_ten, b0
b0 = leadby // 10
write lead_disp_unit, b0
goto display

surplus_minus:
read leadby_mem, leadby
if leadby <= 0 then deficit_minus
leadby = leadby - 1
write leadby_mem, leadby
write leadby_mem, leadby
b0 = leadby / 100
write lead_disp_hundred, b0
b0 = leadby // 100 / 10
write lead_disp_ten, b0
b0 = leadby // 10
write lead_disp_unit, b0
goto display

'adds one to the total count
totalplus:
total = total + 1
write total_mem, total
b0 = total / 100
write total_display_hundred, b0
b0 = total // 100 / 10
write total_display_ten, b0
b0 = total // 10
write total_display_unit, b0
if innings_type = 2 then to_win_plus
if innings_no = 0 then goto display
if innings_no = 3 then to_win_plus
goto deficit_plus

'subtracts one from the total count
totalminus:
total = total - 1
write total_mem, total
b0 = total / 100
write total_display_hundred, b0
b0 = total // 100 / 10
write total_display_ten, b0
b0 = total // 10
write total_display_unit, b0
if innings_type = 2 then to_win_minus
if innings_no = 0 then goto display
if innings_no = 3 then to_win_minus
goto surplus_minus

'Adds one to "left" batsman's score, and to the total
batlplus:
batl = batl + 1
total= total + 1
write batl_mem, batl
write total_mem, total
b0 = batl / 100
write batl_display_hundred, b0
b0 = batl // 100 / 10
write batl_display_ten, b0
b0 = batl // 10
write batl_display_unit, b0
if innings_type = 2 then to_win_plus
if innings_no = 0 then goto display
if innings_no = 3 then to_win_plus
goto deficit_plus

'Subtract one from the "left" batsman's score, and from the total
batlminus:
batl = batl - 1
total= total - 1
write batl_mem, batl
write total_mem, total
b0 = batl / 100
write batl_display_hundred, b0
b0 = batl // 100 / 10
write batl_display_ten, b0
b0 = batl // 10
write batl_display_unit, b0
if innings_type = 2 then to_win_minus
if innings_no = 0 then goto display
if innings_no = 3 then to_win_minus
goto surplus_minus

'resets the "left' batsman's score to "0" and adds one to the wicket's display
batlout:
read wkts_mem, wkts
wkts = wkts + 1
write wkts_mem, wkts
write wkt_display, wkts
write batl_mem, 0
if wkts >= 10 then innings_count 'if wkts >= 10 then current innings ends and determines which innings is next
read batl_display_mem, batl_display
read batr_display_mem, batr_display
if batr_display > batl_display then bat1
if batr_display < batl_display then bat2
goto display

innings_count:
read innings_no_mem, innings_no    'check the innings count
innings_no = innings_no + 1    'add one to the innings count
write innings_no_mem, innings_no    'store new innings value
if innings_no = 3 then goto innings
goto org_trail_by

org_trail_by:
read trailby_mem, trailby
read org_trailby_mem, org_trailby
org_trailby = trailby
write org_trailby_mem, org_trailby
goto innings

bat1:
read batr_display_mem, batl_display
batl_display = batl_display + 1
write batl_display_mem, batl_display
goto display

bat2:
read batl_display_mem, batl_display
batl_display = batl_display + 1
write batl_display_mem, batl_display  
goto display

'Adds one to the "right" batsman's score, and to the total
batrplus:
batr = batr + 1
total= total + 1
write batr_mem, batr
write total_mem, total
b0 = batr / 100
write batr_display_hundred, b0
b0 = batr // 100 / 10
write batr_display_ten, b0
b0 = batr // 10
write batr_display_unit, b0
if innings_type = 2 then to_win_plus
if innings_no = 0 then goto display
if innings_no = 3 then to_win_plus
goto deficit_plus

'Subtract one from the "right" batsman's score, and from the total
batrminus:
batr = batr - 1
total= total - 1
write batr_mem, batr
write total_mem, total
b0 = batr / 100
write batr_display_hundred, b0
b0 = batr // 100 / 10
write batr_display_ten, b0
b0 = batr // 10
write batr_display_unit, b0
if innings_type = 2 then to_win_minus
if innings_no = 0 then goto display
if innings_no = 3 then to_win_minus
goto surplus_minus

'resets the "right" batsman's score to "0" and adds one to the wicket's display
batrout:
read wkts_mem, wkts
wkts = wkts + 1
write wkts_mem, wkts
write wkt_display, wkts
write batr_mem, 0
if wkts >= 10 then innings_count 'if wkts >= 10 then current innings ends and determines which innings is next
read batl_display_mem, batl_display
read batr_display_mem, batr_display
if batl_display > batr_display then bat3
if batl_display < batr_display then bat4  
goto display

bat3:
read batl_display_mem, batr_display
batr_display = batr_display + 1
write batr_display_mem, batr_display
goto display

bat4:
read batr_display_mem, batr_display
batr_display = batr_display + 1
write batr_display_mem, batr_display
goto display

'adds one to the overs count
oversplus:
overs = overs + 1
write overs_mem, overs
b0 = overs / 10
write over_display_ten, b0
b0 = overs // 10
write over_display_unit, b0
goto display

'subtracts one from the overs count
oversminus:
overs = overs - 1
write overs_mem, overs
b0 = overs / 10
write over_display_ten, b0
b0 = overs // 10
write over_display_unit, b0
goto display


'Clearing Scoreboard Program ======================================================

clear_scoreboard:
write batl_display_mem,1
write batl_mem,0
write total_mem,0
write batr_display_mem,2
write batr_mem,0
write wkts_mem,0
write overs_mem,0

'clear scoreboard display
write batl_display_hundred,0
write batl_display_ten,0
write batl_display_unit,0
write over_display_ten,0
write over_display_ten,0
write over_display_unit,0
write batr_display_hundred,0
write batr_display_ten,0
write batr_display_unit,0

goto display


' Subroutine show_display =====================================================================

show_display:

'Even though digits change very quickly, it is beneficial to update the digits from the right hand end first - looks a little better on the display


'1st 7219 displays the current values of
    'Batl_display_hundred on digit 1 of the 8 displays
    'Batl_display_ten on digit 2 of the 8 displays
    'Batl_display_unit on digit 3 of the 8 displays
    'Batr_display_hundred on digit 6 of the 8 displays
    'Batr_display_ten on digit 7 of the 8 displays
    'Batr_display_unit on digit 8 of the 8 displays

'Left batter display - digit 3 first
read batl_display_unit, b1
read OLD_batl_display_unit, b2
if b1 = b2 then batl_tens
write OLD_batl_display_unit, b1
b0 = $03
gosub send_data_7219_1

batl_tens: 'digit 2
read batl_display_ten, b1
read OLD_batl_display_ten, b2
if b1 = b2 then batl_hun
write OLD_batl_display_ten, b1
b0 = $02
gosub send_data_7219_1

batl_hun: 'digit 1
read batl_display_hundred, b1
read OLD_batl_display_hundred, b2
if b1 = b2 then batr_unit
write OLD_batl_display_hundred, b1
b0 = $01
gosub send_data_7219_1

'Right batter display - digit 8 first
batr_unit:
read batr_display_unit, b1
read OLD_batr_display_unit, b2
if b1 = b2 then batr_tens
write OLD_batr_display_unit, b1
b0 = $08
gosub send_data_7219_1

batr_tens: 'digit 7
read batr_display_ten, b1
read OLD_batr_display_ten, b2
if b1 = b2 then batr_hun
write OLD_batr_display_ten, b1
b0 = $07
gosub send_data_7219_1

batr_hun: 'digit 6
read batr_display_hundred, b1
read OLD_batr_display_hundred, b2
if b1 = b2 then total_unit
write OLD_batr_display_hundred, b1
b0 = $06
gosub send_data_7219_1


'2nd 7219 displays the current values of
    'Total_display_hundred on digit 1 of the 8 displays
    'Total_display_ten on digit 2 of the 8 displays
    'Total_display_unit on digit 3 of the 8 displays
    'Wkts_display_hundred on digit 5 of the 8 displays
    'Over_display_ten on digit 7 of the 8 displays
    'Over_display_unit on digit 8 of the 8 displays

total_unit: 'Total display - digit 3 first
read total_display_unit, b1
read OLD_total_display_unit, b2
if b1 = b2 then total_tens
write OLD_batl_display_unit, b1
b0 = $03
gosub send_data_7219_2

total_tens: 'digit 2
read total_display_ten, b1
read OLD_total_display_ten, b2
if b1 = b2 then total_hun
write OLD_total_display_ten, b1
b0 = $02
gosub send_data_7219_2

total_hun: 'digit 1
read total_display_hundred, b1
read OLD_total_display_hundred, b2
if b1 = b2 then wicket
write OLD_total_display_hundred, b1
b0 = $01
gosub send_data_7219_2

wicket: 'digit 5
read wkt_display, b1
read OLD_wkt_display, b2
if b1 = b2 then over_unit
write OLD_wkt_display, b1
b0 = $05
gosub send_data_7219_2

over_unit: 'digit 8
read over_display_unit, b1
read OLD_over_display_unit, b2
if b1 = b2 then over_tens
write OLD_over_display_unit, b1
b0 = $08
gosub send_data_7219_2

over_tens: 'digit 7
read over_display_ten, b1
read OLD_over_display_ten, b2
if b1 = b2 then end_show_display
write OLD_over_display_ten, b1
b0 = $07
gosub send_data_7219_2

end_show_display:
return


'Subroutine send_data_7219 ============================================================

'This routine is optimised to be as fast as possible. Other algorithms use loops and shift operators but these are too slow


'Send data to the FIRST 7219 ===========================================================

send_data_7219_1:

'Set the LOAD input low
low LOAD_7219

'Bit-bang b0 to the 7219 one bit at a time
pin1 = bit7
pulsout CLK_7219, 1

pin1 = bit6
pulsout CLK_7219, 1

pin1 = bit5
pulsout CLK_7219, 1

pin1 = bit4
pulsout CLK_7219, 1

pin1 = bit3
pulsout CLK_7219, 1

pin1 = bit2
pulsout CLK_7219, 1

pin1 = bit1
pulsout CLK_7219, 1

pin1 = bit0
pulsout CLK_7219, 1

'Bit-bang b1 to the 7219 one bit at a time
pin1 = bit15
pulsout CLK_7219, 1

pin1 = bit14
pulsout CLK_7219, 1

pin1 = bit13
pulsout CLK_7219, 1

pin1 = bit12
pulsout CLK_7219, 1

pin1 = bit11
pulsout CLK_7219, 1

pin1 = bit10
pulsout CLK_7219, 1

pin1 = bit9
pulsout CLK_7219, 1

pin1 = bit8
pulsout CLK_7219, 1

'Set the LOAD input low
high LOAD_7219

return


'Send data to the SECOND 7219 ==============================================================

send_data_7219_2:

'Set the LOAD input low
low LOAD_7219

'Bit-bang b0 to the 7219 one bit at a time
pin1 = bit7
pulsout CLK_7219, 1

pin1 = bit6
pulsout CLK_7219, 1

pin1 = bit5
pulsout CLK_7219, 1

pin1 = bit4
pulsout CLK_7219, 1

pin1 = bit3
pulsout CLK_7219, 1

pin1 = bit2
pulsout CLK_7219, 1

pin1 = bit1
pulsout CLK_7219, 1

pin1 = bit0
pulsout CLK_7219, 1

'Bit-bang b1 to the 7219 one bit at a time
pin1 = bit15
pulsout CLK_7219, 1

pin1 = bit14
pulsout CLK_7219, 1

pin1 = bit13
pulsout CLK_7219, 1

pin1 = bit12
pulsout CLK_7219, 1

pin1 = bit11
pulsout CLK_7219, 1

pin1 = bit10
pulsout CLK_7219, 1

pin1 = bit9
pulsout CLK_7219, 1

pin1 = bit8
pulsout CLK_7219, 1

'"no-op" command to by pass 1st 7219
b1 = $00
b2 = $00

'Set the LOAD input low
high LOAD_7219

return


'Send data to the THIRD 7219 ===========================================================================

send_data_7219_3:

'Set the LOAD input low
low LOAD_7219

'Bit-bang b0 to the 7219 one bit at a time

pin1 = bit7
pulsout CLK_7219, 1

pin1 = bit6
pulsout CLK_7219, 1

pin1 = bit5
pulsout CLK_7219, 1

pin1 = bit4
pulsout CLK_7219, 1

pin1 = bit3
pulsout CLK_7219, 1

pin1 = bit2
pulsout CLK_7219, 1

pin1 = bit1
pulsout CLK_7219, 1

pin1 = bit0
pulsout CLK_7219, 1

'Bit-bang b1 to the 7219 one bit at a time
pin1 = bit15
pulsout CLK_7219, 1

pin1 = bit14
pulsout CLK_7219, 1

pin1 = bit13
pulsout CLK_7219, 1

pin1 = bit12
pulsout CLK_7219, 1

pin1 = bit11
pulsout CLK_7219, 1

pin1 = bit10
pulsout CLK_7219, 1

pin1 = bit9
pulsout CLK_7219, 1

pin1 = bit8
pulsout CLK_7219, 1

'"no-op" command to bypass 2nd 7219
b1 = $00
b2 = $00

'Set the LOAD input low
high LOAD_7219

return
Mods edit:
Please adding double tags with code to including your code.
 
Last edited by a moderator:

elec_mech

Joined Nov 12, 2008
1,500
The only simulator that I'm aware of is this. Unfortunately, it's not free and I've never used it, so I can't speak to its usefulness. However, I suggest checking in with the PICAXE forum here. They'll be able to tell you for sure.

I threw your code into the PICAXE editor and it compiles just fine (I'm sure you did this already). I do notice you do a fair amount of bit-banging. You can get around this by using the I2C commands. I'll review your code as time allows and make some suggestions.

Lastly, the 28X1 is all but obsolete. If given the option, I'd suggest the 28X2 (newest model). Might get away with something smaller still - do you have a schematic you can post?
 

Thread Starter

neilgr

Joined Apr 20, 2016
11
Hi @elec_mech thanks for the reply. With regards to the bit banging, in all honesty, I really don't understand this. I found the code and just altered it to suit my needs. Have no comprehension on what was done or what you are suggesting. I don't have a schematic....I will try to create one and post later.

Neil
 
Top