Menu

Problem with GCBIDE compiler errors

Help
2016-01-27
2016-01-27
  • Edward LaBudde

    Edward LaBudde - 2016-01-27

    Hi All having a problem with an error.

    PowerMonitor.txt (35): Error: ;STARTUP1;STARTUP2Invalid variable name: AS 5

    'Chip model
    #chip 18F4455, 40
    
    'Configure Usart
    #define USART_BAUD_RATE 2400
    #define USART_BLOCKING      'Used for multiple Bytes -Does not seem to matter if on or off  
    INITUSART                   'Must be used to enable Interrupt to work 
    
    'Set inital parameters
    InitSer 1, r9600, 1, 8, 1, none, invert                 'LCD interface Positive going Standby bit 9600 baud
    'Set Pin directios
    Dir PortA.0 In      'pin19TGen
    Dir PortA.1 In      'pin2BATV
    Dir PortA.2 In      'pin21S1A
    Dir PortA.3 In      'pin22Vref
    Dir PortA.4 Out     'pin23LED
    Dir PortA.4 In      'Pin24So2A
    Dir PortA.5 In      'pin25WGen_A
    Dir PortA.6 In      'pin26TEG_A
    Dir PortA.7 In      'pin27SpareA
    Dir PortC.1 Out     'pin32Test
    'RD3    41  Spare I/O   'SpareI/o
    Dir PortC.6 Out     'pin44Tx data
    Dir PortC.7 In      'pin1RxData
    Dir PortD.5 Out     'pin3T/r
    Dir PortD.6 Out     'pin4LCD
    Dir PortB.0 In      'pin8SpareV
    Dir PortB.2 In      'pin10RSSI
    Dir PortB.3 In      'pin11INT_Temp
    Dir PortB.4 In      'pin14EXT_temp
    
    'Set Dimentions
    Dim Solar1A as word
    Dim Solar2A as word
    Dim WGen_A as word <---- Probelm is here
    Dim TEG_A as word
    Dim TGen_V as word
    Dim Batt_V as word
    Dim SpareV as word
    Dim ReceiverDelay as word
    Dim ETimeHrs as word
    Dim S1TimeHrs as word
    Dim S2TimeHrs as word
    Dim WindTimeHrs as word
    Dim TEGTimeHrs as word
    Dim INT_Temp as word
    Dim EXT_temp as word
    Dim A_Limit as word
    Dim EXT_Temp_min As word
    Dim EXT_Temp_max as word
    Dim INT_Temp_min As word
    Dim INT_Temp_max as word
    
    'set defines
    #define SendAHigh Set PORTD.6 Off                   'Note Polarity for 4X20 Newhaven display
    #define SendALow Set PORTD.6  On 
    #Define TGen as AN0
    #define BATTV as AN1
    #define S1A as AN2
    #define S2A as AN4
    #Define WGen_A as AN5
    #Define SpareA as AN7
    #Define SpareV as PortB.0
    #Define RSSI As PortB.2
    #Define INT_Temp as PortB.3
    #Define EXT_Temp as PortB.4
    #Define LED as PortA.4
    
    
    
    
    
    
    
    'Init variables
    ReceiverDelay = 4945        'Must be 4150 >= ReceiverDelay <= 5810, Avg = 4980, Geo = 4910, use 4945
    E_timesec = 0                                           'Zero Elapsed times
    E_timemin = 0
    E_timehrs = 0
    S1TimeHrs = 0
    S2TimeHrs = 0
    WindTimeHrs = 0
    TEGTimeHrs = 0
    A_Limit = 100
    INT_Temp_min = 1024
    INT_Temp_max = 0
    EXT_Temp_min = 1024
    EXT_Temp_max = 0
    
    
    
    
    
    
    Start:                  'Main program
        Call Blink          'Blink LED on sample                            Verified 07-24-09
        Call Sample         'Measure amps and volts                         Verified 05-05-10
        'Call Elapsed_time   'Calculate time from start                     Verified 07-26-09
        'Call Display       'Display data on LCD                            Verified 05-06-10
        'Call Store         'Store data to EEPROM                           Verified 05-06-10
        'Call SendData      'Tx data to cabin
        wait 721 ms         'Set sample time                                Verified 05-07-10
    Goto Start              'start over
    
    Sub Blink               'Blink on sample
        set PortA.4 on
        wait 1 ms
        set PortA.4 off
    Return
    
    Sub Sample
        'Amps
        S1A_Amp_sample = readAD10(AN2)      '(Amps)
        S2A_Amp_sample = readAD10(AN4)
        WGen_A_Amp_sample = readAD10(AN5)
        SpareA_Amp_Sample =readAD10(AN7)
        TEG_A_Amp_sample = readAD10(AN6)
        'Volts
        TGen_Volt_sample = readAD10(AN0)        '(Volts)
        BATTV_Volt_sample = readAD10(AN1)
        SpareV_Volt_sample = readAD10(PortB.0)
        'Amp calculations
        IF S1A_Amp_sample > A_Limit Then S1A_Amp_sample = (S1A_Amp_sample + S1A_Amp_sample)/2
        If S2A_Amp_sample > A_Limit Then S2A_Amp_sample = (S2A_Amp_sample + S12_Amp_sample)/2
        If WGen_A_Amp_sample > A_Limit then WGen_A_Amp_sample = (WGen_A_Amp_sample+WGen_A_Amp_sample)/2
        If TEG_A_Amp_sample >  A_Limit then TEG_A_Amp_sample = (TEG_A_Amp_sample + TEG_A_Amp_sample)/2
    
        'Volt calculations
        If TEG_A_Amp_sample > A_Limit then TGen_Volt_sample = (TGen_Volt_sample + TGen_Volt_sample)/2
        BATTV _Volt_sample = (BATTV _Volt_sample + BATTV _Volt_sample)/2
        SpareV_Volt_sample = (SpareV_Volt_sample + SpareV_Volt_sample)/2
        ' Temp calculation
        INT_Temp_sample = readAD10(portB.3)
        EXT_Temp_sample = readAD10(portB.4)
        INT_Temp_sample = (INT_Temp_sample + INT_Temp_sample)/2
        EXT_Temp_sample = (EXT_Temp_sample + EXT_Temp_sample)/2
        If INT_Temp_sample > INT_Temp_max then INT_Temp_max = INT_Temp_sample
        If EXT_Temp_sample > EXT_Temp_max then EXT_Temp_max = EXT_Temp_sample
    Return
    
    'Display utilities
    'NewHaven Display utilities
    Sub Clear
        sersend 1, 254  'start CMD
        sersend 1, 81   'clear screen
    Return
    
    Sub First
        sersend 1, 254  'start CMD
        sersend 1, 69   'First line
        sersend 1, 0
    Return
    
    Sub Second
        sersend 1, 254  'start CMD
        sersend 1, 69   'second line
        sersend 1, 64
    Return
    
    Sub Third
        sersend 1, 254  'start CMD
        sersend 1, 69   'Third line
        sersend 1, 20
    Return
    
    Sub Fourth
        sersend 1, 254  'start CMD
        sersend 1, 69   'Fourth line
        sersend 1, 84
    Return
    
     
  • Edward LaBudde

    Edward LaBudde - 2016-01-27

    If I change the name in GCBIDE to WindGen_A then it compiles OK

     
  • Anobium

    Anobium - 2016-01-27

    Most odd. Will investigate. Use the workaround in the meanwhile.

     
  • Anobium

    Anobium - 2016-01-27

    Fixed. Not an issue with the compiler.

    Line 35 you define a variable.
    Line 61 you define the same variable to an analog port.

    Change 35 or 61 to fix.

     
  • Edward LaBudde

    Edward LaBudde - 2016-01-27

    Evan, Thanks! I did this a few years ago but it was too long ago to remember, Ed.

     

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.