PDA

View Full Version : Presetting Configuration Fuses (PIC Defines) into your Program



Melanie
- 12th July 2004, 16:57
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…

Example: Typical Settings for a 16F628…

@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628, WDT_ON
' Watchdog Timer
@ DEVICE pic16F628, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628, CPD_ON
' Data Memory Code Protect
' Set to CPD_OFF for Development Copy
' Set to CPD_ON for Release Copy
@ DEVICE pic16F628, PROTECT_ON
' Program Code Protection
' Set to PROTECT_OFF for Development Copy
' Set to PROTECT_ON for Release Copy


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

Example: To set the PIC for Internal Oscillator allowing use of the OSC pins as I/O...

@ __config _INTRC_OSC_NOCLKOUT

Only one config statement is allowed when using MPASM, so multiple definitions follow-on from each other each connected to it’s previous buddy with an &.

Example: Typical Settings for a 16F628…

@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF & _CP_ALL & _DATA_CP_ON


3. Where can I find a List of the Configuration Definitions?

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.

Melanie


Edit from Moderator:
A Wiki for this thread has been created, making a somewhat condensed version of this thread. It is located here: http://www.picbasic.co.uk/forum/content.php?r=157-Presetting-Configuration-Fuses-%28PIC-Defines%29-into-your-Program

bearpawz
- 7th November 2004, 04:14
O.K., Now is there a way to set the device in the hex file?

Here is what I am using for a "system"

- Picbasic Pro ver 2.44 to compile ....
- Microcode Studio 2.0.1.6
- For programming: ICPROG 1.05C

... The docs for ICPROG 1.05 C says:

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

bartman
- 9th November 2004, 17:16
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

Acetronics2
- 5th March 2005, 14:28
Hi, Mel ...

There's a little problem in that using MPLAB ( 7.01 ) and Picstart ...

When compiling ( PM or MPASM ), everything seems to go pretty well, except this "double definition error"
You can program the chip ... yesss ...wonderful !!!

BUT ... the corresponding HEX file is never stored on your Hard Disk !!!

Rather difficult to send the hex file to poor waiting friends.

as it is impossible to cancel the error message ...Do you have a solution ???

I just want to set OSC to HS ( in PbPlibs, it's Ok but boring ,I know.) and PWRTE to ON ( Where to find it ? )

Alain

mister_e
- 5th March 2005, 18:55
O.K. This is ask really often. Worth to be discussed NOW!

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


;************************************************* *************
;* 16F628.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2002 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 09/27/02 *
;* Version : 2.43 *
;* Notes : *
;************************************************* *************
NOLIST
ifdef PM_USED
LIST
include 'M16F62x.INC' ; PM header
device pic16F628, xt_osc, wdt_on, pwrt_on, mclr_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F628, r = dec, w = -302
INCLUDE "P16F628.INC" ; MPASM Header
__config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
LIST

So if you try to define HS oscillator, wich is already define, you'll overwrite the previous content of the PBP setting.

To fix it, just comment those lines :

;device pic16F628, xt_osc, wdt_on, pwrt_on, mclr_on, lvp_off, protect_off

OR

;__config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
depending what you are using to compile your code, MPASM or PM.

OR some will prefer to edit those line directly... as you wish...

Where can i find the configuration fuse for my PIC ?


All the configuration fuse are in the according .INC file located in the MPLAB directory. In MPLAB 7.01, the default directory, i suppose, is C:\Program Files\Microchip\MPASM Suite.

If you open the appropriate .INC file, you will find all the configuration fuse for your PIC at the end of the file.

looks like this for a 16F628...only the end

;================================================= =========================
;
; Configuration Bits
;
;================================================= =========================

_BODEN_ON EQU H'3FFF'
_BODEN_OFF EQU H'3FBF'
_CP_ALL EQU H'03FF'
_CP_75 EQU H'17FF'
_CP_50 EQU H'2BFF'
_CP_OFF EQU H'3FFF'
_DATA_CP_ON EQU H'3EFF'
_DATA_CP_OFF EQU H'3FFF'
_PWRTE_OFF EQU H'3FFF'
_PWRTE_ON EQU H'3FF7'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_LVP_ON EQU H'3FFF'
_LVP_OFF EQU H'3F7F'
_MCLRE_ON EQU H'3FFF'
_MCLRE_OFF EQU H'3FDF'
_ER_OSC_CLKOUT EQU H'3FFF'
_ER_OSC_NOCLKOUT EQU H'3FFE'
_INTRC_OSC_CLKOUT EQU H'3FFD'
_INTRC_OSC_NOCLKOUT EQU H'3FFC'
_EXTCLK_OSC EQU H'3FEF'
_LP_OSC EQU H'3FEC'
_XT_OSC EQU H'3FED'
_HS_OSC EQU H'3FEE'

LIST

Acetronics2
- 6th March 2005, 09:05
Hi,Steve

Thank you for the answer, I finally found what I was looking for : in the M16F84.inc,and others .inc all the values do not appear !!!
So, I simply had to add them ...

My question was more about how to have the Hex file written on the HDD ...
as it appears in the program window and can be downloaded to the Pic.

IF this stupid uncancellable error message was only a Warning things would be so simpler !!! ( errorlevel - ... etc )

So, I ask it again : is there something reasonnably possible to memorize the content of the program window ??? ( yeah, write it on a paper .... Thanks !!! )

Mhhh ... fore core calculation, have a look here :
http://www.epcos.com/web/generator/Web/Sections/DesignTools/Ferrites/Page__License,templateId=render,locale=en.html

read you soon
Have a nice Sunday

Alain

RUBiksCUbe
- 28th June 2005, 21:58
Oh yeah! Got it working!! I needed to put in the PIC defines in the beginning. It was giving me those errors because I didn't need the line:

@ INCLUDE "P18F252.INC" ; MPASM Header

I'm not sure why I dont need it, but I think its because 18F252.INC has an identical line in it, so I was including it twice. Thanks soooo much!!!:)

eoasap
- 29th October 2005, 15:41
Hi, i'm using the 18F452 chip so required to use MPASM compiler through Picbasic.
if i try to set a fuse using ONLY (for example) the line below

@ __config _LVP_OFF

i get this error:
x.asm 112: symbol not previously defined (_LVP_OFF)
x.asm 112: argument out of range (not a valid config register address)



if i put the following code:
@ INCLUDE "P18F452.INC" ; MPASM Header
@ __config _LVP_OFF

i get errors like the following:
'1042: duplicate label ("DDRA" or redefining symbol that cannot be redefined)
1607: superseding current maximum RAM and RAM map
120: symbol not previously defined (_LVP_OFF)
etc..

i've been trying for a while now with no luck setting the fuses. any ideas what i'm doing wrong?

thanks!

mister_e
- 29th October 2005, 16:22
The 18F serie work different from the other. In the MPASM directory open the according .INC file. Look at the end you'll discover how to use the Config directive.

Free example here...


@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
' Oscillator switch OFF
' Use HS oscillator (20MHZ here)
'
@ __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L
' Brown out reset ON @ 4.5Volts
' Power-up timer ON
'
@ __CONFIG _CONFIG2H, _WDT_ON_2H
' Watch dog timer ON
'
@ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
' Stack over/underflow ON
' Low Voltage programming OFF
' Background debugger OFF

eoasap
- 29th October 2005, 16:45
Steve,

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.

Thanks so much :)

mister_e
- 29th October 2005, 17:26
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.



; IMPORTANT: For the PIC18 devices, the __CONFIG directive has been
; superseded by the CONFIG directive. The following settings
; are available for this device.
;
; Oscillator Selection:
; OSC = LP LP
; OSC = XT XT
; OSC = HS HS
; OSC = RC RC
; OSC = EC EC-OSC2 as Clock Out
; OSC = ECIO EC-OSC2 as RA6
; OSC = HSPLL HS-PLL Enabled
; OSC = RCIO RC-OSC2 as RA6

SO now the new method to set the config fuse on the PIC18 serie is...


@ CONFIG OSCS=OFF, OSC=HS
' Oscillator switch OFF
' Use HS oscillator (20MHZ here)
'
@ CONFIG BOR=ON, PWRT=ON, BORV=45
' Brown out reset ON @ 4.5Volts
' Power-up timer ON
'
@ CONFIG WDT=ON
' Watch dog timer ON
'
@ CONFIG STVR=ON, LVP=OFF, DEBUG=OFF
' Stack over/underflow ON
' Low Voltage programming OFF
' Background debugger OFF


Or if you prefer...


ASM
CONFIG OSCS=OFF ; Oscillator switch OFF
CONFIG OSC=HS ; Use HS oscillator (20MHZ here)
CONFIG BOR=ON ; Brown out reset ON
CONFIG BORV=45 ; Brown out detect voltage=4.5 Volt
CONFIG PWRT=ON ; Power-up timer ON
CONFIG WDT=ON ; Watch dog timer ON
CONFIG STVR=ON ; Stack over/underflow ON
CONFIG LVP=OFF ; Low Voltage programming OFF
CONFIG DEBUG=OFF ; Background debugger OFF
ENDASM

Don't forget to comment the default PBP config fuses...

Tissy
- 29th October 2005, 23:11
Nope can't get it going !!

I've used


@ CONFIG FOSC = HS

but it returns the error

__CONFIG directives cannot be used with CONFIG directives

I've even tried


@ CONFIG _CONFIG1H, _FOSC_HS_1H

which returns the same error as above and also,


@ __CONFIG _CONFIG1H, _FOSC_HS_1H

which returns two errors stating:
Overwriting previous address contents (0000)
Overwriting previous address contents (0001)

Any ideas?

eoasap
- 30th October 2005, 00:03
tissy, i just got the same thing you did. That's too bad because Steve's code looks so neat and orderly :) i personally would rather not use all the underscores and such.

Tissy
- 30th October 2005, 01:11
Right, i think i've figured this out.

You need to find the 18F2550.INC (or whatever device you are using) in the PicBasic Pro installation directory.

When you open that file it should look something like this:


;************************************************* ***************
;* 18F2550.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 12/31/04 *
;* Version : 2.46 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F2550, r = dec, w = -311, f = inhx32
INCLUDE "P18F2550.INC" ; MPASM Header
__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_HS_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32

This is effectivly where you modify the fuses. The fuse definitions are contained within the P18F2550.INC as contained within your MPASMWIN directory.

*** Note: My advice would be to back any files up before any modifications ***

Hope this clears things up, it worked for me in the end. Now all the fuses are set without the need for modification each time.

Steve

mister_e
- 30th October 2005, 01:47
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


;************************************************* ***************
;* 18F2550.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 12/31/04 *
;* Version : 2.46 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F2550, r = dec, w = -311, f = inhx32
INCLUDE "P18F2550.INC" ; MPASM Header
;__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
;__CONFIG _CONFIG1H, _FOSC_HS_1H
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
;__CONFIG _CONFIG3H, _PBADEN_OFF_3H
;__CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32


If you don't comment the default fuses... you'll always have this Warning message + another like overwriting previous content..

Also be sure you have the latest MPASM version. 5.00 as now.

About now?

Tissy
- 30th October 2005, 02:09
Yup, that cleared it up, thank you.

Also where can i download MPASM ver 5.00. I've looked at Microchips site but can't find the link. Do you have it by chance?

Thanks again,

Steve

Tissy
- 30th October 2005, 02:36
I had it all going in version 4.01 of MPASM and then downloaded version 5.00....big mistake !!

Now i am getting all sorts of errors. If i use no config fuses in the code and set them manually all compiles fine, but when i try and set the fuses, errors occur again.

I have done what is suggested above and commented out the necessary lines in the 18F2550.INC file found in the PBP directory.

Any suggestions?

Tissy
- 30th October 2005, 02:59
Sorry, to clarify, it does seem to compile, but i get this error:

Warning[230]c:\develo~1\susdco~1\rfusb~1.asm 67:__CONFIG has been deprecated for PIC18 devices. Use directive CONFIG.

This error is repeated a number of times.

Melanie
- 30th October 2005, 09:48
http://www.picbasic.co.uk/forum/showthread.php?p=13087#post13087

Tissy
- 30th October 2005, 11:24
Nope, still getting stacks of errors.

Here is exactly what i have at the tope of my code:


' ---------- [ Configuration fuse ] ----------
@ CONFIG PLLDIV = 5, CPUDIV = OSC1_PLL2, USBDIV = 2
@ CONFIG FOSC = HS
@ CONFIG WDT = ON, WDTPS = 128
@ CONFIG PBADEN = OFF
@ CONFIG LVP = OFF, ICPRT = OFF, XINST = OFF

'@ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
'@ __CONFIG _CONFIG1H, _FOSC_HS_1H
'@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
'@ __CONFIG _CONFIG3H, _PBADEN_OFF_3H
'@ __CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L


Clear
DEFINE OSC 20

The necessary lines are commented out in the .INC file as suggested.

The .INC file in the MPASM directory is untouched.

Any other ideas?

mister_e
- 30th October 2005, 12:01
Tissy... are you saying that modifying and saving your C:\PBP\18F2550.INC as follow


;************************************************* ***************
;* 18F2550.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 12/31/04 *
;* Version : 2.46 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F2550, r = dec, w = -311, f = inhx32
INCLUDE "P18F2550.INC" ; MPASM Header
;__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
;__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
;__CONFIG _CONFIG3H, _PBADEN_OFF_3H
;__CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32


And use the following fuse setting...


asm
CONFIG PLLDIV = 12 ; 96 MHz PLL Prescaler: Divide by 12 (48 MHz input)
CONFIG CPUDIV = OSC1_PLL2 ; System Clock Postscaler: [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
CONFIG USBDIV = 2 ; Full-Speed USB Clock Source: 96 MHz PLL/2 ;
CONFIG FOSC = HS ; HS oscillator, HS used by USB
CONFIG FCMEM = ON ; Fail-Safe Clock Monitor enabled
CONFIG IESO = OFF ; Internal/External Switch Over Disabled
CONFIG PWRT = ON ; Power-up Timer enabled
CONFIG BOR = ON_ACTIVE ; Brown-out Reset Enabled when the device is not
CONFIG BORV = 43 ; Brown-out Voltage: 4.3V
CONFIG VREGEN = ON ; USB Voltage Regulator Enabled
CONFIG WDT = ON ; Watchdog timer = HW Enabled - SW Disabled
CONFIG WDTPS = 128 ; Watchdog Postscaler = 1:128
CONFIG MCLRE = ON ; MCLR Enabled
CONFIG LPT1OSC = OFF ; Timer1 oscillator configured for high power
CONFIG PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset
CONFIG CCP2MX = OFF ; CCP2 input/output is multiplexed with RB3
CONFIG STVREN = OFF ; Stack Overflow Reset Disabled
CONFIG LVP = OFF ; Low Voltage Programming Disabled
CONFIG ICPRT = OFF ; In-Circuit Debug/Programming Disabled
CONFIG XINST = ON ; Extended Instruction Set Enabled
CONFIG DEBUG = OFF ; Background Debugger Disabled
CONFIG CP0 = OFF ; Code Protection Block 0 Disabled
CONFIG CP1 = OFF ; Code Protection Block 1 Disabled
CONFIG CP2 = OFF ; Code Protection Block 2 Disabled
CONFIG CP3 = OFF ; Code Protection Block 3 Disabled
CONFIG CPB = OFF ; Boot Block Code Protection Disabled
CONFIG CPD = OFF ; Data EEPROM Code Protection Disabled
CONFIG WRT0 = OFF ; Write Protection Block 0 Disabled
CONFIG WRT1 = OFF ; Write Protection Block 1 Disabled
CONFIG WRT2 = OFF ; Write Protection Block 2 Disabled
CONFIG WRT3 = OFF ; Write Protection Block 3 Disabled
CONFIG WRTB = OFF ; Boot Block Write Protection Disabled
CONFIG WRTC = OFF ; Configuration Register Write Protection Disabled
CONFIG WRTD = OFF ; Data EEPROM Write Protection Disabled
CONFIG EBTR0 = OFF ; Table Read Protection Block 0 Disabled
CONFIG EBTR1 = OFF ; Table Read Protection Block 1 Disabled
CONFIG EBTR2 = OFF ; Table Read Protection Block 2 Disabled
CONFIG EBTR3 = OFF ; Table Read Protection Block 3 Disabled
CONFIG EBTRB = OFF ; Boot Block Table Read Protection Disabled
ENDASM


it works here...

Tissy
- 30th October 2005, 12:10
Yup, affraid so. I have just comapared the .INC file to yours, exactly the same.

I have also copied your ASM section to my code and it still produces a stack of errors.

Any suggestions?

mister_e
- 30th October 2005, 14:14
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.


NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F2550, r = dec, w = -311, f = inhx32
INCLUDE "P18F2550.INC" ; MPASM Header
INCLUDE "C:\PBPProg\ConfigFuse.cfg" ; Your Config Fuses
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32


Just drop your config lines in the ConfigFuse.cfg file and it's work... this time. DOH sorry.

Tissy
- 30th October 2005, 15:20
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

pramodsinha
- 30th October 2005, 15:55
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

Tissy
- 31st October 2005, 00:54
Havin gtaken the .CFG route, Steve does yours come up with these errors?


Warning[205] c:\pbp\sdcconfigfuse.cfg 1 : Found directive in column 1. (CONFIG)
Warning[205] c:\pbp\sdcconfigfuse.cfg 2 : Found directive in column 1. (CONFIG)
Warning[205] c:\pbp\sdcconfigfuse.cfg 3 : Found directive in column 1. (CONFIG)
Warning[205] c:\pbp\sdcconfigfuse.cfg 4 : Found directive in column 1. (CONFIG)
Warning[205] c:\pbp\sdcconfigfuse.cfg 5 : Found directive in column 1. (CONFIG)


Could you post your .CFG file?

Cheers

mister_e
- 31st October 2005, 08:18
The CFG file is the one i post few post before. You just need to Indent your CONFIG lines as i did.

Tissy
- 31st October 2005, 19:33
Yup, got that now, thanks.

One fuse that doesn't work is

BOREN = SBORDIS

But the fuse settings in the .INC are

; Brown-out Reset:
; BOREN = OFF Disabled
; BOREN = ON SBOREN Enabled
; BOREN = NOSLP Enabled except Sleep, SBOREN Disabled
; BOREN = SBORDIS Enabled, SBOREN Disabled

So obvioulsy not all is compatible between, PBP and MPASM.

Out of interest can you try this fuse on your configuration.

Cheers.

Darrel Taylor
- 8th April 2006, 02:01
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. &nbsp; A warning. &nbsp; And Warnings can be turned off. &nbsp; 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.
errorlevel -230Then everything works just like it always has.
<br>

Melanie
- 8th April 2006, 08:00
Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG.

If using 18F Parts...

Check this answer by Bruce...

http://www.picbasic.co.uk/forum/showthread.php?p=13087

... if you're not using 18F Parts and you're getting this message - you're in deep trouble.

Darrel Taylor
- 8th April 2006, 23:35
Hi Melanie,

I've read Bruce's post, I've read Mr.E's posts and I've read everyone else's posts about having problems using the new CONFIG syntax.

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.

Simply turn off the warnings, and forget about it. (for now)
<br>

Melanie
- 9th April 2006, 10:42
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.

vaidyasp1
- 27th April 2006, 03:43
I am really confused from the thread. It has many different approaches. I am using picbasic pro 2.45 and Mpasm of mplab v7.22. I get the same error.

:__CONFIG has been deprecated for PIC18 devices. Use directive CONFIG.

So, how can i set my configuration bits??? I am using 18f4520.

paul borgmeier
- 2nd July 2006, 14:36
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? ...
PIC BASIC COMPILER USERS (PBC), see this thread for some options on presetting fuses

http://www.picbasic.co.uk/forum/showthread.php?t=4158

(don't let the name of the thread fool you, what you want is toward the bottom)

Paul Borgmeier
Salt Lake City, Utah
USA

dhouston
- 2nd July 2006, 15:36
To save reading the thread Paul cited, this syntax (case insensitive) works with both PBC and PBP when using PM.

asm
DEVICE PIC12F629, INTRC_OSC_NOCLKOUT ;4MHz INT OSC
DEVICE PIC12F629, WDT_OFF ;WATCHDOG
DEVICE PIC12F629, PWRT_ON ;POWER ON TIMER
DEVICE PIC12F629, MCLR_OFF ;GPIO.3 = INPUT
DEVICE PIC12F629, BOD_ON ;BROWNOUT RESET
DEVICE PIC12F629, PROTECT_OFF ;CODE PROTECT
DEVICE PIC12F629, CPD_OFF ;EEPROM PROTECT
endasm

fratello
- 21st April 2009, 08:54
Hi to all !
I use 16F628A in one project ; I try this codes :
@ DEVICE pic16F628A, INTRC_IO, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_OFF, LVP_OFF, CPD_OFF, PROTECT_OFF 'VAR 1


'asm 'VAR 2
' DEVICE PIC16F628A, INTRC_IO
' DEVICE PIC16F628A, WDT_OFF ;WATCHDOG
' DEVICE PIC16F628A, PWRT_OFF ;POWER ON TIMER
' DEVICE PIC16F628A, MCLR_OFF ;GPIO.3 = INPUT
' DEVICE PIC16F628A, BOD_FF ;BROWNOUT RESET
' DEVICE PIC16F628A, PROTECT_OFF ;CODE PROTECT
' DEVICE PIC16F628A, CPD_OFF ;EEPROM PROTECT
'endasm

but no one don't work ! I receive the message : "Undefined Symbol 'INTRC_IO'".
Please help ! Thanks in advance !

Acetronics2
- 21st April 2009, 09:36
Hi, Fratello

Did you had a look to the VERY first post of that thread ???

just " cut and paste " needed !!!

Alain

fratello
- 21st April 2009, 09:50
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 !!!

fratello
- 21st April 2009, 12:01
The correct syntax is :
INTOSC_OSC and not INTRC_IO ! I read in M16F62xA.INC.
Thanks !

quantum
- 26th April 2009, 07:31
Hi
I tried PBP with MPLAB. But there is a problem. HEX file is not becoming. Why?
This is error

OUTPUT

Executing: "C:\PBP246\PBPW.exe" -ampasmwin -oq -z -p12F675 "rew.bas"
PicBasic Pro Compiler 2.46, (c) 1998, 2005 microEngineering Labs, Inc.
All Rights Reserved.
Warning[207] C:\DOCUMENTS AND SETTINGS\ROJHAT\DESKTOP\REW.ASM 78 : Found label after column 1. (device)
Error[122] C:\DOCUMENTS AND SETTINGS\ROJHAT\DESKTOP\REW.ASM 78 : Illegal opcode (pic12F675)
Loaded C:\Documents and Settings\ROJHAT\Desktop\rew.COD.
BUILD SUCCEEDED: Sun Apr 26 09:30:02 2009

wbubel
- 17th July 2009, 16:20
Hello
I am new to this forum, I am a RF Engineer trying to use a 18F1220 with its internal oscillator. So far I have been unsucessfull in doing this. When using MPLAB and a IDC2 in debugger mode the Blink program works fine. When I program the device and run it on its own power it does not work. I think I traced it to the 18f1220.inc file, CONFIG1H fuse.

;************************************************* ***************
;* 18F1220.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 01/27/04 *
;* Version : 2.45 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F1220, r = dec, w = -311, f = inhx32
INCLUDE "P18F1220.INC" ; MPASM Header
__CONFIG _CONFIG1H, _XT_OSC_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8

It sets the oscillator to External. I am not sure what the fuse should be set to. I also beleve the INTRC needs to be reconfigured for 8 MHz. Can anyone assist me? Thank You.

Archangel
- 17th July 2009, 16:34
Hello
I am new to this forum, I am a RF Engineer trying to use a 18F1220 with its internal oscillator. So far I have been unsucessfull in doing this. When using MPLAB and a IDC2 in debugger mode the Blink program works fine. When I program the device and run it on its own power it does not work. I think I traced it to the 18f1220.inc file, CONFIG1H fuse.

;************************************************* ***************
;* 18F1220.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 01/27/04 *
;* Version : 2.45 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F1220, r = dec, w = -311, f = inhx32
INCLUDE "P18F1220.INC" ; MPASM Header
__CONFIG _CONFIG1H, _XT_OSC_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8

It sets the oscillator to External. I am not sure what the fuse should be set to. I also beleve the INTRC needs to be reconfigured for 8 MHz. Can anyone assist me? Thank You.
Hello wbubel, Welcome !
In the MPASM Suite each supported PIC has a file, named for it I. E. P18F1220.inc, in it is listed every valid config and register address. To switch to using MPASM, in MCS click view, compile and program options,click on the tab named assembler, and insert a check in the box "use MPASM", click OK and you are set. Here is what is available for config 1 . . .


;Configuration Byte 1H Options
_IESO_ON_1H EQU H'FF' ; Internal External Oscillator Switch Over mode enabled
_IESO_OFF_1H EQU H'7F' ; Internal External Oscillator Switch Over mode disabled
_FSCM_ON_1H EQU H'FF' ; Fail-Safe Clock Monitor enabled
_FSCM_OFF_1H EQU H'BF' ; Fail-Safe Clock Monitor disabled
_RC_OSC_1H EQU H'FF' ; External RC on OSC1, OSC2 as FOSC/4
_RCIO_OSC_1H EQU H'F7' ; External RC on OSC1, OSC2 as RA6
_LP_OSC_1H EQU H'F0' ; LP Oscillator
_XT_OSC_1H EQU H'F1' ; XT Oscillator
_HS_OSC_1H EQU H'F2' ; HS Oscillator
_HSPLL_OSC_1H EQU H'F6' ; HS + PLL
_EC_OSC_1H EQU H'F4' ; External Clock on OSC1, OSC2 as FOSC/4
_ECIO_OSC_1H EQU H'F5' ; External Clock on OSC1, OSC2 as RA6
_INTIO1_OSC_1H EQU H'F9' ; Internal RC, OSC1 as RA7, OSC2 as FOSC/4
_INTIO2_OSC_1H EQU H'F8' ; Internal RC, OSC1 as RA7, OSC2 as RA6

You can change it in the file you posted or comment them out there and just add the ones you want at the top of your code (my preferred method). Most PICs you use DEFINE OSC 8 , but I won't say all . . .

Bruce
- 17th July 2009, 16:42
_INTIO2_OSC_1H would set it for internal osc with OSC1 & OSC2 pins free to use for I/O.

Look in the P18F1220.INC file in your MPLAB directory for a list of config options.

To select 8MHz internal, look in the 18F1220 data sheet in the Oscillator Configurations
section. It shows the value to write to OSCCON to select various frequencies.

When programming the PIC with the ICD, in inserts a debug kernel, so you may need to
configure the ICD as the programmer before burning the PIC for stand-alone operation.

With the ICD debug kernel programmed into the PIC it needs the PC interface to operate.

wbubel
- 21st July 2009, 14:39
Joe S. and Bruce
Thanks for your valuable help. Sorry its been a while since I've been able to get back to this project. Here is the status. I have set the CONFIG1H fuse to
_INTIO2_OSC_1H as Bruce suggested and OSCCON = %01110000.
I set the ICD as a programmer. When I released the PIC from Reset it runs so slow I thought it was not working. Either I screwed up the OSCCON settings or there is something I am missing.


OSCCON = %01110000 'Define the Osc to 8 MHz
LED2 var PORTB.2 ' LED
cntr var word
FET var PORTA.0
TRISA = %00000000 ' Set PORTA ports 0-4 to input, 5-7 Output
TRISB = %00000000 ' Set PORTB to all output
PORTB = %00000100 ' Clear PORTB
PORTA = %00000000 ' Clear PORTA

cntr = 0
FET = 0

Main:
led2 = 1
pause 100
led2 = 0
pause 100
' cntr = cntr + 1
' if (cntr <= 2) then goto main
' FET = 1
goto main
Stop

Can anyone Help me.

Archangel
- 21st July 2009, 16:18
I set the ICD as a programmer. When I released the PIC from Reset it runs so slow I thought it was not working. Either I screwed up the OSCCON settings or there is something I am missing.

You should compile NOT using ICD COMPILE, use the one which says compile, only use ICD compile to use the ICD, recompile with the COMPILE for stand alone use. Put a
DEFINE OSC 4
or whatever number is right in you code near the top. The PIC is probably running using the fail safe oscillator .

wbubel
- 30th July 2009, 19:19
This piece of code made it work

DEFINE OSC 4 'Define the Osc to 8 MHz

asm
bsf OSCCON, SCS1 ; 1x = Internal Block
bcf OSCCON, SCS0 ; 00 = Primary Oscillator (20Mhz?)
bsf OSCCON, IRCF2 ; 111=8000 110=4000 101=2000
bsf OSCCON, IRCF1 ; 100=1000 011=0500 010=0250
bcf OSCCON, IRCF0 ; 001=0125 000=0032
MSTABLE010 btfss OSCCON, IOFS
bra MSTABLE010 ; wait until Oscillator is stable
endasm

boroko
- 31st July 2009, 03:02
This doesn't directly apply to your situation this time, but I did run into a sneaky change the other day that took me a while to notice..
I was trying to change the oscillator config on a 18F1320. I had been recently using 18F1330s and just assumed they would be the same since they were so close family wise. Bad assumption. Here are the two together.

;************************************************* ***************
;* 18F1330.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 06/05/06 *
;* Version : 2.47 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F1330, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F1330.INC" ; MPASM Header
__CONFIG _CONFIG1H, _OSC_INTIO2_1H
; __CONFIG _CONFIG1H, _OSC_XT_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG4L, _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8

'================================================= =============================
'================================================= =============================

;************************************************* ***************
;* 18F1320.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 06/05/06 *
;* Version : 2.47 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F1320, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F1320.INC" ; MPASM Header
__CONFIG _CONFIG1H, _INTIO2_OSC_1H ; this for INT OSC
; __CONFIG _CONFIG1H, _XT_OSC_1H ;was this for XT OSC
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8


the commented out part was my addition, but notice the different syntax for the oscillator statement.
Just hadn't run into that before.
Bo

boroko
- 29th November 2009, 05:18
Hi all,

I have tried to find where the @MyConfig references were without any success. Anyone have them bookmarked?
I still don't have a good handle on changing these without tweaking the .inc files and I'm afraid that's going to bite me someday (even though I do leave the original lines REM'd).

I have seen @MyConfig used, but don't know if there are any caveats.

Thanks
Bo

Archangel
- 3rd December 2009, 04:57
Hi Bo,
@__Config MyConfig was something Darrel came up with for me, so as to be able to put the config statements on several lines. This was so I could see them without having to scroll across some 100 or so places on the screen. I have MCS set up with large fonts as I have rather poor vision. You still have to comment out the default configs and place the correct configs in your code. It simply allows you to put them on multiple lines. Search for my posts and you will find examples of it's use. If you need examples I can post some Saturday after my new cable internet connection get's hooked up, until then I am not at home while in here.
JS

RussMartin
- 27th January 2010, 04:03
Okay, I've rummaged through the manual, looked at several old threads, and at the "include" files for the device (16F88). I've carefully read through Melanie's post on the subject http://www.picbasic.co.uk/forum/showpost.php?p=2016&postcount=1

Whatever occurs after @_config generates error 122 ("illegal opcode"). It also appears that _INTRC_IO doesn't want to fly. I'm using MPASM.

Maybe I've not found the right thread yet.

<i><b>HELP!</b></i>

Darrel Taylor
- 27th January 2010, 04:54
I don't think it's what's after it, it's the config...

@ __config _CONFIG1, _xxxx
That's @ space two(2) underscores config space "the _CONFIG? word" comma etc...
Only 1 underscore for the config word and options.
<br>

RussMartin
- 27th January 2010, 19:14
Yep, it was the double underscore. Then I commented out the line in the INC file, and everything is peachy-keeno.

Thanks!

brianD
- 9th February 2010, 11:56
HI.

WHAT DO YOU MEAN WITH THE FOLLOWING?

don't forget to comment the PBP default fuse.

mackrackit
- 9th February 2010, 12:51
HI.

WHAT DO YOU MEAN WITH THE FOLLOWING?

don't forget to comment the PBP default fuse.
Did you read the whole thread???

ScaleRobotics
- 15th June 2010, 17:58
So I notice that some 18F chips have the old style configs like CONFIG1H, as well as the new style listed in their chipx.inc file. But other chips, like the 18F26J50 only have the new style, with no CONFIG1H style in the Microchip .inc file for that chip.

I have read the configs have been depreciated posts, where Darrel says ignore the warnings, they are just that ... warnings. However, with newer chips like the PIC18F26J50, is there a way to get around the error:
Error[176]c:\picbasic\26j50-~.asm 101 :CONFIG Directive Error: (setting "48" not found for the processor 18F26J50) ? It seems so close, to only be held up by defining the oscillator!

I get the above error when I try to use :


DEFINE OSC 48
ASM
CONFIG OSC=HSPLL
CONFIG CPUDIV=OSC1
CONFIG PLLDIV=5
CONFIG LPT1OSC=OFF
CONFIG CP0=OFF
CONFIG WDTEN=ON
CONFIG XINST=OFF
CONFIG IOL1WAY=OFF
CONFIG STVREN=OFF
CONFIG T1DIG=ON
CONFIG FCMEN=OFF
CONFIG WDTPS=512
CONFIG RTCOSC=T1OSCREF
ENDASM
If I comment out the DEFINE OSC 48, all appears good. If I try to define the OSC setting, I get the 176 error.

..there are no CONFIG1H's here...



;================================================= =========================
;
; IMPORTANT: For the PIC18 devices, the __CONFIG directive has been
; superseded by the CONFIG directive. The following settings
; are available for this device.
;
; Watchdog Timer:
; WDTEN = OFF Disabled - Controlled by SWDTEN bit
; WDTEN = ON Enabled
;
; PLL Prescaler Selection bits:
; PLLDIV = 12 Divide by 12 (48 MHz oscillator input)
; PLLDIV = 10 Divide by 10 (40 MHz oscillator input)
; PLLDIV = 6 Divide by 6 (24 MHz oscillator input)
; PLLDIV = 5 Divide by 5 (20 MHz oscillator input)
; PLLDIV = 4 Divide by 4 (16 MHz oscillator input)
; PLLDIV = 3 Divide by 3 (12 MHz oscillator input)
; PLLDIV = 2 Divide by 2 (8 MHz oscillator input)
; PLLDIV = 1 No prescale (4 MHz oscillator input drives PLL directly)
;
; Stack Overflow/Underflow Reset :
; STVREN = OFF Disabled
; STVREN = ON Enabled
;
; Extended Instruction Set:
; XINST = OFF Disabled
; XINST = ON Enabled
;
; CPU System Clock Postscaler:
; CPUDIV = OSC4_PLL6 CPU system clock divide by 6
; CPUDIV = OSC3_PLL3 CPU system clock divide by 3
; CPUDIV = OSC2_PLL2 CPU system clock divide by 2
; CPUDIV = OSC1 No CPU system clock divide
;
; Code Protect:
; CP0 = ON Program memory is code-protected
; CP0 = OFF Program memory is not code-protected
;
; Oscillator:
; OSC = INTOSC INTOSC
; OSC = INTOSCO INTOSCO (CLKO-RA6)
; OSC = INTOSCPLL INTOSCPLL
; OSC = INTOSCPLLO INTOSCPLLO (CLKO-RA6)
; OSC = HS HS, USB-HS
; OSC = HSPLL HS+PLL, USB-HS+PLL
; OSC = EC EC (CLKO-RA6), USB-EC
; OSC = ECPLL EC+PLL (CLKO-RA6), USB-EC+PLL
;
; T1OSCEN Enforcement:
; T1DIG = OFF Secondary Oscillator clock source may not be selected
; T1DIG = ON Secondary Oscillator clock source may be selected
;
; Low-Power Timer1 Oscillator:
; LPT1OSC = ON Low-power operation
; LPT1OSC = OFF High-power operation
;
; Fail-Safe Clock Monitor:
; FCMEN = OFF Disabled
; FCMEN = ON Enabled
;
; Internal External Oscillator Switch Over Mode:
; IESO = OFF Disabled
; IESO = ON Enabled
;
; Watchdog Postscaler:
; WDTPS = 1 1:1
; WDTPS = 2 1:2
; WDTPS = 4 1:4
; WDTPS = 8 1:8
; WDTPS = 16 1:16
; WDTPS = 32 1:32
; WDTPS = 64 1:64
; WDTPS = 128 1:128
; WDTPS = 256 1:256
; WDTPS = 512 1:512
; WDTPS = 1024 1:1024
; WDTPS = 2048 1:2048
; WDTPS = 4096 1:4096
; WDTPS = 8192 1:8192
; WDTPS = 16384 1:16384
; WDTPS = 32768 1:32768
;
; DSWDT Clock Select:
; DSWDTOSC = T1OSCREF DSWDT uses T1OSC/T1CKI
; DSWDTOSC = INTOSCREF DSWDT uses INTRC
;
; RTCC Clock Select:
; RTCOSC = INTOSCREF RTCC uses INTRC
; RTCOSC = T1OSCREF RTCC uses T1OSC/T1CKI
;
; Deep Sleep BOR:
; DSBOREN = OFF Disabled
; DSBOREN = ON Enabled
;
; Deep Sleep Watchdog Timer:
; DSWDTEN = OFF Disabled
; DSWDTEN = ON Enabled
;
; Deep Sleep Watchdog Postscaler:
; DSWDTPS = 2 1:2 (2.1 ms)
; DSWDTPS = 8 1:8 (8.3 ms)
; DSWDTPS = 32 1:32 (33 ms)
; DSWDTPS = 128 1:128 (132 ms)
; DSWDTPS = 512 1:512 (528 ms)
; DSWDTPS = 2048 1:2,048 (2.1 seconds)
; DSWDTPS = 8192 1:8,192 (8.5 seconds)
; DSWDTPS = K32 1:32,768 (34 seconds)
; DSWDTPS = K131 1:131,072 (135 seconds)
; DSWDTPS = K524 1:524,288 (9 minutes)
; DSWDTPS = M2 1:2,097,152 (36 minutes)
; DSWDTPS = M8 1:8,388,608 (2.4 hours)
; DSWDTPS = M33 1:33,554,432 (9.6 hours)
; DSWDTPS = M134 1:134,217,728 (38.5 hours)
; DSWDTPS = M536 1:536,870,912 (6.4 days)
; DSWDTPS = G2 1:2,147,483,648 (25.7 days)
;
; IOLOCK One-Way Set Enable bit:
; IOL1WAY = OFF The IOLOCK bit (PPSCON<0>) can be set and cleared as needed
; IOL1WAY = ON The IOLOCK bit (PPSCON<0>) can be set once
;
; MSSP address masking:
; MSSP7B_EN = MSK5 5 Bit address masking mode
; MSSP7B_EN = MSK7 7 Bit address masking mode
;
; Write/Erase Protect Page Start/End Location:
; WPFP = PAGE_0 Write Protect Program Flash Page 0
; WPFP = PAGE_1 Write Protect Program Flash Page 1
; WPFP = PAGE_2 Write Protect Program Flash Page 2
; WPFP = PAGE_3 Write Protect Program Flash Page 3
; WPFP = PAGE_4 Write Protect Program Flash Page 4
; WPFP = PAGE_5 Write Protect Program Flash Page 5
; WPFP = PAGE_6 Write Protect Program Flash Page 6
; WPFP = PAGE_7 Write Protect Program Flash Page 7
; WPFP = PAGE_8 Write Protect Program Flash Page 8
; WPFP = PAGE_9 Write Protect Program Flash Page 9
; WPFP = PAGE_10 Write Protect Program Flash Page 10
; WPFP = PAGE_11 Write Protect Program Flash Page 11
; WPFP = PAGE_12 Write Protect Program Flash Page 12
; WPFP = PAGE_13 Write Protect Program Flash Page 13
; WPFP = PAGE_14 Write Protect Program Flash Page 14
; WPFP = PAGE_15 Write Protect Program Flash Page 15
; WPFP = PAGE_16 Write Protect Program Flash Page 16
; WPFP = PAGE_17 Write Protect Program Flash Page 17
; WPFP = PAGE_18 Write Protect Program Flash Page 18
; WPFP = PAGE_19 Write Protect Program Flash Page 19
; WPFP = PAGE_20 Write Protect Program Flash Page 20
; WPFP = PAGE_21 Write Protect Program Flash Page 21
; WPFP = PAGE_22 Write Protect Program Flash Page 22
; WPFP = PAGE_23 Write Protect Program Flash Page 23
; WPFP = PAGE_24 Write Protect Program Flash Page 24
; WPFP = PAGE_25 Write Protect Program Flash Page 25
; WPFP = PAGE_26 Write Protect Program Flash Page 26
; WPFP = PAGE_27 Write Protect Program Flash Page 27
; WPFP = PAGE_28 Write Protect Program Flash Page 28
; WPFP = PAGE_29 Write Protect Program Flash Page 29
; WPFP = PAGE_30 Write Protect Program Flash Page 30
; WPFP = PAGE_31 Write Protect Program Flash Page 31
; WPFP = PAGE_32 Write Protect Program Flash Page 32
; WPFP = PAGE_33 Write Protect Program Flash Page 33
; WPFP = PAGE_34 Write Protect Program Flash Page 34
; WPFP = PAGE_35 Write Protect Program Flash Page 35
; WPFP = PAGE_36 Write Protect Program Flash Page 36
; WPFP = PAGE_37 Write Protect Program Flash Page 37
; WPFP = PAGE_38 Write Protect Program Flash Page 38
; WPFP = PAGE_39 Write Protect Program Flash Page 39
; WPFP = PAGE_40 Write Protect Program Flash Page 40
; WPFP = PAGE_41 Write Protect Program Flash Page 41
; WPFP = PAGE_42 Write Protect Program Flash Page 42
; WPFP = PAGE_43 Write Protect Program Flash Page 43
; WPFP = PAGE_44 Write Protect Program Flash Page 44
; WPFP = PAGE_45 Write Protect Program Flash Page 45
; WPFP = PAGE_46 Write Protect Program Flash Page 46
; WPFP = PAGE_47 Write Protect Program Flash Page 47
; WPFP = PAGE_48 Write Protect Program Flash Page 48
; WPFP = PAGE_49 Write Protect Program Flash Page 49
; WPFP = PAGE_50 Write Protect Program Flash Page 50
; WPFP = PAGE_51 Write Protect Program Flash Page 51
; WPFP = PAGE_52 Write Protect Program Flash Page 52
; WPFP = PAGE_53 Write Protect Program Flash Page 53
; WPFP = PAGE_54 Write Protect Program Flash Page 54
; WPFP = PAGE_55 Write Protect Program Flash Page 55
; WPFP = PAGE_56 Write Protect Program Flash Page 56
; WPFP = PAGE_57 Write Protect Program Flash Page 57
; WPFP = PAGE_58 Write Protect Program Flash Page 58
; WPFP = PAGE_59 Write Protect Program Flash Page 59
; WPFP = PAGE_60 Write Protect Program Flash Page 60
; WPFP = PAGE_61 Write Protect Program Flash Page 61
; WPFP = PAGE_62 Write Protect Program Flash Page 62
; WPFP = PAGE_63 Write Protect Program Flash Page 63
;
; Write/Erase Protect Region Select bit (valid when WPDIS = 0):
; WPEND = PAGE_0 Page 0 to WPFP<5:0> erase/write-protected
; WPEND = PAGE_WPFP Pages WPFP<5:0> to (Configuration Words page) write/erase protected
;
; Write/Erase Protect Configuration Region :
; WPCFG = ON Configuration Words page erase/write-protected
; WPCFG = OFF Configuration Words page not erase/write-protected
;
; Write Protect Disable bit:
; WPDIS = ON WPFP[5:0], WPEND, and WPCFG bits enabled
; WPDIS = OFF WPFP[5:0], WPEND, and WPCFG bits ignored
;
;================================================= =========================
_DEVID1 EQU H'3FFFFE'
_DEVID2 EQU H'3FFFFF'
Is the only solution is to edit all configs in the PBP include file, or am I missing something. If this has already been covered, let me have it....


I notice that the 18F4550 has both styles in it's include file, like this:


;================================================= =========================
;
; IMPORTANT: For the PIC18 devices, the __CONFIG directive has been
; superseded by the CONFIG directive. The following settings
; are available for this device.
;
; PLL Prescaler Selection bits:
; PLLDIV = 1 No prescale (4 MHz oscillator input drives PLL directly)
; PLLDIV = 2 Divide by 2 (8 MHz oscillator input)
; PLLDIV = 3 Divide by 3 (12 MHz oscillator input)
; PLLDIV = 4 Divide by 4 (16 MHz oscillator input)
; PLLDIV = 5 Divide by 5 (20 MHz oscillator input)
; PLLDIV = 6 Divide by 6 (24 MHz oscillator input)
; PLLDIV = 10 Divide by 10 (40 MHz oscillator input)
; PLLDIV = 12 Divide by 12 (48 MHz oscillator input)
;
; CPU System Clock Postscaler:
; CPUDIV = OSC1_PLL2 [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
; CPUDIV = OSC2_PLL3 [OSC1/OSC2 Src: /2][96 MHz PLL Src: /3]
; CPUDIV = OSC3_PLL4 [OSC1/OSC2 Src: /3][96 MHz PLL Src: /4]
; CPUDIV = OSC4_PLL6 [OSC1/OSC2 Src: /4][96 MHz PLL Src: /6]
;
; USB Clock Selection bit (used in Full Speed USB mode only; UCFG:FSEN = 1):
; USBDIV = 1 USB clock source comes directly from the primary oscillator block with no postscale
; USBDIV = 2 USB clock source comes from the 96 MHz PLL divided by 2
;
; Oscillator Selection bits:
; FOSC = XT_XT XT oscillator, XT used by USB
; FOSC = XTPLL_XT XT oscillator, PLL enabled, XT used by USB
; FOSC = ECIO_EC External clock, port function on RA6, EC used by USB
; FOSC = EC_EC External clock, CLKOUT on RA6, EC used by USB
; FOSC = ECPLLIO_EC External clock, PLL enabled, port function on RA6, EC used by USB
; FOSC = ECPLL_EC External clock, PLL enabled, CLKOUT on RA6, EC used by USB
; FOSC = INTOSCIO_EC Internal oscillator, port function on RA6, EC used by USB
; FOSC = INTOSC_EC Internal oscillator, CLKOUT on RA6, EC used by USB
; FOSC = INTOSC_XT Internal oscillator, XT used by USB
; FOSC = INTOSC_HS Internal oscillator, HS used by USB
; FOSC = HS HS oscillator, HS used by USB
; FOSC = HSPLL_HS HS oscillator, PLL enabled, HS used by USB
;
; Fail-Safe Clock Monitor Enable bit:
; FCMEN = OFF Fail-Safe Clock Monitor disabled
; FCMEN = ON Fail-Safe Clock Monitor enabled
;
; Internal/External Oscillator Switchover bit:
; IESO = OFF Oscillator Switchover mode disabled
; IESO = ON Oscillator Switchover mode enabled
;
; Power-up Timer Enable bit:
; PWRT = ON PWRT enabled
; PWRT = OFF PWRT disabled
;
; Brown-out Reset Enable bits:
; BOR = OFF Brown-out Reset disabled in hardware and software
; BOR = SOFT Brown-out Reset enabled and controlled by software (SBOREN is enabled)
; BOR = ON_ACTIVE Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
; BOR = ON Brown-out Reset enabled in hardware only (SBOREN is disabled)
;
; Brown-out Voltage bits:
; BORV = 0 Maximum setting
; BORV = 1
; BORV = 2
; BORV = 3 Minimum setting
;
; USB Voltage Regulator Enable bit:
; VREGEN = OFF USB voltage regulator disabled
; VREGEN = ON USB voltage regulator enabled
;
; Watchdog Timer Enable bit:
; WDT = OFF HW Disabled - SW Controlled
; WDT = ON HW Enabled - SW Disabled
;
; Watchdog Timer Postscale Select bits:
; WDTPS = 1 1:1
; WDTPS = 2 1:2
; WDTPS = 4 1:4
; WDTPS = 8 1:8
; WDTPS = 16 1:16
; WDTPS = 32 1:32
; WDTPS = 64 1:64
; WDTPS = 128 1:128
; WDTPS = 256 1:256
; WDTPS = 512 1:512
; WDTPS = 1024 1:1024
; WDTPS = 2048 1:2048
; WDTPS = 4096 1:4096
; WDTPS = 8192 1:8192
; WDTPS = 16384 1:16384
; WDTPS = 32768 1:32768
;
; MCLR Pin Enable bit:
; MCLRE = OFF RE3 input pin enabled; MCLR disabled
; MCLRE = ON MCLR pin enabled; RE3 input pin disabled
;
; Low-Power Timer 1 Oscillator Enable bit:
; LPT1OSC = OFF Timer1 configured for higher power operation
; LPT1OSC = ON Timer1 configured for low-power operation
;
; PORTB A/D Enable bit:
; PBADEN = OFF PORTB<4:0> pins are configured as digital I/O on Reset
; PBADEN = ON PORTB<4:0> pins are configured as analog input channels on Reset
;
; CCP2 MUX bit:
; CCP2MX = OFF CCP2 input/output is multiplexed with RB3
; CCP2MX = ON CCP2 input/output is multiplexed with RC1
;
; Stack Full/Underflow Reset Enable bit:
; STVREN = OFF Stack full/underflow will not cause Reset
; STVREN = ON Stack full/underflow will cause Reset
;
; Single-Supply ICSP Enable bit:
; LVP = OFF Single-Supply ICSP disabled
; LVP = ON Single-Supply ICSP enabled
;
; Dedicated In-Circuit Debug/Programming Port (ICPORT) Enable bit:
; ICPRT = OFF ICPORT disabled
; ICPRT = ON ICPORT enabled
;
; Extended Instruction Set Enable bit:
; XINST = OFF Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
; XINST = ON Instruction set extension and Indexed Addressing mode enabled
;
; Background Debugger Enable bit:
; DEBUG = ON Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug
; DEBUG = OFF Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
;
; Code Protection bit Block 0:
; CP0 = ON Block 0 (000800-001FFFh) code-protected
; CP0 = OFF Block 0 (000800-001FFFh) not code-protected
;
; Code Protection bit Block 1:
; CP1 = ON Block 1 (002000-003FFFh) code-protected
; CP1 = OFF Block 1 (002000-003FFFh) not code-protected
;
; Code Protection bit Block 2:
; CP2 = ON Block 2 (004000-005FFFh) code-protected
; CP2 = OFF Block 2 (004000-005FFFh) not code-protected
;
; Code Protection bit Block 3:
; CP3 = ON Block 3 (006000-007FFFh) code-protected
; CP3 = OFF Block 3 (006000-007FFFh) not code-protected
;
; Boot Block Code Protection bit:
; CPB = ON Boot block (000000-0007FFh) code-protected
; CPB = OFF Boot block (000000-0007FFh) not code-protected
;
; Data EEPROM Code Protection bit:
; CPD = ON Data EEPROM code-protected
; CPD = OFF Data EEPROM not code-protected
;
; Write Protection bit Block 0:
; WRT0 = ON Block 0 (000800-001FFFh) write-protected
; WRT0 = OFF Block 0 (000800-001FFFh) not write-protected
;
; Write Protection bit Block 1:
; WRT1 = ON Block 1 (002000-003FFFh) write-protected
; WRT1 = OFF Block 1 (002000-003FFFh) not write-protected
;
; Write Protection bit Block 2:
; WRT2 = ON Block 2 (004000-005FFFh) write-protected
; WRT2 = OFF Block 2 (004000-005FFFh) not write-protected
;
; Write Protection bit Block 3:
; WRT3 = ON Block 3 (006000-007FFFh) write-protected
; WRT3 = OFF Block 3 (006000-007FFFh) not write-protected
;
; Boot Block Write Protection bit:
; WRTB = ON Boot block (000000-0007FFh) write-protected
; WRTB = OFF Boot block (000000-0007FFh) not write-protected
;
; Configuration Register Write Protection bit:
; WRTC = ON Configuration registers (300000-3000FFh) write-protected
; WRTC = OFF Configuration registers (300000-3000FFh) not write-protected
;
; Data EEPROM Write Protection bit:
; WRTD = ON Data EEPROM write-protected
; WRTD = OFF Data EEPROM not write-protected
;
; Table Read Protection bit Block 0:
; EBTR0 = ON Block 0 (000800-001FFFh) protected from table reads executed in other blocks
; EBTR0 = OFF Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
;
; Table Read Protection bit Block 1:
; EBTR1 = ON Block 1 (002000-003FFFh) protected from table reads executed in other blocks
; EBTR1 = OFF Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
;
; Table Read Protection bit Block 2:
; EBTR2 = ON Block 2 (004000-005FFFh) protected from table reads executed in other blocks
; EBTR2 = OFF Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
;
; Table Read Protection bit Block 3:
; EBTR3 = ON Block 3 (006000-007FFFh) protected from table reads executed in other blocks
; EBTR3 = OFF Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
;
; Boot Block Table Read Protection:
; EBTRB = ON Boot block (000000-0007FFh) protected from table reads executed in other blocks
; EBTRB = OFF Boot block (000000-0007FFh) not protected from table reads executed in other blocks
;
;================================================= =========================
;================================================= =========================
;
; Configuration Bits
;
; NAME Address
; CONFIG1L 300000h
; CONFIG1H 300001h
; CONFIG2L 300002h
; CONFIG2H 300003h
; CONFIG3H 300005h
; CONFIG4L 300006h
; CONFIG5L 300008h
; CONFIG5H 300009h
; CONFIG6L 30000Ah
; CONFIG6H 30000Bh
; CONFIG7L 30000Ch
; CONFIG7H 30000Dh
;
;================================================= =========================

; The following is an assignment of address values for all of the
; configuration registers for the purpose of table reads
_CONFIG1L EQU H'300000'
_CONFIG1H EQU H'300001'
_CONFIG2L EQU H'300002'
_CONFIG2H EQU H'300003'
_CONFIG3H EQU H'300005'
_CONFIG4L EQU H'300006'
_CONFIG5L EQU H'300008'
_CONFIG5H EQU H'300009'
_CONFIG6L EQU H'30000A'
_CONFIG6H EQU H'30000B'
_CONFIG7L EQU H'30000C'
_CONFIG7H EQU H'30000D'

;----- CONFIG1L Options --------------------------------------------------
_PLLDIV_1_1L EQU H'F8' ; No prescale (4 MHz oscillator input drives PLL directly)
_PLLDIV_2_1L EQU H'F9' ; Divide by 2 (8 MHz oscillator input)
_PLLDIV_3_1L EQU H'FA' ; Divide by 3 (12 MHz oscillator input)
_PLLDIV_4_1L EQU H'FB' ; Divide by 4 (16 MHz oscillator input)
_PLLDIV_5_1L EQU H'FC' ; Divide by 5 (20 MHz oscillator input)
_PLLDIV_6_1L EQU H'FD' ; Divide by 6 (24 MHz oscillator input)
_PLLDIV_10_1L EQU H'FE' ; Divide by 10 (40 MHz oscillator input)
_PLLDIV_12_1L EQU H'FF' ; Divide by 12 (48 MHz oscillator input)

_CPUDIV_OSC1_PLL2_1L EQU H'E7' ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
_CPUDIV_OSC2_PLL3_1L EQU H'EF' ; [OSC1/OSC2 Src: /2][96 MHz PLL Src: /3]
_CPUDIV_OSC3_PLL4_1L EQU H'F7' ; [OSC1/OSC2 Src: /3][96 MHz PLL Src: /4]
_CPUDIV_OSC4_PLL6_1L EQU H'FF' ; [OSC1/OSC2 Src: /4][96 MHz PLL Src: /6]

_USBDIV_1_1L EQU H'DF' ; USB clock source comes directly from the primary oscillator block with no postscale
_USBDIV_2_1L EQU H'FF' ; USB clock source comes from the 96 MHz PLL divided by 2

;----- CONFIG1H Options --------------------------------------------------
_FOSC_XT_XT_1H EQU H'F0' ; XT oscillator, XT used by USB
_FOSC_XTPLL_XT_1H EQU H'F2' ; XT oscillator, PLL enabled, XT used by USB
_FOSC_ECIO_EC_1H EQU H'F4' ; External clock, port function on RA6, EC used by USB
_FOSC_EC_EC_1H EQU H'F5' ; External clock, CLKOUT on RA6, EC used by USB
_FOSC_ECPLLIO_EC_1H EQU H'F6' ; External clock, PLL enabled, port function on RA6, EC used by USB
_FOSC_ECPLL_EC_1H EQU H'F7' ; External clock, PLL enabled, CLKOUT on RA6, EC used by USB
_FOSC_INTOSCIO_EC_1H EQU H'F8' ; Internal oscillator, port function on RA6, EC used by USB
_FOSC_INTOSC_EC_1H EQU H'F9' ; Internal oscillator, CLKOUT on RA6, EC used by USB
_FOSC_INTOSC_XT_1H EQU H'FA' ; Internal oscillator, XT used by USB
_FOSC_INTOSC_HS_1H EQU H'FB' ; Internal oscillator, HS used by USB
_FOSC_HS_1H EQU H'FC' ; HS oscillator, HS used by USB
_FOSC_HSPLL_HS_1H EQU H'FE' ; HS oscillator, PLL enabled, HS used by USB

_FCMEN_OFF_1H EQU H'BF' ; Fail-Safe Clock Monitor disabled
_FCMEN_ON_1H EQU H'FF' ; Fail-Safe Clock Monitor enabled

_IESO_OFF_1H EQU H'7F' ; Oscillator Switchover mode disabled
_IESO_ON_1H EQU H'FF' ; Oscillator Switchover mode enabled

;----- CONFIG2L Options --------------------------------------------------
_PWRT_ON_2L EQU H'FE' ; PWRT enabled
_PWRT_OFF_2L EQU H'FF' ; PWRT disabled

_BOR_OFF_2L EQU H'F9' ; Brown-out Reset disabled in hardware and software
_BOR_SOFT_2L EQU H'FB' ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
_BOR_ON_ACTIVE_2L EQU H'FD' ; Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
_BOR_ON_2L EQU H'FF' ; Brown-out Reset enabled in hardware only (SBOREN is disabled)

_BORV_0_2L EQU H'E7' ; Maximum setting
_BORV_1_2L EQU H'EF' ;
_BORV_2_2L EQU H'F7' ;
_BORV_3_2L EQU H'FF' ; Minimum setting

_VREGEN_OFF_2L EQU H'DF' ; USB voltage regulator disabled
_VREGEN_ON_2L EQU H'FF' ; USB voltage regulator enabled

;----- CONFIG2H Options --------------------------------------------------
_WDT_OFF_2H EQU H'FE' ; HW Disabled - SW Controlled
_WDT_ON_2H EQU H'FF' ; HW Enabled - SW Disabled

_WDTPS_1_2H EQU H'E1' ; 1:1
_WDTPS_2_2H EQU H'E3' ; 1:2
_WDTPS_4_2H EQU H'E5' ; 1:4
_WDTPS_8_2H EQU H'E7' ; 1:8
_WDTPS_16_2H EQU H'E9' ; 1:16
_WDTPS_32_2H EQU H'EB' ; 1:32
_WDTPS_64_2H EQU H'ED' ; 1:64
_WDTPS_128_2H EQU H'EF' ; 1:128
_WDTPS_256_2H EQU H'F1' ; 1:256
_WDTPS_512_2H EQU H'F3' ; 1:512
_WDTPS_1024_2H EQU H'F5' ; 1:1024
_WDTPS_2048_2H EQU H'F7' ; 1:2048
_WDTPS_4096_2H EQU H'F9' ; 1:4096
_WDTPS_8192_2H EQU H'FB' ; 1:8192
_WDTPS_16384_2H EQU H'FD' ; 1:16384
_WDTPS_32768_2H EQU H'FF' ; 1:32768

;----- CONFIG3H Options --------------------------------------------------
_MCLRE_OFF_3H EQU H'7F' ; RE3 input pin enabled; MCLR disabled
_MCLRE_ON_3H EQU H'FF' ; MCLR pin enabled; RE3 input pin disabled

_LPT1OSC_OFF_3H EQU H'FB' ; Timer1 configured for higher power operation
_LPT1OSC_ON_3H EQU H'FF' ; Timer1 configured for low-power operation

_PBADEN_OFF_3H EQU H'FD' ; PORTB<4:0> pins are configured as digital I/O on Reset
_PBADEN_ON_3H EQU H'FF' ; PORTB<4:0> pins are configured as analog input channels on Reset

_CCP2MX_OFF_3H EQU H'FE' ; CCP2 input/output is multiplexed with RB3
_CCP2MX_ON_3H EQU H'FF' ; CCP2 input/output is multiplexed with RC1

;----- CONFIG4L Options --------------------------------------------------
_STVREN_OFF_4L EQU H'FE' ; Stack full/underflow will not cause Reset
_STVREN_ON_4L EQU H'FF' ; Stack full/underflow will cause Reset

_LVP_OFF_4L EQU H'FB' ; Single-Supply ICSP disabled
_LVP_ON_4L EQU H'FF' ; Single-Supply ICSP enabled

_ICPRT_OFF_4L EQU H'DF' ; ICPORT disabled
_ICPRT_ON_4L EQU H'FF' ; ICPORT enabled

_XINST_OFF_4L EQU H'BF' ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
_XINST_ON_4L EQU H'FF' ; Instruction set extension and Indexed Addressing mode enabled

_DEBUG_ON_4L EQU H'7F' ; Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug
_DEBUG_OFF_4L EQU H'FF' ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins

;----- CONFIG5L Options --------------------------------------------------
_CP0_ON_5L EQU H'FE' ; Block 0 (000800-001FFFh) code-protected
_CP0_OFF_5L EQU H'FF' ; Block 0 (000800-001FFFh) not code-protected

_CP1_ON_5L EQU H'FD' ; Block 1 (002000-003FFFh) code-protected
_CP1_OFF_5L EQU H'FF' ; Block 1 (002000-003FFFh) not code-protected

_CP2_ON_5L EQU H'FB' ; Block 2 (004000-005FFFh) code-protected
_CP2_OFF_5L EQU H'FF' ; Block 2 (004000-005FFFh) not code-protected

_CP3_ON_5L EQU H'F7' ; Block 3 (006000-007FFFh) code-protected
_CP3_OFF_5L EQU H'FF' ; Block 3 (006000-007FFFh) not code-protected

;----- CONFIG5H Options --------------------------------------------------
_CPB_ON_5H EQU H'BF' ; Boot block (000000-0007FFh) code-protected
_CPB_OFF_5H EQU H'FF' ; Boot block (000000-0007FFh) not code-protected

_CPD_ON_5H EQU H'7F' ; Data EEPROM code-protected
_CPD_OFF_5H EQU H'FF' ; Data EEPROM not code-protected

;----- CONFIG6L Options --------------------------------------------------
_WRT0_ON_6L EQU H'FE' ; Block 0 (000800-001FFFh) write-protected
_WRT0_OFF_6L EQU H'FF' ; Block 0 (000800-001FFFh) not write-protected

_WRT1_ON_6L EQU H'FD' ; Block 1 (002000-003FFFh) write-protected
_WRT1_OFF_6L EQU H'FF' ; Block 1 (002000-003FFFh) not write-protected

_WRT2_ON_6L EQU H'FB' ; Block 2 (004000-005FFFh) write-protected
_WRT2_OFF_6L EQU H'FF' ; Block 2 (004000-005FFFh) not write-protected

_WRT3_ON_6L EQU H'F7' ; Block 3 (006000-007FFFh) write-protected
_WRT3_OFF_6L EQU H'FF' ; Block 3 (006000-007FFFh) not write-protected

;----- CONFIG6H Options --------------------------------------------------
_WRTB_ON_6H EQU H'BF' ; Boot block (000000-0007FFh) write-protected
_WRTB_OFF_6H EQU H'FF' ; Boot block (000000-0007FFh) not write-protected

_WRTC_ON_6H EQU H'DF' ; Configuration registers (300000-3000FFh) write-protected
_WRTC_OFF_6H EQU H'FF' ; Configuration registers (300000-3000FFh) not write-protected

_WRTD_ON_6H EQU H'7F' ; Data EEPROM write-protected
_WRTD_OFF_6H EQU H'FF' ; Data EEPROM not write-protected

;----- CONFIG7L Options --------------------------------------------------
_EBTR0_ON_7L EQU H'FE' ; Block 0 (000800-001FFFh) protected from table reads executed in other blocks
_EBTR0_OFF_7L EQU H'FF' ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks

_EBTR1_ON_7L EQU H'FD' ; Block 1 (002000-003FFFh) protected from table reads executed in other blocks
_EBTR1_OFF_7L EQU H'FF' ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks

_EBTR2_ON_7L EQU H'FB' ; Block 2 (004000-005FFFh) protected from table reads executed in other blocks
_EBTR2_OFF_7L EQU H'FF' ; Block 2 (004000-005FFFh) not protected from table reads executed in other blocks

_EBTR3_ON_7L EQU H'F7' ; Block 3 (006000-007FFFh) protected from table reads executed in other blocks
_EBTR3_OFF_7L EQU H'FF' ; Block 3 (006000-007FFFh) not protected from table reads executed in other blocks

;----- CONFIG7H Options --------------------------------------------------
_EBTRB_ON_7H EQU H'BF' ; Boot block (000000-0007FFh) protected from table reads executed in other blocks
_EBTRB_OFF_7H EQU H'FF' ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
Thanks,

Walter

Bruce
- 16th June 2010, 15:34
Hi Walter,

When using the new config directives you need to place them in the 18F26J50.INC file. They will not work when dropped directly in your code file.

ScaleRobotics
- 16th June 2010, 16:07
Thanks Bruce,

The configs work. My configuration fuses get changed properly, my led blinks. However, PBP can not accept the speed of my oscillator. It looks like the only thing that needs to be done is to have MeLabs make some sort of change on their end to accept the OSC speed.

Bruce
- 16th June 2010, 16:38
Hi Walter,

Are you setting OSCTUNE.6 to enable the 96MHz multiplier?

ScaleRobotics
- 16th June 2010, 17:20
Hi Bruce,

I had it in some earlier code, but you are right it is missing here. That brings me back up to what appears to be 12 x the 4 mhz default speed (that is 12x faster than PBP is expecting it, since I am missing the define to make it compile), when I leave out my oscillator define. But when I put in my DEFINE OSC XX I get the same error as before.

Bruce
- 16th June 2010, 17:33
I'm guessing you still have the new config directives in your code VS in the 18F26J50.INC file?
That will cause the error. You need to place these in your 18F26J50.INC file.

Then it should work as expected.

ScaleRobotics
- 16th June 2010, 17:48
Yes, I do. My question sort of was:

Is there a work around. Sounds like the answer is NO for the newer chips that do not have the CONFIGxL/H in their .inc file.

Which brings me to my next question:
Since it appears that the only hang up is the way PBP checks to see if you can run at the processor speed, do you think this can be fixed pretty easily by MeLabs? Or do you think I am making it out to be easier than it really is. I have tried to do a work-around, but have not succeeded (yet).

It is not such a big deal, as I can declare them as you suggest. But I am stubborn, and it appears to be one single register that needs to be set, and it would work.

Bruce
- 16th June 2010, 18:51
I'm not sure what the fix would be to be honest, but if you're up for an experiment, try this;

Make a backup copy of your PBPPIC18.LIB.

Now use an editor to find & replace all instances of OSC with XTAL.

Save the .LIB file, and compile with DEFINE XTAL 48, and the new config directives in your code.

Does it work?

ScaleRobotics
- 16th June 2010, 21:54
Thanks Bruce, that does the trick! Just did exactly as you said, and now it lets me compile inside my program code like this:



Define XTAL 48
OSCTUNE.6 =1
ASM
CONFIG OSC=HSPLL
CONFIG CPUDIV=OSC1
CONFIG PLLDIV=5
CONFIG LPT1OSC=OFF
CONFIG CP0=OFF
CONFIG WDTEN=ON
CONFIG XINST=OFF
CONFIG IOL1WAY=OFF
CONFIG STVREN=OFF
CONFIG T1DIG=ON
CONFIG FCMEN=OFF
CONFIG WDTPS=512
CONFIG RTCOSC=T1OSCREF
ENDASM
And my LED is blinking at the right speed. Yes, I could just edit configs in the .inc file, but then you have to change it for each project. A pain if you want to jump around from unfinished project to unfinished project. Oh, that's just me.... :D

Bruce
- 16th June 2010, 21:59
Cool. Maybe the fix is something as simple as melabs changing to something other than OSC?

Just bear-in-mind that your next PBP update will change everything, and any patch will fail since you've modified your library files...;o)

ScaleRobotics
- 16th June 2010, 22:03
Ah, I see what you mean!



Define XTAL 48
OSCTUNE.6 =1
ASM
CONFIG OSC=HSPLL

SKOLS1
- 2nd August 2011, 23:08
I got this error: overwriting previous address contents (2007)
I write this line @ __CONFIG _INTRC_OSC_NOCLKOUT to turn on the internal oscilator of the PIC16F628A,
I fix any mistakes what I think I made them,but there are errors.I DEFINE OSC 4,it's not working.

mackrackit
- 3rd August 2011, 00:04
You need to comment the *.inc file for the chip in the PBP directory.
http://www.picbasic.co.uk/forum/showthread.php?t=543&p=6775#post6775

SKOLS1
- 3rd August 2011, 22:01
I get: Unable to open INCLUDE file P16F628A.INC

Archangel
- 4th August 2011, 02:10
I get: Unable to open INCLUDE file P16F628A.INC
Be sure Microcode Studio knows where that file is located. Click view, Compile and Program Options ,click the assembler tab,check USE MPASM, and Click either find Manually or Find Automatically.

SKOLS1
- 5th August 2011, 11:20
Be sure Microcode Studio knows where that file is located. Click view, Compile and Program Options ,click the assembler tab,check USE MPASM, and Click either find Manually or Find Automatically.
I try with P16F628.INF file and It isn't working with another Include file(16F628.inc).I find it automatically but still not working.I will try with my other computer.I am using MPLAB IDE v8.73,I have those problems with MPLAB IDE v.7.60.What do you think?

mackrackit
- 5th August 2011, 12:18
You do not include those files, PBP does that for you. All you need to do is tell PBP where MPASM is.
http://www.picbasic.co.uk/forum/content.php?r=389-Beginner-Tutorial-How-to-get-started-with-PBPDEMO-MicroCode-Studio-PICKIT-2

LakisFM1
- 13th January 2012, 23:06
Oh , it's been 7 years and this thread is still hot!
Here is my configuration problem using PIC12F1822.

As long as i red the manuals i guess the correct is

@ __CONFIG1 _FOSC_INTOSC & _<blah blah>

but... GAGA:chargrined: ... wrong.
i also tried

@ __CONFIG _FOSC_INTOSC & _<blah blah>

also tried include the .inc neither worked.

Any ideas?
Thanks in advance! :surprise:.

Ioannis
- 13th January 2012, 23:36
These configs are for the PM assembler.

Which assembler are you using? Also which version of PBP?

The inc is not to be included. But you can open it and see what are the configuration words exaclty.

I would recommend using MPASM as an assembler and the syntax of your compiler.

Ioannis

LakisFM1
- 14th January 2012, 09:03
Nop ,
these configs are for the MPASM assembler - which i use ,
since PM (of the PBP 2.60c i use) does not support the 12F1822.

ps. just saw you're from Thessaloniki too :)
so , Kalo Sabbatokyriako ! 'Good Weekend

Ioannis
- 14th January 2012, 11:06
Ooops yes, thats is MPASM but the syntax was not correct.

Try this



ASM
__config _CONFIG1, _FOSC_INTOSC
ENDASM


Yes, I am located in Thessaloniki :)

Ioannis

LakisFM1
- 15th January 2012, 00:31
Overwriting previous address contents (8007) :(

LakisFM1
- 15th January 2012, 01:10
Problem solved!

I had to use

ASM
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF

ENDASM

and the trick was to ";" comment out the __CONFIG in M12F1822.INC file in the PBP directory , because it conflicted.

ScaleRobotics
- 17th January 2012, 20:51
Here are a few examples of how to use the new #CONFIG block syntax for PBP3. (This will NOT work on previous versions of PBP ... Get your upgrade now :) )

PBP3 makes it a little easier to figure out, and set up your configs. It has eliminated the need to comment out the default configurations set up by PBP. It still has default settings - these can be found in the /PBP3/DEVICES file under yourchip.PBPINC . Here is an example of default settings for the PIC18F45K22:


; CUT rest of file out for display purposes

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The #CONFIG block is passed directly to the asm file, but PBP will replace it
; automagically with the contents of a user-defined #CONFIG block if one is
; found in the PBP source program.

#CONFIG
__CONFIG _CONFIG1H, _FOSC_INTIO67_1H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
#ENDCONFIG

; CUT rest of file out for display purposes


If you want to change the default configs in PBP3, DON'T edit the above file. You can just declare them in your code using the #CONFIG #ENDCONFIG block. For all the possibilities of config settings for your chip, check out the /PBP3/DEVICE_REFERENCE folder, and select the yourchip.INFO file. It will look something like this:



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; File: PIC18F45K22.INFO
; Date: 07/24/11
; Generated by melabs File Manager
;
; PICBASIC PRO(tm) Compiler version: 3.0.0.x
;
; Copyright 2011 microEngineering Labs, Inc. All Rights Reserved
; The content herein is intended to facilitate embedded development using
; PICBASIC PRO Compiler. Reproduction or utilization for other purposes
; is prohibited without written permission from microEngineering Labs, Inc..
;
; microEngineering Labs, Inc.
; 2845 Ore Mill Road STE 4
; Colorado Springs, CO 80904
; 719-520-5323
; fax: 719-520-1867
; http://melabs.com
; [email protected]
;
; Modifications to this file in the \DEVICE_REFERENCE folder will be overwritten when
; you install future upgrades.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;MPASM CONFIG Directive Options
;
; This section is included for reference only. The following options may
; be used with the MPASM CONFIG directive to specify configuration settings
; in the source program using the #CONFIG/#ENDCONFIG block.
; Example:
;
; #CONFIG
; CONFIG OSC = HS
; CONFIG WDTE = ON
; #ENDCONFIG
;
;
; Oscillator Selection bits
; CONFIG FOSC = RC ;111X External RC oscillator, CLKOUT function on RA6
; CONFIG FOSC = ECLPIO6 ;EC oscillator (low power, <500 kHz)
; CONFIG FOSC = ECLP ;EC oscillator, CLKOUT function on OSC2 (low power, <500 kHz)
; CONFIG FOSC = ECMPIO6 ;EC oscillator (medium power, 500 kHz-16 MHz)
; CONFIG FOSC = ECMP ;EC oscillator, CLKOUT function on OSC2 (medium power, 500 kHz-16 MHz)
; CONFIG FOSC = INTIO7 ;Internal oscillator block, CLKOUT function on OSC2
; CONFIG FOSC = INTIO67 ;Internal oscillator block
; CONFIG FOSC = RCIO6 ;External RC oscillator
; CONFIG FOSC = RC ;External RC oscillator, CLKOUT function on OSC2
; CONFIG FOSC = ECHPIO6 ;EC oscillator (high power, >16 MHz)
; CONFIG FOSC = ECHP ;EC oscillator, CLKOUT function on OSC2 (high power, >16 MHz)
; CONFIG FOSC = HSMP ;HS oscillator (medium power 4-16 MHz)
; CONFIG FOSC = HSHP ;HS oscillator (high power > 16 MHz)
; CONFIG FOSC = XT ;XT oscillator
; CONFIG FOSC = LP ;LP oscillator
;
; 4X PLL Enable
; CONFIG PLLCFG = OFF ;Oscillator used directly
; CONFIG PLLCFG = ON ;Oscillator multiplied by 4
;
; Primary clock enable bit
; CONFIG PRICLKEN = OFF ;Primary clock can be disabled by software
; CONFIG PRICLKEN = ON ;Primary clock is always enabled
;
; Fail-Safe Clock Monitor Enable bit
; CONFIG FCMEN = OFF ;Fail-Safe Clock Monitor disabled
; CONFIG FCMEN = ON ;Fail-Safe Clock Monitor enabled
;
; Internal/External Oscillator Switchover bit
; CONFIG IESO = OFF ;Oscillator Switchover mode disabled
; CONFIG IESO = ON ;Oscillator Switchover mode enabled
;
; Power-up Timer Enable bit
; CONFIG PWRTEN = OFF ;Power up timer disabled
; CONFIG PWRTEN = ON ;Power up timer enabled
;
; Brown-out Reset Enable bits
; CONFIG BOREN = SBORDIS ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
; CONFIG BOREN = NOSLP ;Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
; CONFIG BOREN = ON ;Brown-out Reset enabled and controlled by software (SBOREN is enabled)
; CONFIG BOREN = OFF ;Brown-out Reset disabled in hardware and software
;
; Brown Out Reset Voltage bits
; CONFIG BORV = 190 ;VBOR set to 1.90 V nominal
; CONFIG BORV = 220 ;VBOR set to 2.20 V nominal
; CONFIG BORV = 250 ;VBOR set to 2.50 V nominal
; CONFIG BORV = 285 ;VBOR set to 2.85 V nominal
;
; Watchdog Timer Enable bits
; CONFIG WDTEN = ON ;WDT is always enabled. SWDTEN bit has no effect
; CONFIG WDTEN = SWON ;WDT is controlled by SWDTEN bit of the WDTCON register
; CONFIG WDTEN = NOSLP ;WDT is disabled in sleep, otherwise enabled. SWDTEN bit has no effect
; CONFIG WDTEN = OFF ;Watch dog timer is always disabled. SWDTEN has no effect.
;
; Watchdog Timer Postscale Select bits
; CONFIG WDTPS = 32768 ;1:32768
; CONFIG WDTPS = 16384 ;1:16384
; CONFIG WDTPS = 8192 ;1:8192
; CONFIG WDTPS = 4096 ;1:4096
; CONFIG WDTPS = 2048 ;1:2048
; CONFIG WDTPS = 1024 ;1:1024
; CONFIG WDTPS = 512 ;1:512
; CONFIG WDTPS = 256 ;1:256
; CONFIG WDTPS = 128 ;1:128
; CONFIG WDTPS = 64 ;1:64
; CONFIG WDTPS = 32 ;1:32
; CONFIG WDTPS = 16 ;1:16
; CONFIG WDTPS = 8 ;1:8
; CONFIG WDTPS = 4 ;1:4
; CONFIG WDTPS = 2 ;1:2
; CONFIG WDTPS = 1 ;1:1
;
; CCP2 MUX bit
; CONFIG CCP2MX = PORTC1 ;CCP2 input/output is multiplexed with RC1
; CONFIG CCP2MX = PORTB3 ;CCP2 input/output is multiplexed with RB3
;
; PORTB A/D Enable bit
; CONFIG PBADEN = ON ;PORTB<5:0> pins are configured as analog input channels on Reset
; CONFIG PBADEN = OFF ;PORTB<5:0> pins are configured as digital I/O on Reset
;
; P3A/CCP3 Mux bit
; CONFIG CCP3MX = PORTB5 ;P3A/CCP3 input/output is multiplexed with RB5
; CONFIG CCP3MX = PORTE0 ;P3A/CCP3 input/output is mulitplexed with RE0
;
; HFINTOSC Fast Start-up
; CONFIG HFOFST = ON ;HFINTOSC output and ready status are not delayed by the oscillator stable status
; CONFIG HFOFST = OFF ;HFINTOSC output and ready status are delayed by the oscillator stable status
;
; Timer3 Clock input mux bit
; CONFIG T3CMX = PORTC0 ;T3CKI is on RC0
; CONFIG T3CMX = PORTB5 ;T3CKI is on RB5
;
; ECCP2 B output mux bit
; CONFIG P2BMX = PORTD2 ;P2B is on RD2
; CONFIG P2BMX = PORTC0 ;P2B is on RC0
;
; MCLR Pin Enable bit
; CONFIG MCLRE = EXTMCLR ;MCLR pin enabled, RE3 input pin disabled
; CONFIG MCLRE = INTMCLR ;RE3 input pin enabled; MCLR disabled
;
; Stack Full/Underflow Reset Enable bit
; CONFIG STVREN = ON ;Stack full/underflow will cause Reset
; CONFIG STVREN = OFF ;Stack full/underflow will not cause Reset
;
; Single-Supply ICSP Enable bit
; CONFIG LVP = ON ;Single-Supply ICSP enabled if MCLRE is also 1
; CONFIG LVP = OFF ;Single-Supply ICSP disabled
;
; Extended Instruction Set Enable bit
; CONFIG XINST = ON ;Instruction set extension and Indexed Addressing mode enabled
; CONFIG XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
;
; Background Debug
; CONFIG DEBUG = OFF ;Disabled
; CONFIG DEBUG = ON ;Enabled
;
; Code Protection Block 0
; CONFIG CP0 = OFF ;Block 0 (000800-001FFFh) not code-protected
; CONFIG CP0 = ON ;Block 0 (000800-001FFFh) code-protected
;
; Code Protection Block 1
; CONFIG CP1 = OFF ;Block 1 (002000-003FFFh) not code-protected
; CONFIG CP1 = ON ;Block 1 (002000-003FFFh) code-protected
;
; Code Protection Block 2
; CONFIG CP2 = OFF ;Block 2 (004000-005FFFh) not code-protected
; CONFIG CP2 = ON ;Block 2 (004000-005FFFh) code-protected
;
; Code Protection Block 3
; CONFIG CP3 = OFF ;Block 3 (006000-007FFFh) not code-protected
; CONFIG CP3 = ON ;Block 3 (006000-007FFFh) code-protected
;
; Boot Block Code Protection bit
; CONFIG CPB = OFF ;Boot block (000000-0007FFh) not code-protected
; CONFIG CPB = ON ;Boot block (000000-0007FFh) code-protected
;
; Data EEPROM Code Protection bit
; CONFIG CPD = OFF ;Data EEPROM not code-protected
; CONFIG CPD = ON ;Data EEPROM code-protected
;
; Write Protection Block 0
; CONFIG WRT0 = OFF ;Block 0 (000800-001FFFh) not write-protected
; CONFIG WRT0 = ON ;Block 0 (000800-001FFFh) write-protected
;
; Write Protection Block 1
; CONFIG WRT1 = OFF ;Block 1 (002000-003FFFh) not write-protected
; CONFIG WRT1 = ON ;Block 1 (002000-003FFFh) write-protected
;
; Write Protection Block 2
; CONFIG WRT2 = OFF ;Block 2 (004000-005FFFh) not write-protected
; CONFIG WRT2 = ON ;Block 2 (004000-005FFFh) write-protected
;
; Write Protection Block 3
; CONFIG WRT3 = OFF ;Block 3 (006000-007FFFh) not write-protected
; CONFIG WRT3 = ON ;Block 3 (006000-007FFFh) write-protected
;
; Configuration Register Write Protection bit
; CONFIG WRTC = OFF ;Configuration registers (300000-3000FFh) not write-protected
; CONFIG WRTC = ON ;Configuration registers (300000-3000FFh) write-protected
;
; Boot Block Write Protection bit
; CONFIG WRTB = OFF ;Boot Block (000000-0007FFh) not write-protected
; CONFIG WRTB = ON ;Boot Block (000000-0007FFh) write-protected
;
; Data EEPROM Write Protection bit
; CONFIG WRTD = OFF ;Data EEPROM not write-protected
; CONFIG WRTD = ON ;Data EEPROM write-protected
;
; Table Read Protection Block 0
; CONFIG EBTR0 = OFF ;Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
; CONFIG EBTR0 = ON ;Block 0 (000800-001FFFh) protected from table reads executed in other blocks
;
; Table Read Protection Block 1
; CONFIG EBTR1 = OFF ;Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
; CONFIG EBTR1 = ON ;Block 1 (002000-003FFFh) protected from table reads executed in other blocks
;
; Table Read Protection Block 2
; CONFIG EBTR2 = OFF ;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
; CONFIG EBTR2 = ON ;Block 2 (004000-005FFFh) protected from table reads executed in other blocks
;
; Table Read Protection Block 3
; CONFIG EBTR3 = OFF ;Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
; CONFIG EBTR3 = ON ;Block 3 (006000-007FFFh) protected from table reads executed in other blocks
;
; Boot Block Table Read Protection bit
; CONFIG EBTRB = OFF ;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
; CONFIG EBTRB = ON ;Boot Block (000000-0007FFh) protected from table reads executed in other blocks
;
;
;/MPASM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Here is an example of how to use the #CONFIG block:



' PIC18F45K22 With Internal OSC set to 64 Mhz
' FLASH AN LED CONNECTED TO PORTB.0
#CONFIG
CONFIG DEBUG = OFF
CONFIG XINST = OFF
CONFIG STVREN = OFF
CONFIG WDTEN = OFF
CONFIG FCMEN = OFF
CONFIG FOSC = INTIO67
CONFIG PLLCFG = ON
CONFIG PRICLKEN = ON
CONFIG IESO = OFF ; Two-Speed Start-up disabled
CONFIG WDTPS = 128 ; 1:128 prescaller for watchdog
CONFIG BOREN = OFF ; Brown-out Reset disabled in hardware and software
CONFIG BORV = 250 ; VBOR set to 2.5 V nominal
CONFIG MCLRE = EXTMCLR ; MCLR pin enabled, RE3 input pin disabled
CONFIG HFOFST = OFF ; The system clock is held off until the HF-INTOSC is stable.
CONFIG PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset
CONFIG CCP2MX = PORTC1 ; CCP2 input/output is multiplexed with RC1
CONFIG LVP = OFF ; Single-Supply ICSP disabled
CONFIG CP0 = OFF ; Block 0 (000800-001FFFh) not code-protected
CONFIG CP1 = OFF ; Block 1 (002000-003FFFh) not code-protected
CONFIG CPB = OFF ; Boot block (000000-0007FFh) not code-protected
CONFIG CPD = OFF ; Data eeprom not code-protected
CONFIG WRT0 = OFF ; Block 0 (000800-001FFFh) not write-protected
CONFIG WRT1 = OFF ; Block 1 (002000-003FFFh) not write-protected
CONFIG WRT2 = OFF ; Block 2 (4000h-5FFFh) not write-protected
CONFIG WRT3 = OFF ; Block 3 (6000h-7FFFh) not write-protected
CONFIG WRTB = OFF ; Boot block (000000-0007FFh) not write-protected
CONFIG WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected
CONFIG WRTD = OFF ; Data eeprom not write-protected
CONFIG EBTR0 = OFF ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
CONFIG EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
CONFIG EBTRB = OFF ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
#ENDCONFIG

DEFINE OSC 64 'THE 16MHz IS PLL'ed TO 64 MHz
OSCCON = %01110000 'Set internal osc to 16 Mhz
OSCTUNE = %01000000 'Turn PLL ON to multiply osc by 4

ANSELA = 0 'ALL ANALOG TO DIGITAL
ANSELB = 0
ANSELC = 0


If you get an error like:
[ERROR] program.pbp fatal (34) : Block overflow for #ENCONFIG
that means that there are too many comments in your configs to "fit". Erase some comments and try compiling again.

Some new features in PBP3 make it possible to do conditional defines, and conditional PIC setup.

(Some content plagiarized from here: http://support.melabs.com/threads/26-Do-Not-comment-the-CONFIGS?p=38&viewfull=1#post38 ... Thanks Darrel!)

Here's an example of how you can set the configuration bits according to the chip being compiled for.
It uses the Conditional Compile directives (#IF/#ELSE/#ENDIF) along with the #CONFIG blocks.

Only the configs for the selected chip will be used.
And if any other chip besides the 25K20 or 25K22 are selected, it will give an error.



#IF __PROCESSOR__ = "18F25K22"
#config
CONFIG FOSC = HSHP
CONFIG WDTEN = OFF
CONFIG PWRTEN = ON
CONFIG BOREN = OFF
CONFIG PBADEN = OFF
CONFIG MCLRE = INTMCLR
CONFIG LVP = OFF
CONFIG DEBUG = OFF
CONFIG XINST = OFF
#endconfig
ANSELA = 0 ; All Digital
ANSELB = 0
ANSELC = 0
#ELSE
#IF __PROCESSOR__ = "18F25K20"
#config
CONFIG FOSC = HS
CONFIG WDTEN = OFF
CONFIG PWRT = ON
CONFIG BOREN = OFF
CONFIG PBADEN = OFF
CONFIG MCLRE = OFF
CONFIG LVP = OFF
CONFIG DEBUG = OFF
CONFIG XINST = OFF
#endconfig
ANSEL = 0 ; All Digital
ANSELH = 0
#ELSE
#ERROR "This program does not support the " + __PROCESSOR__
#ENDIF
#ENDIF


Note that it also sets the ANSEL? registers differently for each chip. Anything else specific to a particular chip can be set this way too.

Some things to remember:
PBP can not use the XINST ,"Instuction set extension and indexed addressing mode", so make sure it is never turned on.
LVP is another issue. Just leave this off as well.

Some older chips like a slightly different context. Let's take a PIC16F628A for example:
Here are the default configs:


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The #CONFIG block is passed directly to the asm file, but PBP will replace it
; automagically with the contents of a user-defined #CONFIG block if one is
; found in the PBP source program.

#CONFIG
ifdef PM_USED
device pic16F628A, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
else
__config _XT_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
endif
#ENDCONFIG

(The first part of this conditional config statment checks to see if the PM assembler is used. Since code for the newer chips can't be assembled with PM, I always chose MPASM.)
You have to use a format like this for these older chips: __config _x & _y & _z

RayL113
- 6th July 2012, 14:54
Melanie,
Can you help me with this?
I cannot get the protection to work. My devices are a 18F2680 and a 18F2620.
Here is my code;
__CONFIG _CONFIG5L, _CP_ALL & _DATA_CP_ON
__CONFIG _CONFIG5H, _CP_ALL & _DATA_CP_ON

As you can see I tried it in bothe high and low registers. This is what I get when I try to compile;
Symbol not previously defined (_CP_ALL)
Symbol not previously defined (_DATA_CP_ON)
Thanks for any help!
Ray

ScaleRobotics
- 6th July 2012, 15:23
Sorry, I wish I was Melanie, but I have not seen her around lately, or even not so lately.
The 18F2680 needs different syntax for those options. Check out post # 42 of this thread.

Here is the syntax to use for the 18F2680:


;----- CONFIG5L Options --------------------------------------------------
_CP0_ON_5L EQU H'FE' ; Block 0 (000800-003FFFh) code-protected
_CP0_OFF_5L EQU H'FF' ; Block 0 (000800-003FFFh) not code-protected

_CP1_ON_5L EQU H'FD' ; Block 1 (004000-007FFFh) code-protected
_CP1_OFF_5L EQU H'FF' ; Block 1 (004000-007FFFh) not code-protected

_CP2_ON_5L EQU H'FB' ; Block 2 (008000-00BFFFh) code-protected
_CP2_OFF_5L EQU H'FF' ; Block 2 (008000-00BFFFh) not code-protected

_CP3_ON_5L EQU H'F7' ; Block 3 (00C000-00FFFFh) code-protected
_CP3_OFF_5L EQU H'FF' ; Block 3 (00C000-00FFFFh) not code-protected

;----- CONFIG5H Options --------------------------------------------------
_CPB_ON_5H EQU H'BF' ; Boot block (000000-0007FFh) code-protected
_CPB_OFF_5H EQU H'FF' ; Boot block (000000-0007FFh) not code-protected

_CPD_ON_5H EQU H'7F' ; Data EEPROM code-protected
_CPD_OFF_5H EQU H'FF' ; Data EEPROM not code-protected

RayL113
- 7th July 2012, 01:09
That worked perfectly!
Thanks a bunch!
Ray


Sorry, I wish I was Melanie, but I have not seen her around lately, or even not so lately.
The 18F2680 needs different syntax for those options. Check out post # 42 of this thread.

Here is the syntax to use for the 18F2680:


;----- CONFIG5L Options --------------------------------------------------
_CP0_ON_5L EQU H'FE' ; Block 0 (000800-003FFFh) code-protected
_CP0_OFF_5L EQU H'FF' ; Block 0 (000800-003FFFh) not code-protected

_CP1_ON_5L EQU H'FD' ; Block 1 (004000-007FFFh) code-protected
_CP1_OFF_5L EQU H'FF' ; Block 1 (004000-007FFFh) not code-protected

_CP2_ON_5L EQU H'FB' ; Block 2 (008000-00BFFFh) code-protected
_CP2_OFF_5L EQU H'FF' ; Block 2 (008000-00BFFFh) not code-protected

_CP3_ON_5L EQU H'F7' ; Block 3 (00C000-00FFFFh) code-protected
_CP3_OFF_5L EQU H'FF' ; Block 3 (00C000-00FFFFh) not code-protected

;----- CONFIG5H Options --------------------------------------------------
_CPB_ON_5H EQU H'BF' ; Boot block (000000-0007FFh) code-protected
_CPB_OFF_5H EQU H'FF' ; Boot block (000000-0007FFh) not code-protected

_CPD_ON_5H EQU H'7F' ; Data EEPROM code-protected
_CPD_OFF_5H EQU H'FF' ; Data EEPROM not code-protected

Gerardo
- 15th December 2013, 09:59
Hi, i have this problem when i try to use a external oscillator
when compile an error that like this appear

Overwritting previous adress contens (2007)

How i can fix that?

mackrackit
- 15th December 2013, 10:54
The answer is in the first five post of this thread.
Maybe you did not read the thread you posted to ?