16F676 programming problem


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default 16F676 programming problem

    I can't figure this one out.

    I'm using a 16F676 with a simple blinking LED program.

    Here is my code:

    @ DEVICE PIC16F676, INTRC_OSC_NOCLKOUT,WDT_ON, PWRT_OFF, MCLR_OFF, BOD_ON,PROTECT_OFF

    TRISA = %00000000
    TRISC = %00000000
    ANSEL = %00000000
    WPUA = %00000000

    START:
    HIGH PORTC.4
    PAUSE 1000
    LOW PORTC.4
    PAUSE 1OOO
    GOTO START

    Ok, so I program the chip and all works well. Then I adjust the code and I try to program it again after I modify the code (increasing the pause to pause 2000). Then part of the way through the programming it gives me a configuration error during programming. It fails the programming and then when I go to compile it again, it tells me that the target does not match the device or something like that and I can never program it again. However, the code works fine so I know the PIC is intact but I just can't program it again.

    So, I change to a brand new chip and complete the process over again only to get the exact same results. I've done this with 10 chips and it's all the same.

    What the heck is going on here??!! I've been using PIC's for the better part of four years and I've never had this problem. I tried two different versions of MELABS programmer but I still get the same thing. I'm using PBP 2.50 and MELABS programmer 4.01. I'm also using the ICSP as I've done many times before.

    Any ideas?

  2. #2
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Christopher4187 View Post
    I can't figure this one out.

    I
    @ DEVICE PIC16F676, INTRC_OSC_NOCLKOUT,WDT_ON, PWRT_OFF, MCLR_OFF, BOD_ON,PROTECT_OFF
    Internal oscillator and Master clear off is a combination that often does this. You need to use a Vpp-before-Vdd option in your programming software, if it exists. That should cure it, and reclaim all those chips you've tried, which are currently not (re)programmable.

    Regards,

    Anand

  3. #3
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Opps; forgot to mention, this wont work if you're using ICSP with an independent target supply. You'll need to put the chip in a socket / breadboard, and connect all ICSP signals *including* the switched Vdd from the programmer.

    Anand

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


    Did you find this post helpful? Yes | No

    Default

    Even if it never happened to me, I would bet on the MCLR_OFF. Some device programmer are a bit fussy on that. Seems Melabs don't recommend it on their website though.

    3. Configure MCLR as a RESET pin if possible. The programmer will attempt to reset the target device at the beginning of the programming process. If the MCLR pin is configured as an input, the programmer may have problems putting the chip into program-mode. This is especially problematic if the target has been previously programmed and is using the programming clock or data lines as outputs.

    In some situations, there just aren't enough pins to allow the use of a RESET. Your project will require that MCLR be used as an input. This is common on small, 8-pin PIC MCUs. In these cases, it helps to set the clock and data pins to inputs and place a delay at the beginning of your code. This will allow you to cycle power to the part and start the programming process while the pause is executing.

    In a PICBASIC PRO program intended for the PIC12F675, you might start with:

    TRISIO = $FF ' set all pins to inputs
    PAUSE 1000 ' wait a second

    This can make reprogramming much easier to accomplish when the programmer has no means to reset the target device
    Steve

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

Similar Threads

  1. PIC18F4620 Programming problem
    By JavPar in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 6th December 2008, 04:21
  2. 16F676 Please explain this problem...
    By Jayhovah in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th May 2008, 21:30
  3. Programming Problem with PIC16F819
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th July 2007, 18:42
  4. Problem programming the PIC16F648A
    By Edgardo_2 in forum General
    Replies: 2
    Last Post: - 29th December 2006, 00:02
  5. Problem during compilation 16F676
    By mat janssen in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th October 2005, 07:05

Members who have read this thread : 0

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