Every time I try to run this I get the following:
"syntax error on Line 39 at/before position 20"
Apparently it is not happy with the "start" label, but I cant figure out why. Any suggestions?
Thanks
Al
"syntax error on Line 39 at/before position 20"
Apparently it is not happy with the "start" label, but I cant figure out why. Any suggestions?
Code:
'=======================FinishLine.bas======================
'===Version 1.0===
;This program is a complement to PinewoodDerby.bas
;Its only function is to determine and display the order
;of finish in a 3-lane Pinewood Derby race.
;It is intended to run on a PICAXE 14M2 acting as a co-processor
'===constants===
'===variables===
symbol Ln_3 = PinB.0 ; rename input B.0 'Ln_3'
symbol Ln_2 = PinB.1 ; rename input B.1 'Ln_2'
symbol Ln_1 = PinB.2 ; rename input B.2 'Ln_1'
symbol Start = PinB.3 ; rename input B.3 'Start'
symbol Display1 = C.0 ; rename output C.0 ‘Display1’
symbol Display2 = C.1 ; rename output C.1 ‘Display2’
symbol Display3 = C.2 ; rename output C.2 ‘Display3’
'===directives===
'#com3 'specify serial port
#picaxe 14M2 'specify processor
#no_data 'save download time
'#terminal of 'disable terminal window
'===================begin main program========================
setfreq M32 'run program at max speed
let dirsC=%11111111 'all outputs
let dirsB=%00100001 'change bits 5, & 0 to outputs
main:
if PinB.3 = 1 then start ;limit switch closed to start race
goto main
myloop:
b0 = pinsB & %00000111 ;mask off bits 0, 1 & 2
if bit0 = 1 then goto Lane3 ;IR beam broken on Lane 3
endif
if bit1 = 1 then goto Lane2 ;IR beam broken on Lane 2
endif
if bit2 = 1 then goto Lane1 ;IR beam broken on Lane 1
endif
if pinB.3 = 0 then goto main ;resets for the next race
goto myloop
start:
pulsout C.0,150: pulsout C.1,150: pulsout C.2,150 ; reset displays to 0
sertxd ("START RACE") ; send start of race message
goto myloop
Lane1:
sertxd ("Lane 1 is the winner!")
Lane2:
sertxd ("Lane 2 is the winner!")
Lane3:
sertxd ("Lane 3 is the winner!")
Al