reprogramming 16f676


Closed Thread
Results 1 to 9 of 9
  1. #1
    scorpion's Avatar
    scorpion Guest

    Default reprogramming 16f676

    Hi i wrote a program for the 16f676 and programmed it (ICSP) onto my board. I had some timing issues so i reworked the program and now it wont program again. (I am using the EPIC programmer)
    I thought it might be the chip or the programmer, so i tried another board. it programmed! but the timing still wasnt quite right. so i changed the program again, and this pic wont program. Its not an otp so.... any ideas????

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


    Did you find this post helpful? Yes | No

    Default

    Have you try to erase the PIC before reprogram it? what is your actual clock speed? Can you send some snip or the whole code if somebody here can find something?
    Steve

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

  3. #3
    scorpion's Avatar
    scorpion Guest


    Did you find this post helpful? Yes | No

    Default

    hi,
    i did try to erase it... many times.
    i am using the internal rc osc.
    and here is my code:

    upin var porta.0
    dwnin var porta.1
    upout var porta.4
    dwnout var portc.4
    ledout var porta.5

    adcon0 = 0
    ansel = 0
    cmcon = 7

    onbit var bit
    i var byte
    onbit = 0

    main:
    if upin = 1 then
    low dwnout
    onbit = 0
    high upout
    endif
    if upin = 0 then low upout
    if dwnin = 1 then goto float
    goto main





    float:
    if onbit = 1 then goto main

    for i = 1 to 100
    if dwnin = 0 then
    low dwnout
    goto main
    endif
    next i
    onbit = 1
    high dwnout
    goto main

    dont laugh at my code. im not a (very good) programmer.
    any ideas?

  4. #4
    Warrier's Avatar
    Warrier Guest


    Did you find this post helpful? Yes | No

    Default

    That's an interesting problem you have - I had a similar experience with 12F629 where the chip behaved properly if all my timing was using PAUSE but failed to reprogram when using the NAP in my code... Finally I ended up using the extended temperature version of the device (12F629E/P instead of the I/P) and haven't had any problems since!

    I had to use NAP to keep power consumption low - do you have a similar situation?

    -warrier

  5. #5
    scorpion's Avatar
    scorpion Guest


    Did you find this post helpful? Yes | No

    Default

    no nap, no pause. thats my whole code, just a good old fashion for next loop

  6. #6
    scorpion's Avatar
    scorpion Guest


    Did you find this post helpful? Yes | No

    Default

    i tried to erase it again. The epic says that erase sucessfull or something even if there is no chip in there, so i don know how well I can trust it. anyways. I tried to run it and it was deffenatly erased. the board does nothing now. and it still doesnt reprogram.

  7. #7
    scorpion's Avatar
    scorpion Guest


    Did you find this post helpful? Yes | No

    Default

    ok so I found the problem.... its sleep. i think i need more.
    apperently pics dont like 12 V on an input pin......

    sorry to all 54 people who wasted their time reading this and to warrier and mr.e answering me.
    Is there anyway this thread can be deleted to stop any more of my embarrassment?
    -scorp

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


    Did you find this post helpful? Yes | No

    Default

    hehe bah don't be shy, you can't imagine how many time it happen to everybody here one day or another. I'm sure you'll not redo the same error two times
    Steve

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

  9. #9
    Warrier's Avatar
    Warrier Guest


    Did you find this post helpful? Yes | No

    Default

    Actually you need a pat on your back! You solved a problem by yourself that we couldn't visualize just by reading your code - it's the best way to learn and don't be embarrassed. When dealing with peripherals sometimes it is a good thing to make sure one has a reasonable configurations - chips usually fail through hardware issues - but software often gets carries the blame....

    -warrier

Similar Threads

  1. Debug @ 9600 on 4Mhz 16F676
    By sougata in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th March 2007, 14:51
  2. 16F676 Interupt
    By BGreen in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th March 2006, 20:56
  3. SEROUT workaround for 16F676
    By rkeene0517 in forum Code Examples
    Replies: 0
    Last Post: - 12th February 2006, 03:39
  4. Using 16f676 with comms
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2005, 20:01
  5. 16F676 Help?
    By vicce in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th August 2005, 05:26

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