Menu

Error: Symbol [SFR]BIBBYTE has not been defined

mkstevo
2022-04-16
2022-04-16
  • mkstevo

    mkstevo - 2022-04-16

    As my Wife is (again) working this holiday weekend, I've been re-writing some portions of the code for my Binary, Decimal and Hexadecimal calculator.

    While editing the code, I came across the following error message:

    Error: GCASM: Symbol [SFR]BIBBYTE has not been defined. 
    Inspect ASM file to determine error  at BTFSC BIBBYTE,0
    

    It took me some time to figure out quite what was meant by the error message.

    I was attempting to display the binary 'bits' on the LCD using this code:

    Sub DoPrintBin(In BinByte As Byte, In HiByte As Byte)
        If HiByte = 1 Then
            Locate 0,0
        Else
            Locate 0,8
        End If
        Print BinByte.7
        Print BinByte.6
        Print BinByte.5
        Print BinByte.4
        Print BinByte.3
        Print BinByte.2
        Print BinByte.1
        Print BibByte.0
    End Sub
    

    Turns out I had hit the 'b' key and not the 'n' when typing one of the BinByte print instructions. Accessing the bit portions clearly stopped the "option explicit" directive from seeing the incorrectly named variable "BibByte".

    I only mention it as I'll forget and next time I'm struggling to find the source of this error I might find this post and discover the answer in less than the hour or so it took me this time.

     
    • Anobium

      Anobium - 2022-04-16

      A good post, as a reminder.

      I think we could track this error back into the source in the compiler. I will explain - in previous versions of the compiler the assembler portion of the compiler would have simply crashed with a meaningless error. But, I have update the compiler to show the error in the ASM. It may be possible to search the source program to find the offending piece of the program.

      We know from the ASM error - the source is a symbol byte [ an SFR ], its name and its bit. So, in the case above the compiler can deduce BIBBYTE,0 equates to BIBBYTE.0. And, with the information search the source code for BIBBYTE.0 to provide the original error source. A lot of work but doable. A much better experience for the user.

      Something for a rainy day.

      Evan

       
      • Anobium

        Anobium - 2022-04-16

        Interesting... change to an AVR or LGT chip and the error message is correct! So, this error is specific to PIC. Means Option Explicit is not being applied to PIC for this specific operation.

        /*
        A demonstration program for GCGB and GCB.
        --------------------------------------------------------------------------------
        This program is for an UNO
        
        
        @author EvanV
        @license GPL
        @version 1.00
        @date 2022-04-16
        
         ------------PORTA---------------
        Bit#: -7---6---5---4---3---2---1---0---
        IO: ---------------------------------
        IO: ---------------------------------
        
         ------------PORTB----------------
        Bit#: -7---6---5---4---3---2---1---0---
        IO: --------LED----------------------
        IO: ---------------------------------
        
         ------------PORTC----------------
        Bit#: -7---6---5---4---3---2---1---0---
        IO: ---------------------------------
        IO: ---------------------------------
        
        */
        
        
        #CHIP mega328p, 16
        // #CHIP 16F1829
        // #CHIP 18F47K42
        // #CHIP 12F1572
        // #CHIP LGT8F328P
        
        #OPTION EXPLICIT
        
        
        ;SETUP LCD PARAMETERS
            #DEFINE LCD_IO 4
            #DEFINE LCD_NO_RW
            #DEFINE LCD_SPEED FAST
        
            ; ----- DEFINE HARDWARE SETTINGS
            #DEFINE LCD_RS PORTA.0
            #DEFINE LCD_ENABLE PORTA.0
            #DEFINE LCD_DB4 PORTA.0
            #DEFINE LCD_DB5 PORTA.0
            #DEFINE LCD_DB6 PORTA.0
            #DEFINE LCD_DB7 PORTA.0
        
        
        Dim scrByte as Byte
        
        DoPrintBin ( scrByte, scrByte )
        
        Sub DoPrintBin(In BinByte As Byte, In HiByte As Byte)
            If HiByte = 1 Then
                Locate 0,0
            Else
                Locate 0,8
            End If
            Print BinByte.7
            Print BinByte.6
            Print BinByte.5
            Print BinByte.4
            Print BinByte.3
            Print BinByte.2
            Print BinByte.1
            Print BibByte.0
        End Sub
        
         

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.