PDA

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


Melanie
- 12th July 2004, 17: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

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

Acetronics
- 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

Acetronics
- 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, 22: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, 16: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, 17: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, 17: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, 18: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
- 30th October 2005, 00: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, 01: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.