Presetting Configuration Fuses (PIC Defines) into your Program


+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 40 of 83
  1. #1
    Join Date
    Jul 2003
    Posts
    2,358

    Default Presetting Configuration Fuses (PIC Defines) into your Program

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



    1. What are the Configuration Fuses?

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


    2. How can I preset them in my Program?

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


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

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

    @ DEVICE XT_OSC

    or

    @ DEVICE PIC16F628,XT_OSC

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

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

    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/cont...o-your-Program
    Last edited by ScaleRobotics; - 8th June 2010 at 15:49.

  2. #2
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,619


    Did you find this post helpful? Yes | No

    Red face

    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

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Code:
    ;**************************************************************
    ;*  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 :
    Code:
    ;device  pic16F628, xt_osc, wdt_on, pwrt_on, mclr_on, lvp_off, protect_off
    OR
    Code:
    ;__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
    Code:
    ;==========================================================================
    ;
    ;       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
    Last edited by mister_e; - 5th March 2005 at 19:04.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,619


    Did you find this post helpful? Yes | No

    Wink

    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/W...locale=en.html

    read you soon
    Have a nice Sunday

    Alain

  7. #7
    RUBiksCUbe's Avatar
    RUBiksCUbe Guest


    Did you find this post helpful? Yes | No

    Talking

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

  8. #8
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    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!

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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...
    Code:
    @ __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
    Last edited by mister_e; - 29th October 2005 at 17:27.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    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

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

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

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

    The solution is still located at the same place... at the end of the 18XXXX.INC file located in the MPASM folder.
    Quote Originally Posted by Snip of MPASM 18F452.INC

    ; 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...
    Code:
    @ 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...
    Code:
    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...
    Last edited by mister_e; - 29th October 2005 at 23:32.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Nope can't get it going !!

    I've used
    Code:
    @ CONFIG FOSC = HS
    but it returns the error

    __CONFIG directives cannot be used with CONFIG directives

    I've even tried
    Code:
    @ CONFIG _CONFIG1H, _FOSC_HS_1H
    which returns the same error as above and also,
    Code:
    @ __CONFIG _CONFIG1H, _FOSC_HS_1H
    which returns two errors stating:
    Overwriting previous address contents (0000)
    Overwriting previous address contents (0001)

    Any ideas?

  13. #13
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    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.

  14. #14
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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:
    Code:
    ;****************************************************************
    ;*  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

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Code:
    ;****************************************************************
    ;*  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?
    Last edited by mister_e; - 30th October 2005 at 01:50.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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

  17. #17
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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?

  18. #18
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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.

  19. #19
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

  20. #20
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Nope, still getting stacks of errors.

    Here is exactly what i have at the tope of my code:
    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?

  21. #21
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Tissy... are you saying that modifying and saving your C:\PBP\18F2550.INC as follow
    Code:
    ;****************************************************************
    ;*  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...
    Code:
        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...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  22. #22
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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?

  23. #23
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.
    Code:
            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.
    Last edited by mister_e; - 30th October 2005 at 15:25.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  24. #24
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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

  25. #25
    Join Date
    Sep 2005
    Location
    delhi
    Posts
    14


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Tissy
    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

  26. #26
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Havin gtaken the .CFG route, Steve does yours come up with these errors?
    Code:
    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

  27. #27
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The CFG file is the one i post few post before. You just need to Indent your CONFIG lines as i did.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  28. #28
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    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.

  29. #29
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

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

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

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

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

  30. #30
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default Warning[230]: __CONFIG has been deprecated ...

    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.

  31. #31
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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)

    DT

  32. #32
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    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.

  33. #33
    vaidyasp1's Avatar
    vaidyasp1 Guest


    Did you find this post helpful? Yes | No

    Default Can you make a short papra of what to do....

    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.

  34. #34
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile PBC Options for Fuse Setting

    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

  35. #35
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    To save reading the thread Paul cited, this syntax (case insensitive) works with both PBC and PBP when using PM.
    Code:
    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
    Last edited by dhouston; - 2nd July 2006 at 16:47.

  36. #36
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    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 !

  37. #37
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,619


    Did you find this post helpful? Yes | No

    Wink

    Hi, Fratello

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

    just " cut and paste " needed !!!

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

  38. #38
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

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

  39. #39
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    The correct syntax is :
    INTOSC_OSC and not INTRC_IO ! I read in M16F62xA.INC.
    Thanks !

  40. #40
    Join Date
    Apr 2009
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    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

Similar Threads

  1. pic program crashing
    By comwarrior in forum General
    Replies: 5
    Last Post: - 8th July 2009, 17:33
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  4. size of program vs mem on pic
    By PICMAN in forum General
    Replies: 1
    Last Post: - 1st March 2005, 18:23
  5. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 16:45

Members who have read this thread : 10

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts