Menu

PIC18F4685 and 18F4680 Syntax Error

2007-05-28
2013-05-30
  • Nobody/Anonymous

    Hello,

    if the gcbasic compiler internally uses the assembler commands rrf or rlf, then the following error occurs:
    system.h (698): ,BANKEDSyntax Error
    system.h (699): ,BANKEDSyntax Error

    In the compiled.asm file the error looks like:
    ;********************************************************************************

    SYSDIVSUB
        clrf    SYSCALCTEMPX,BANKED
        movlw    8
        movwf    SYSDIVLOOP,BANKED
    SYSDIV8START
        bcf    STATUS, C,ACCESS
    RLF    SYSCALCTEMPA,    F ;?F12L698S111?,BANKED
    RLF    SYSCALCTEMPX,    F ;?F12L699S111?,BANKED
        movf    SYSCALCTEMPB, W,BANKED
        subwf    SYSCALCTEMPX, F,BANKED
        bsf    SYSCALCTEMPA, 0,BANKED
        btfsc    STATUS, C,ACCESS
        goto    DIV8NOTNEG
        bcf    SYSCALCTEMPA, 0,BANKED
        movf    SYSCALCTEMPB, W,BANKED
        addwf    SYSCALCTEMPX, F,BANKED
    DIV8NOTNEG
        decfsz    SYSDIVLOOP, F,BANKED
        goto    SYSDIV8START
        return

    ;********************************************************************************

    Please try the following example to reproduce the error

        #chip 18F4685, 4
        #define LightSensor AN0
        #define LCD_IO 8
        #define LCD_DATA_PORT PORTC
        #define LCD_RS PORTD.0
        #define LCD_RW PORTD.1
        #define LCD_Enable PORTD.2
        Dim wert1 as Word
        Dim wert2 as Word
        Dim wert3 as Word
        wert1=260
        wert2=150
        wert3=wert1 * wert2
        PRINT "Light Meter:"
        locate 1,2
        PRINT "A GCBASIC Demo"
        wait 2 s
        LCDInt(ReadAD(LightSensor))
        LCDWORD wert3
        wert3=wert1 / wert2
        LCDWORD wert3

    With a 16F877A or a 16F690 the compiler works!
        #chip 16F877A, 20
        #mem 368
        #define LightSensor AN0
        #define LCD_IO 8
        #define LCD_DATA_PORT PORTC
        #define LCD_RS PORTD.0
        #define LCD_RW PORTD.1
        #define LCD_Enable PORTD.2
        Dim wert1 as Word
        Dim wert2 as Word
        Dim wert3 as Word
        wert1=260
        wert2=150
        wert3=wert1 * wert2
        PRINT "Light Meter:"
        locate 1,2
        PRINT "A GCBASIC Demo"
        wait 2 s
        LCDInt(ReadAD(LightSensor))
        LCDWORD wert3

    Best regards
    Manfred

     
    • Hugh Considine

      Hugh Considine - 2007-05-28

      If you download and install http://gcbasic.sourceforge.net/newfiles/update.zip, the rlf and rrf should be automatically converted to the correct 18F commands (rlcf/rrcf).

       
    • Nobody/Anonymous

      Hi Hugh,

      I just downloaded the update.zip and tried it with the example from above, but I still get the same error as described above.

      system.h (698): ,BANKEDSyntax Error
      system.h (699): ,BANKEDSyntax Error

      ;Program compiled by Great Cow BASIC (0.9 27/5/2007)
      ;Need help? See the GCBASIC forums at http://sourceforge.net/forum/?group_id=169286,
      ;check the documentation or email hconsidine@bigpond.com.

      ;********************************************************************************

      ;Set up the assembler options (Chip type, clock source, other bits and pieces)
      LIST p=18F4685, r=DEC
      #include <P18F4685.inc>
      CONFIG WDT=OFF, LVP=OFF, MCLRE=OFF, OSC=HS

      ;********************************************************************************
      .
      .
      .
      ;********************************************************************************

      SYSDIVSUB
          clrf    SYSCALCTEMPX,BANKED
          movlw    8
          movwf    SYSDIVLOOP,BANKED
      SYSDIV8START
          bcf    STATUS, C,ACCESS
      RLF    SYSCALCTEMPA,    F ;?F12L698S79?,BANKED
      RLF    SYSCALCTEMPX,    F ;?F12L699S79?,BANKED
          movf    SYSCALCTEMPB, W,BANKED
          subwf    SYSCALCTEMPX, F,BANKED
          bsf    SYSCALCTEMPA, 0,BANKED
          btfsc    STATUS, C,ACCESS
          goto    DIV8NOTNEG
          bcf    SYSCALCTEMPA, 0,BANKED
          movf    SYSCALCTEMPB, W,BANKED
          addwf    SYSCALCTEMPX, F,BANKED
      DIV8NOTNEG
          decfsz    SYSDIVLOOP, F,BANKED
          goto    SYSDIV8START
          return

      Can you try to run the example on your computer to see if it causes the same error?

      Best regards
      Manfred

       
    • Hugh Considine

      Hugh Considine - 2007-05-29

      I've checked the files in update.zip, and core16.dat is not the current version. If you open in up in Notepad and add these lines:

      RLF f,d,a;    1;    0011 01da ffff ffff
      RRF f,d,a;    1;    0011 01da ffff ffff

      GCBASIC should work. It doesn't matter where you put these lines in the file. I'd upload the new update.zip, but SourceForge seems to be having trouble (again). Hopefully they fix it soon - the uploads were down for almost a month last time.

       
    • Hugh Considine

      Hugh Considine - 2007-05-29

      New update.zip is now up. If you'd rather add the lines to core16.dat yourself than re-download several files unnecessarily, the correct lines are:

      RLF f,d,a;    1;    0011 01da ffff ffff
      RRF f,d,a;    1;    0011 00da ffff ffff

       
    • Nobody/Anonymous

      Now it works! Thank you.

      BR
      Manfred

       

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.