Shop OBEX P1 Docs P2 Docs Learn Events
Just not seeing my syntax error! "Expected a Label" — Parallax Forums

Just not seeing my syntax error! "Expected a Label"

JediJedi Posts: 5
edited 2013-08-17 16:30 in BASIC Stamp
I have been Googling and re-reading the manual but I just can't figure out what
stupid syntax error I have that's giving me error 148.

The subroutine label is "Fast" that gives me the error. What am I doing wrong?

Offending word in red below.

Thanks all

Jedi





Main:


FOR Clock = 0 TO 59
IF (clock = 59) THEN GOSUB Pulse ELSE GOSUB Blink
IF (clock = 0) THEN OUTH = 100111 'LED displays 0
IF (clock = 10) THEN OUTH = 000100 'LED displays 1
IF (clock = 20) THEN OUTH = 010011 'LED displays 2
IF (clock = 30) THEN OUTH = 010110 'LED displays 3
IF (clock = 40) THEN OUTH = 110100 'LED displays 4
IF (clock = 50) THEN OUTH = 110110 'LED displays 5


IF (IN6 = 1) THEN GOSUB Fast 'read Fast trigger

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-08-17 16:11
    Apparently you don't have a label in your program named "Fast." Try posting your entire program, then maybe someone can give you more informed assistance.

    -Phil
  • JediJedi Posts: 5
    edited 2013-08-17 16:22
    Thanks Phil. Below is a paste of the entire program. Apologies for the newbie stuff - I've coded for many
    years in numerous languages and feel really stupid on this error - my first pBASIC project for a minute-impulse clock.

    Thank you

    Jedi
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    
    ' Pin definitions:
    ' Pin 0 = Relay Output
    ' Pin 1 = LED 1Hz Blink
    ' Pin 2 = Fast Advance Trigger
    
    
    ' Initialize, declare variables, condition pins
    
    
    INPUT 6
    
    
    Clock         VAR Byte
    Fast          VAR Byte
    Fast_Pulse    VAR Byte
    
    
    OUTH = 000000                 ' initialize LED output pins
    DIRH = 111111                 ' initialize LED segments to low
    
    
    DO
    
    
    Main:
    
    
    FOR Clock = 0 TO 59
      IF (clock = 59) THEN GOSUB Pulse ELSE GOSUB Blink
      IF (clock = 0) THEN OUTH = 100111                     'LED displays 0
      IF (clock = 10) THEN OUTH = 000100                    'LED displays 1
      IF (clock = 20) THEN OUTH = 010011                    'LED displays 2
      IF (clock = 30) THEN OUTH = 010110                    'LED displays 3
      IF (clock = 40) THEN OUTH = 110100                    'LED displays 4
      IF (clock = 50) THEN OUTH = 110110                    'LED displays 5
    
    
      IF (IN6 = 1) THEN GOSUB Fast                             'read Fast trigger
    
    
      PAUSE 300                                                'main time variable
    NEXT 
    
    
    Blink:
    HIGH 1                                                     'Turn on LED
    PAUSE 250                                                  '1/4 second blink
    LOW 1                                                      'Turn LED off
    RETURN
    
    
    Pulse:
    HIGH 0                                                     'Turn on relay
    PAUSE 500                                                  'Clock advances
    LOW 0                                                      'turn off relay
    RETURN
    
    
    Fast:
    FOR Fast_Pulse = 1 TO 60                                   'send 60 pulses
      HIGH 0                                                   'trigger relay
      PAUSE 500                                                'clock advances
      LOW 0                                                    'turn off relay
    NEXT 
    RETURN
    
    
    LOOP
    END
    
  • JediJedi Posts: 5
    edited 2013-08-17 16:30
    DOH!! I had declared a variable by that name that I ended up not using.

    That was it. Hey - I'm a little rusty :p

    Jedi
Sign In or Register to comment.