syntax error

thelittlesthobo

New Member
Hello
For the following section of code, I am getting syntax error with the arrow pointing to the number '1'. I suspect it will also do it to 2,3,4 & 5.

symbol fault(1) = b1
^
symbol fault(2) = b2
symbol fault(3) = b3
symbol fault(4) = b4
symbol fault(5) = b5

I want to use these locations to store 5 faults (Numbered 1-10) from another device. I am using a for loop after this to store the faults to each location.

for fault = 1 to 5 ;Loop for DTCs 1-5
let b0 = 1 ;Set b0(fault) to 1
pulsin pulse,0,w13 ;Measure low pulses & store @ w13
if w13 > 400 then ;If low pulse is greater than 400, gosub faultcount
let temp = 0 ;Set temp to 0
gosub faultcount ;Goto sub routine to count pulses
endif ;End IF statement
fault(b0) = temp ;Assign temp value to fault(b0)
inc b0 ;Increment bo(fault)
next counter ;Increment loop
goto results ;Loops finished, goto results

Can anyone tell me why I am getting the syntax error or even if there is an easier way.

Many thanks

Rob
 

Technical

Technical Support
Staff member
Use bptr to point to the position you want, you can't use array type notation e.g. (0) in symbol names.

Code:
[COLOR=Blue]symbol [/COLOR][COLOR=Black]fault1 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b1[/COLOR]
[COLOR=Blue]symbol [/COLOR][COLOR=Black]fault2 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b2[/COLOR]
[COLOR=Blue]symbol [/COLOR][COLOR=Black]fault3 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b3[/COLOR]
[COLOR=Blue]symbol [/COLOR][COLOR=Black]fault4 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b4[/COLOR]
[COLOR=Blue]symbol [/COLOR][COLOR=Black]fault5 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b5[/COLOR]

[COLOR=Blue]for [/COLOR][COLOR=Purple]bptr [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]1 [/COLOR][COLOR=Blue]to [/COLOR][COLOR=Navy]5 [/COLOR][COLOR=Green];Loop for DTCs 1-5
      [/COLOR][COLOR=Blue]let [/COLOR][COLOR=Purple]b0 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]1 [/COLOR][COLOR=Green];Set b0(fault) to 1
      [/COLOR][COLOR=Blue]pulsin [/COLOR][COLOR=Black]pulse,[/COLOR][COLOR=Navy]0[/COLOR][COLOR=Black],[/COLOR][COLOR=Purple]w13 [/COLOR][COLOR=Green];Measure low pulses & store @ w13
      [/COLOR][COLOR=Blue]if [/COLOR][COLOR=Purple]w13 [/COLOR][COLOR=DarkCyan]> [/COLOR][COLOR=Navy]400 [/COLOR][COLOR=Blue]then[/COLOR][COLOR=Green];If low pulse is greater than 400, gosub faultcount
            [/COLOR][COLOR=Blue]let [/COLOR][COLOR=Black]temp [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]0 [/COLOR][COLOR=Green];Set temp to 0
            [/COLOR][COLOR=Blue]gosub [/COLOR][COLOR=Black]faultcount [/COLOR][COLOR=Green];Goto sub routine to count pulses
      [/COLOR][COLOR=Blue]endif [/COLOR][COLOR=Green];End IF statement

      [/COLOR][COLOR=Purple]@bptr [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Black]temp [/COLOR][COLOR=Green];Assign temp value to fault(b0)
      [/COLOR][COLOR=Blue]inc [/COLOR][COLOR=Black]temp [/COLOR][COLOR=Green];Increment bo(fault)[/COLOR]
[COLOR=Blue]next   [/COLOR][COLOR=Green];Increment loop[/COLOR]
[COLOR=Blue]goto [/COLOR][COLOR=Black]results [/COLOR][COLOR=Green];Loops finished, goto results[/COLOR]
 
Top