+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2013
    Posts
    546

    Default PIC16F887 fuse config statements for PBP anyone?

    Hello.

    Due to project complexity, I have to switch to PIC16F887.

    I have two programmers, DIY K-149BC, which does not supports that IC, and I also have Microchips Pickit 2 device, which supports this chip, but has no config window for fuzes. So I want to know how to set MCLR=DISABLE, enable internal oscillator and so on.

    Any ideas?

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

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    DT

  3. #3
    Join Date
    Feb 2013
    Posts
    546

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    Wow thanks!

    Will try it today.

  4. #4
    Join Date
    Feb 2013
    Posts
    546

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    A little question, how to set frequency of internal oscillator?

    There's no such setting under FOSC tab.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,259

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    Hi,
    It's not in meConfig because setting the oscillator frequency is not done via the CONFIG words, you need to write the appropriate value to the OSCCON register.

    /Henrik.

  6. #6
    Join Date
    Feb 2013
    Posts
    546

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    Yes I understand but why not?

    They have done such nice utility, why not finish it properly?

  7. #7
    Join Date
    Feb 2013
    Posts
    546

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    here's sample code, it flashes and verifies ok, but does not works (led does not blink)

    Code:
    ;----[16F887 Hardware Configuration]--------------------------------------------
    #IF __PROCESSOR__ = "16F887"
      #DEFINE MCU_FOUND 1
    #CONFIG
    cfg1 = _INTRC_OSC_NOCLKOUT    ; INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    cfg1&= _WDT_ON                ; WDT enabled
    cfg1&= _PWRTE_OFF             ; PWRT disabled
    cfg1&= _MCLRE_OFF             ; RE3/MCLR pin function is digital input, MCLR internally tied to VDD
    cfg1&= _CP_OFF                ; Program memory code protection is disabled
    cfg1&= _CPD_OFF               ; Data memory code protection is disabled
    cfg1&= _BOR_ON                ; BOR enabled
    cfg1&= _IESO_ON               ; Internal/External Switchover mode is enabled
    cfg1&= _FCMEN_ON              ; Fail-Safe Clock Monitor is enabled
    cfg1&= _LVP_OFF               ; RB3 pin has digital I/O, HV on MCLR must be used for programming
    cfg1&= _DEBUG_ON              ; In_Circuit Debugger enabled, RB6/ICSPCLK and RB7/ICSPDAT are dedicated to the debugger
      __CONFIG _CONFIG1, cfg1
    
    cfg2 = _BOR40V                ; Brown-out Reset set to 4.0V
    cfg2&= _WRT_OFF               ; Write protection off
      __CONFIG _CONFIG2, cfg2
    
    #ENDCONFIG
    
    #ENDIF
    
    ;----[Verify Configs have been specified for Selected Processor]----------------
    ;       Note: Only include this routine once, after all #CONFIG blocks
    #IFNDEF MCU_FOUND
      #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
    #ENDIF
    define osc 4
    OSCCON=%01100111
    
    
    kikli:
    high portc.5
    pause 500
    low portc.5
    pause 500
    goto kikli

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,259

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    Hi,
    Because (and this is of course my opinion, I can't speak for Darrel or meLabs), it's a utility designed for producing code (not actual code but rather directives to the compiler/assembler) that sets the CONFIG fuses correctly - and that's what it does. CONFIG is part of flash memory, it is being set when the device is programmed. OSCCON is SFR (RAM) and is set at runtime.

    If OSCCON, why not ADCON, ANSEL, TRIS, CMCON, TMR, BAUDCTL, SSPCON, INTCON, EECON, PIR, PCON, CCPR, WRCON, WPUB, OPTION_REG, SR_CON.....?

    /Henrik.

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,259

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    Hi,
    What's your powersupply voltage? You have BOR enabled @4V so anything below that will hold the chip in reset.
    Try leaving OSCCON.0 = 0.

    Finally, and this doesn't matter in THIS particular case, all define statements are case sensitive and all PBP defines are defined UPPER CASE so it must be define OSC xx or it'll behave as it wasn't even there.

    /Henrik.

  10. #10
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default Re: PIC16F887 fuse config statements for PBP anyone?

    You could try ANSEL=0 to set your ports digital which could prevent the LED from turning on.

Similar Threads

  1. Config fuse i n PBP3.0 - PIC16F828A
    By IapIllc in forum FAQ - Frequently Asked Questions
    Replies: 4
    Last Post: - 4th March 2013, 06:21
  2. PBP array in ASM statements
    By pedja089 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 30th May 2011, 20:04
  3. Help with config fuse?
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th December 2009, 21:14
  4. PIC16F887 Config problem
    By Agent36 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th November 2008, 22:38
  5. time for PBP statements
    By fnovau in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 25th October 2006, 19:42

Members who have read this thread : 1

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