setting config fuses not working


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108

    Default setting config fuses not working

    Okay guys, stop rolling your eyes... another fuse configuration not working.

    I'm using a PIC16F628A and I need pins RA6 and RA7 for I/O so will use the internal oscillator. The config fuse (with assembler directive) for this using MPASM for the assembler is:

    @__CONFIG_INTRC_OSC_NOCLKOUT
    @__CONFIG_INTOSC_OSC_NOCLKOUT

    Alas, this does not work. So, using the MeLabs programmer bit configurator, I select INTOSCIO. Then it works.

    I do select "Update configuration from file" and "Reread file before programming".
    Using PBP3.0 and Microcode Studio 5.0

    Your help to newbie is appreciated.

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


    Did you find this post helpful? Yes | No

    Default Re: setting config fuses not working

    The new PBP3.0 is setup for #config statements. Details here: http://www.picbasic.co.uk/forum/show...963#post110963

    With the assembly statements, it will see a fight between the .pbpinc configs which are preset in the default configs, and the ones you are trying to set inside your code. It errors out, showing you one trying to overwrite the other. When you use the #config statement, it knows you want to over ride the default configs.

    Try putting it in the context (page 100 of the manual):

    Code:
    #CONFIG
        __CONFIG  _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    http://www.scalerobotics.com

  3. #3
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: setting config fuses not working

    Thanks, I did find that in the manual on page 97 while I was waiting for a reply.
    This is what I've got: (space in column 1)
    #config
    __CONFIG _INTRC_OSC_NOCLKOUT
    __CONFIG _INTOSC_OSC_NOCLKOUT
    #endconfig

    I don't get compile errors with this syntax, but I get an ASM error "Overwriting previous address contents". As a result the Meprog programmer menu doesn't open (because of the error). I open the programmer manually and program. All is well...except the program doesn't work. It's at this point where I can change the bits in the programmer configuration menu to INTOSCIO and the program does work.

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


    Did you find this post helpful? Yes | No

    Default Re: setting config fuses not working

    Hi queenidog.

    You will have to pick either one, but not both.

    Either use

    #config
    __CONFIG _INTRC_OSC_NOCLKOUT
    #endconfig

    or

    #config
    __CONFIG _INTOSC_OSC_NOCLKOUT
    #endconfig

    Depending on which one you want to use, probably INTOSC.

    The options Are:

    ; __CONFIG labels for PIC16F628A:
    ;
    ;CONFIG Options
    ;
    ; Oscillator Selection bits
    ; _RC_OSC_CLKOUT ;RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN
    ; _ER_OSC_CLKOUT ;RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN
    ; _RC_OSC_NOCLKOUT ;RC oscillator: I/O function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN
    ; _ER_OSC_NOCLKOUT ;RC oscillator: I/O function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN
    ; _INTOSC_OSC_CLKOUT ;INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    ; _INTRC_OSC_CLKOUT ;INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    ; _INTOSC_OSC_NOCLKOUT ;INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    ; _INTRC_OSC_NOCLKOUT ;INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    ; _EXTCLK_OSC ;EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN
    ; _HS_OSC ;HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN
    ; _XT_OSC ;XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN
    ; _LP_OSC ;LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN
    Last edited by ScaleRobotics; - 21st April 2012 at 18:24.
    http://www.scalerobotics.com

  5. #5
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: setting config fuses not working

    Well hot damn, it this didn't work! Thanks.

    I guess I didn't understand the difference between the two so picking both was a good thing. (I did this with two girlfriends once when I was in grade IV, they both ended up hating me).

    So what is the difference? I used intosc.

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


    Did you find this post helpful? Yes | No

    Default Re: setting config fuses not working

    You raise a good question. Looking into it further, there is no difference. I looked at the data sheet, and it says you have 8 options:
    Code:
    111 = RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN
    110 = RC oscillator: I/O function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN
    101 = INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    100 = INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    011 = EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN
    010 = HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN
    001 = XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN
    000 = LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN
    Then looking at the .info file, it shows 20 options, which doesn't quite make sense. Looking closer, we have to look into the microchip .inc files, located here: C:\Program Files (x86)\Microchip\MPASM Suite\P16F628A.inc

    Here there are 3 internal options with no clockout which all have the same EQU number.
    Code:
    _FOSC_INTOSCIO       EQU  H'3FFC'    ; INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    _INTOSC_OSC_NOCLKOUT EQU  H'3FFC'    ; INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    _INTRC_OSC_NOCLKOUT  EQU  H'3FFC'    ; INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    So, I guess you can use any one of the above and get the same result.
    Last edited by ScaleRobotics; - 22nd April 2012 at 16:33.
    http://www.scalerobotics.com

  7. #7
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: setting config fuses not working

    More info:

    You said to "use either but not both" and that's good advice because if I use EITHER, it works. If I use both, it don't work!

    I used INTOSC because it was more "intuitive" in the language. I think the INTRC is an older term that was "deprecated" as they say, but still works for compatibility.

    Either one works, but not at the same time.

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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