Menu

Reserved words?

Help
2009-02-18
2013-05-30
  • Edward LaBudde

    Edward LaBudde - 2009-02-18

    Hi all, newbie again.  I am working on a PID controller to better learn A-D and PWM usage.

    I put in the following equation; error = command-response

    I get the following error
    compiled.asm:25:Error [103] syntax error
    compiled.asm:110:Error [113] Symbol not previously defined (ERROR).

    If I change it to errorx = command-response, it complies ok!

    Is this a reseved word? are there others?

    Thanks, Ed.

     
    • Santiago

      Santiago - 2009-02-18

      Hi Ed, you are right.

      I don't know every "reserved" word of the compiler, but any name of the PIC registers should not be used for a variable name, for example: PORTA should not be used for a variable name as it is a PIC's register name, if you use it the compiler thinks that you want to change PORTA values...

      There are many other registers in every PIC, for example: trisa, trisb,  status, c, z, pcl, pclatch, fsr, indf, option_reg (option), tmr0, pie1, pir1, pcon, intcon.... and many others.

      GCBasic even use the bit-level names of some registers for exmple: gie, peie, tmr0ie, inte, rbie, tmr0if, intf, rbif ; are bits of the intcon register.

      When you work with a PIC is a good thing to have an idea of how it works, what are the registers it uses and how they work; when you know one PIC there are many common things with other PICs and you know there are some names is not good to try... for example all the interrupt flags are this kind: rbif,  tmr0if, adif, txif, rcif.. that's all are Interrupt Flags: somethingIF... then is not good idea having a variable finished in "if" when you don't know evry interrupt flag name in the PIC.

      Then is a good idea to have a look to the datasheet of the PIC... and start a frienship with it... :)

      In the datasheet you can find how the PIC works, what are the registers involved in every action, the electrical aspects, etc... you even have the instrucction set of the ASM languaje and how they work.

      The datasheet of your PIC should be your best friend when programming.

      Greetings.

       
    • kent_twt4

      kent_twt4 - 2009-02-18

      Ed, just to add what Santiago said, there are many traps for variable keywords.  For that reason, I usually try and think of unique variable name, not likely to be used by the compiler, or include folders.  I think somewhere, a help file warns against short (e.g. t, xt, pwm, etc.) variable names.  Even so, somewhere along the line using a reserved variable name will bite me.

      Some sources of keywords would be the GCBasic.key file and the chipdata files.  Others may be included in the, lowlevel include folders ,GCBasic.bas, and the *.bi files.  There are loads of variables, and not sure which ones, if any, are relevant.

       
    • Santiago

      Santiago - 2009-02-18

      I think a good choice is using long and descriptive variables, like:

      light_level

      transmit_error

      measured_freq

      readed_value

       
    • Edward LaBudde

      Edward LaBudde - 2009-02-19

      Thanks, much Santiago and Kent.  Wil take note
      Regards, 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.