Presetting Configuration Fuses (PIC Defines) into your Program


+ Reply to Thread
Results 1 to 40 of 83

Hybrid View

  1. #1
    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

  2. #2
    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?

  3. #3
    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.

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


    Did you find this post helpful? Yes | No

  5. #5
    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?

  6. #6
    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.

  7. #7
    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

  8. #8
    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.

  9. #9
    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?

  10. #10
    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 14:25.
    Steve

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

  11. #11
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    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.

  12. #12
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    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?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  13. #13
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    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.
    Last edited by ScaleRobotics; - 16th June 2010 at 17:24.

  14. #14
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    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.
    Last edited by Bruce; - 16th June 2010 at 17:41.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  15. #15
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    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.

  16. #16
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Walter,

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

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. pic program crashing
    By comwarrior in forum General
    Replies: 5
    Last Post: - 8th July 2009, 16: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, 14:46
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. size of program vs mem on pic
    By PICMAN in forum General
    Replies: 1
    Last Post: - 1st March 2005, 17:23
  5. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45

Members who have read this thread : 2

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