what's wrong with this line


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108

    Default what's wrong with this line

    I'm trying to use someone else's assembler code for a project and managed to get 55 compile errors down to one; the following errors out with "illegal opcode":

    #config
    _CONFIG _INTRC_OSC_NOCLKOUT &_WDT_OFF & _LVP_OFF & _CP_OFF
    #endconfig


    this is for a 16F628A MCU. If I take out the _INTRC_OSC_NOCLKOUT, then it errors on the next configuration bit.

    I'm using PBP3.0 and the MPASM assembler (I think).

    _INTRC_OSC_NOCLKOUT is not in the PBP inc file, but it is in the MSPASM inc file. Both have the WDT and LVP bits.

    I'm new at this...

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: what's wrong with this line

    Hi,
    There should be two underscore infront of the CONFIG, like:
    Code:
    #CONFIG
    __CONFIG _INTRC_OSC_NOCLKOUT &_WDT_OFF & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    /Henrik.

  3. #3
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Re: what's wrong with this line

    are you using mplab ?
    I also had problems with the config
    did you comment out in the config file?
    sorry for the crappy answers but I have been away from PBP for quite a while.
    in mplab you can set up the config file manually

    or you could do what HenrikOlsson

    said and fix the problem good catch

    Last edited by l_gaminde; - 4th January 2012 at 21:33.

  4. #4
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: what's wrong with this line

    That was the problem!

    I understand syntax is always something important to consider and can deal with UC and LC, commas, and other punctuation, but putting two underscores (__) together as a lead qualifier is really dumb, I think. Talk about ambiguity. Couldn't MeLabs have used a more obvious element like the @ symbol, or the #, or even only ONE underscore? (I don't use C and Pascal because of the syntax rules.)

    Sorry don't mean to gripe but a little issue like that had me tied up for 2 hours trying to research the issue before asking for some help. Thanks Henrik.

    You can bet I won't have this error again!

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: what's wrong with this line

    Hi,
    I'm glad you got it going!
    In this case I don't think it's fair to blame MELABS though. The #CONFIG tells PBP to pass what ever is between it and the #ENDCONFIG directly to the assembler instead of the default configuration for the particular device you're compiling for. So, it's really the MPASM syntax and therefor Microchip you should blame ;-)

    Apart from that I agree, questions/problems regarding the configs are very common around here. MELABS actually made A LOT better when introducing the #CONFIG / #ENDCONFIG directive since you no longer have to edit the default, stock include files for the device.

    Finally, if you look in the Device_Reference folder in you PBP3 folder you'll find a file for each device, it contains all the CONFIG options for that particular device.

    /Henrik.

  6. #6
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: what's wrong with this line

    You're correct, it isn't MeLabs "fault" since it is Microchip's assembler. I'm sure they had a reason for putting in the two underscores.

    I love MeLab. They have a great product and super service, especially from Darrel Taylor. I have convinced two of my buddies to buy the MeLab development system, that's how much I believe in the product.

    I did more reading, including the MPASM assembler manual and now ALL OVER THE PLACE I read about the "double-underscore"!

    Thanks again.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts