It looks like you have registered but you have not yet posted and
messages. Our requirements are that you must post at least two
messages, to allow the moderators to review your registration, before
you will be allowed access to the full range of forum areas.

Please make a couple of posts, until then you may see a notice that
says you are banned from certain forum areas.

Presetting Configuration Fuses (PIC Defines) into your Program

1. What are the Configuration Fuses?
2. How can I preset them in my Program?
2.a. When using MeLabs default (PM) Assembler
2.b. When using Microchip's (MPASM) Assembler
3. Where can I find a List of the Configuration Definitions?
3.a. When using MeLabs default (PM) Assembler
3.b. When using Microchip's (MPASM) Assembler

1. What are the Configuration Fuses?

The Configuration Fuses (Configuration Bits) are the settings that configure the PIC for the external environment it is expecting to find... typical settings include Oscillator Type, MCLR pin usage, Code Protection, Brown-Out and Watchdog Timer usage, Low Voltage Programming etc. Different families of PICs have different settings, so the list of settings for a 12F675, will not be the same as the list for a 16F877. When you LOAD a program into your programmer, these settings appropriately configure it without you having to make any additional changes. This saves you a lot of time messing with minor settings before you hit the 'Program' Button. Remember though, you are still able to over-ride these setting manually prior to programming your chip. Most programmers will only configure the settings to your compiled defaults when you LOAD the program, so if you change them manually, you will need to RELOAD your program for them to revert to the default (compiled) settings.

2. How can I preset them in my Program?

This very much depends on if you are using MeLabs default (PM) Assembler, or Microchips (MPASM) alternative.

2.a. When using MeLabs default (PM) Assembler

Example: To set the PIC for XT Oscillator...

@ DEVICE XT_OSC

or

@ DEVICE PIC16F628,XT_OSC

The PIC type is optional, if it is included and you accidentally compile for a chip other than that specified (a 16F628 in this example), the compiler will report an error as a reminder you're potentially doing something wrong.

Multiple definitions are entered on separate lines, one line per definition and can be interspersed with comments…

Now you’ll have noticed that my multiple example for PM and MPASM above are for the same configuration settings (they are now, they weren't when first posted!) - you’ll notice however that there are differences… MCLR_OFF in PM becomes MCLRE_OFF when using MPASM… Here’s how you find the list of possible options available to you… whether you chose to use the default PM or the option of the MPASM Assembler, cross-reference your choices with your chosen PICs Datasheet, look in the section entitled “Special Features of the CPU”. Some configurations may be listed under multiple names, the little extra being provided for your convenience.

3.a. When using MeLabs default (PM) Assembler

Open up the PBP directory, and in it you will find an INC subdirectory. Opening that up and you'll see a heap of files. Find the Mxxxx.INC file for the PIC you're interested in... (example M12F675.INC). If you can’t locate your exact PIC, it might be listed under a family of PICs that share the same settings (example chose M16F62X.INC if you need the settings for a 16F628). Open the file up with something like Notepad – (don’t make any changes to it) and have a look what the file contains…It reveals the internal sex life of the PIC. All the Configuration Fuse Defines that you can use from within PBP are listed here at the top, and lower down all the Registers are Listed. If it's not in the list, you can't use it - but trust me, it's usually all there. Remember, this list is for use with the PM (default assembler).

3.b. When using Microchip's (MPASM) Assembler

If you're going to use MPASM, look for the appropriate file (example for a 16F628 look for P16F628.INC) located in something like the MCHIP_Tools subdirectory of your MPLAB installation. Here you’ll find the Configuration Bits located near the bottom of the list. Simply just use the ones you want. Hey presto your PIC is all defined and ready to run.

IC-Prog also stores the chip name in the saved HEX file. You can use this option to automaticly set the device by openening its file. Use option "Select device from file" on Misc. page.

And actually... After reading the more closly I guess it means ICPROG stores it there.... (?)

They ARE stored in the HEX file, because that's what you load your programmer with and those definitions are embedded in your compiled file. I have not had the urge to tear apart a HEX file so can't answer your question on where exactly that information is located within it. - Melanie

So in PBC NOT pro there is no @ DEVICE command so I assume there is another way to set fuses and pin defaults or is it only done in the programmer itself?

Further if you did MCLR_OFF are you telling the chip not to look for 5 volts on start up?

Thanks,

Bart

I don't have PBC so can't answer your question regarding it. One day I'll go and get myself a copy just for the fun of it. With MCLR_OFF, the PIC handles it's Power-On RESET internally allowing you to use that pin for other purposes. - Melanie

What to do if i get "overwriting previous address content" error message?

This error is return by PBP because your configuration fuse overwrite 'PBP default'. If you open with notepad, in PBP directory, the .INC file of your PIC, let's say 16F628, the file will look like this

Once again you are my savior
Thanks alot for always helping me and guiding me in the right direction. your advice worked perfectly and i got the overwrite error which i see from your other post how to handle that.

Warning[230] __CONFIG has been deprecated for PIC18 devices.

If you are using any PIC18 serie, you will have this warning one day or another. Our friends from Microchip decide to change the way to define the config fuses when using the latest MPASM version 5.00.

The solution is still located at the same place... at the end of the 18XXXX.INC file located in the MPASM folder.

Just to make things clear for everybody. My solution work!!! As i said in my previous post don't forget to comment the PBP default fuse wich are located in the PBP folder in the according .INC file as Tissy found. So after the modification, Tissy's .INC file will looks like

OK, i also have the same problem here.. hum hum when i add some code line as you did.

SO it looks like PicBasic is not "New MPASM Compliant" for the config fuses. I'll contact Charles tomorrow.

For now, what you can do is to place your config fuses in the 18F2550.INC in the PBP folder. BUT if you do different project and you need different config fuse setting, You can add a device to the MCS list and create a new .INC and .BAS file for it. OR do an include file to be loaded in the 18F2550.INC file.

Warning[230]c:\...\..:__CONFIG has been deprecated for PIC1

Thanks for that. I thought i was going mad !! Theres nothing worse than people saying it should work when it doesn't. You have save my insanity.

I think the .CFG approach is a good solution.

Many thanks,

Steve

hi,
i also facing similar problem if i try to compile programe on 18f452 i get the similar message like:
Warning[230]c:\develo~1\susdco~1\rfusb~1.asm 67:__CONFIG has been deprecated for PIC18 devices. Use directive CONFIG.
i am using pbp2.44 with mpasm7.21.
I tried to rectify the problems with the above directives but fail should i go for the other version of mplab
pl. help
thanks

Well, I was finally forced to upgrade MPASM. And along with it came the dreaded __CONFIG has been deprecated warning. So I figured .. No problem, these guys have already figured it out.

But after trying everything out, and having to modify include files in the include files each time I compile a program that needs a different config, espescially when my programs already have all the config statements in them, just wasn't working out very well. And the thought of having to modify every program I've ever written, to use the new Config syntax, was leaving a bad taste in my mouth.

Fortunately, the old __CONFIG directives still work. The __CONFIG has been deprecated warning, is just that. A warning. And Warnings can be turned off. So until Microchip decides to make it not work anymore, what I'm doing is to add this line to the .inc file for the chip it's being compiled for.

Code:

errorlevel -230

Then everything works just like it always has.

Last edited by Darrel Taylor; - 8th April 2006 at 02:23.
Reason: P.S. - My MPASM version is now 5.02

Then after trying to implement those ideas, I find that it's just not worth it.

I prefer the configuration methods as laid out in your original posts in this thread. The way that it's always been, and the way my programs are already written. And, since there's currently NO reason to use the new syntax, I wanted everyone to know that they don't have to go thru what I just went through.

I agree... (tried them today) the new statements don't appear to work (yet!) in many cases (Warning is replaced... by Error 122... although when I've a spare moment I'll try to find out why), and I'm continuing to use the old method too.

************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************

Even I try this :
@ DEVICE pic16F628, INTRC_IO
the message is still : Undefined symbol 'INTRC_IO' .
All the others line
@ DEVICE pic16F628, WDT_OFF
@ DEVICE pic16F628, PWRT_OFF.... are OK. Just the first one give me error !!!