Menu

Compiler forcing extra End If

BFGXTC
2008-01-28
2013-05-30
  • BFGXTC

    BFGXTC - 2008-01-28

    Hi, I keep getting a compiled.asm:182:Error [113] Symbol not previously defined (ENDIF3)
    I am able to fix the error by adding an extra End If after my sort (Where it says Get rid of all voltages except max).

    I was just wondering if there was a fix for this.  Thanks,
    Mike

    'Hardware settings
    #chip 16F688, 4            
    #define ch1 PORTC.2
    #config OSC=INTRC_IO
    dir PORTA.1 IN
    dir PORTC.2 OUT
        Dim pulseAdd As Byte
        Dim sethome As Byte
        Dim Pulses(10)
        Dim Voltage(10)
        Dim Index As Byte
        Dim inSort As Byte
        Dim wait As Byte
        pulseAdd = 50
        wait=0

    Main:
    pulseAdd = 50
        wait=0    
    While wait=0
    For count=1 To 200                'Set Servo to -45 degree position
         PULSEOUT PORTC.2, pulseAdd 10us
         Wait 15 ms
    Next
    Wait 50 10ms

       
       
    For i=1 To 10    'Set Servo in ten evenly spaced positions From 500us-1900us
       
        ServoPos pulseAdd
        Wait 25 ms
        Pulses(i)=pulseAdd
         Voltage(i)=ReadAD(AN1)
        pulseAdd=PulseAdd+14
    Next
    wait=1
    Loop

    wait=0

    sub ServoPos(pulsewidth) 'Servo Positioning subroutine 500-1900us
    For PulseIndex=1 To 60   
            PULSEOUT ch1, pulsewidth 10us
            Wait 15 ms
    Next
    Return
    end sub

    index=0
    insort=0

    Do Until Voltage(1)=Voltage(10) 'Get rid of all voltages except for highest voltage
    index=index+1
    inSort=index+1
    If Voltage(inSort) > Voltage(index) Then
    Voltage(index)=Voltage(inSort)
    Pulses(index)=Pulses(inSort)
    End If

    Loop

    ServoPos Pulses(1) 'Set servo to highest voltage position

    For cntTime=1 To 2
        Wait 60 s
    Next
    goto Main

     
    • Hugh Considine

      Hugh Considine - 2008-02-10

      Okay, I've finally been able to look into this and have a solution!

      The problem was with the array handling code in GCBASIC. It wasn't liking having to deal with several arrays on one line. This is now fixed - you can use as many arrays as you like on a line and GCBASIC will handle them correctly.

      The patch is at either http://gcbasic.sourceforge.net/newfiles/update.zip or http://gcbasic.sourceforge.net/newfiles/update-nochipdata.zip depending on whether or not you have the newest chip data files (27/9/2007).

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.