PDA

View Full Version : what's wrong with this line



queenidog
- 4th January 2012, 21:13
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...

HenrikOlsson
- 4th January 2012, 21:26
Hi,
There should be two underscore infront of the CONFIG, like:

#CONFIG
__CONFIG _INTRC_OSC_NOCLKOUT &_WDT_OFF & _LVP_OFF & _CP_OFF
#ENDCONFIG

/Henrik.

l_gaminde
- 4th January 2012, 21:30
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 http://www.picbasic.co.uk/forum/images/misc/unknown.gif (http://www.picbasic.co.uk/forum/member.php?u=1695) HenrikOlsson

said and fix the problem good catch

(http://www.picbasic.co.uk/forum/member.php?u=1695)

queenidog
- 5th January 2012, 13:58
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!

HenrikOlsson
- 5th January 2012, 15:46
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.

queenidog
- 6th January 2012, 00:14
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.