Menu

delay_10us sub problem

2009-02-16
2013-05-30
  • Charles Patton

    Charles Patton - 2009-02-16

    I'm new to GCBASIC and MPIDE and ran into a problem you may already be aware of.

    My small GCBasic pgm for a PIC16F877 has an 'include' of the 'rs232.h' lib.  GCB compiles OK, but the ASM code blows up in the MPASM.  The problem was traced to the fact that GCB adds the 'Delay_10US' subs with mismatched case names.  In the GCB output ASM code I have:
    SERBITDELAY       
        movlw    1
        subwf    SER_RATE,W
        btfss    STATUS, Z
        goto    ENDIF1
        movlw    3
        movwf    SysWaitTemp10US
        call    Delay_10US
        return   

    but the sub it creates look like this:
    DELAY_10US       
    D10US_START       
        movlw    16
        movwf    DELAYTEMP
    D10US_LOOP       
        decfsz    DELAYTEMP, F
        goto    D10US_LOOP
        decfsz    SysWaitTemp10US, F
        goto    D10US_START
        return   

    Notice the mismatch in case for the call vs the sub name.  MPASM seems to be  case sensitive and I can fix the problem by hand editing the ASM code.  This problem also occurs for the
    DELAY_MS
    sub creation and call.  So I suspect it will happen for the other delay subs.  Looking at the GCB source it's not immediately apparent as the formation of the keywords looks right, so I think GCB goes through an upper case conversion on the sub name sometime prior to outputting the ASM code but I don't see where that happens.   (Or else there is a mismatch between the GCB source and executable.  But I just got the 'Great Cow BASIC v.0.9.3.0' code from SourceForge Jan 18, 2009.  So I assume it is up-to-date.)

     
    • Nobody/Anonymous

      For me GCBasic works ok on a simple " wait 1 10us"

      This is an example:

      _____________________________________________________________________________________

      ;Program compiled by Great Cow BASIC (0.9 24/1/2009)
      ;Need help? See the GCBASIC forums at http://sourceforge.net/forum/?group_id=169286,
      ;check the documentation or email w_cholmondeley@users.sourceforge.net.

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

      ;Set up the assembler options (Chip type, clock source, other bits and pieces)
      LIST p=16F877, r=DEC
      #include <P16F877.inc>
      __CONFIG _XT_OSC & _WDT_OFF & _LVP_OFF

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

      ;Set aside memory locations for variables
      DELAYTEMP    equ    32
      RANDOMSEED    equ    33
      RANDOMSEED_H    equ    34
      SysWaitTemp10US    equ    35

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

      ;Jump to initialisation code when PIC is reset
          ORG    0
          call    INITSYS
          goto    SystemInitialise

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

      ;Interrupt vector
          ORG    4
      ;Various initialisation routines, automatically called by GCBASIC
      SystemInitialise

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

      ;Start of the main program
          movlw    1
          movwf    SysWaitTemp10US
          call    Delay_10US
      BASPROGRAMEND
          sleep
          goto    $

      ;********************************************************************************
      ;Subroutines included in program
      ;********************************************************************************

      Delay_10US
      D10US_START
          movlw    3
          movwf    DELAYTEMP
      D10US_LOOP
          decfsz    DELAYTEMP, F
          goto    D10US_LOOP
          decfsz    SysWaitTemp10US, F
          goto    D10US_START
          return

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

      INITSYS
          bcf    ADCON0,ADON
          banksel    ADCON1
          bcf    ADCON1,ADFM
          banksel    ADCON0
          bcf    ADCON0,ADON
          banksel    ADCON1
          bcf    ADCON1,PCFG3
          bsf    ADCON1,PCFG2
          bsf    ADCON1,PCFG1
          bcf    ADCON1,PCFG0
          banksel    PORTA
          clrf    PORTA
          clrf    PORTB
          clrf    PORTC
          clrf    PORTD
          clrf    PORTE
          return

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

      END

       
    • kent_twt4

      kent_twt4 - 2009-02-16

      Open MPASM up, and make sure the "case sensitive" box is unchecked.

       
      • Charles Patton

        Charles Patton - 2009-02-16

        Kent,
        Thanks, I was looking for that "case" switch and missed it.  Your answer sent me back looking for it and found it this time.  Works like a charm.

         
  • Pawan sethi

    Pawan sethi - 2010-11-16

    hi ! I am Pawan from India. I have the similar problem ,even with the latest version. have you discovered any solution to the same

     
  • Pawan sethi

    Pawan sethi - 2010-11-16

    kent, just read your reply .it works now. Thanks a lot.

     

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.