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
Below from Mister_e
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
To fix it, just comment those lines :
;device pic16F628, xt_osc, wdt_on, pwrt_on, mclr_on, lvp_off, protect_off
;__config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
OR some will prefer to edit those line directly... as you wish...
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
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
Warning[230] __CONFIG has been deprecated for PIC18 devices.
If you are using any PIC18 serie, you will have this warning one day or another. Our friends from Microchip decide to change the way to define the config fuses when using the latest MPASM version 5.00.From Darrel Taylor:
Fortunately, the old __CONFIG directives still work. The __CONFIG has been deprecated warning, is just that. A warning. And Warnings can be turned off. So until Microchip decides to make it not work anymore, what I'm doing is to add this line to the .inc file for the chip it's being compiled for.
errorlevel -230
From Mister_e:
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
Applications mobiles pour jouer en ligne - Quel bonus vous a le plus aide ?
Un autre avantage important est la simplicite des demarches. casino en ligne Le baccara, jeu emblematique des casinos, evolue constamment grace a l'innovation technologique. casino en ligne fiable...
JeffreyTe Yesterday, 21:16