1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Error programming 16F628

Discussion in 'Microcontrollers' started by gregmcc, Aug 20, 2005.

  1. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    OK.

    I can't recommend you one because I don't know which one can read the hex file with gaps in them.

    The problem is mainly a gap in your hex file. The data from 0002 to 0007 is missing so the programming software(s) don't like it a bit.

    Perhaps you can try another hex file or our Jay can provide you with one.

    Or try the following one that I patched(filled in the gaps) by hand.

    Edited: for correctness "The data from 0002 to 0007...."
     

    Attached Files:

  2. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    Try IC-Prog.
     
  3. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    I was watchnig this topic, but I didn't want to interfere until I heard my name here :D
    Yes try Ic-prog, maybe that would help, or I can (as suggested before) make you a sample LED blinking program.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,213
    Likes:
    640
    Location:
    Derbyshire, UK

    By all means try IC-Prog, it's always worth a try, but the problem is most probably your poor construction?.

    In almost all of these types of programmers you need VERY! short wires between the buffer chip on the programmer and the actual PIC. This is because they use passive pull-ups, and any slight capacitance from longer wires will cause problems.
     
  6. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    Even though I suggested trying IC-Prog, I am now convinced the long wires are at fault, especially since it appears that program memory is different after each try.

    I am 85% sure the wires' length is guilty here. ;)
     
  7. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    There's no point in trying another type of programmer if you don't make this one work.

    You're very close to success, don't give up now. It's 99% done.

    If I don't hear from you soon, I'm taking the next plane to wherever you live and I'll make sure you finish it :twisted:

    Come on, you're almost there...
     
  8. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    would the length of the wires from the parallel port connector to the board make a differnce. they're untwisted, but about 10 cm long. on the underneath of my verboard i've also used a bit of kynar wire to join tracks (30awg). could that also be a problem?

    i've tried the blinking led program, but when i build the pic with the led, it doesnt do anything. the led doesnt come on.

    its almost 1am here and if I dont put the programmer down now - its going to end up in little pieces. thanks for all the help - i'll try again tomorrow. its gotta be something simple :)
     
  9. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    Forget about the LED blinking program for now. You want WinPicProg and/or IC-Prog to tell you that the program memory is fine after a programming session. It should verify program memory successfully.

    I'd say that right now, any unshielded ~10cm piece of wire is a prime suspect.

    Think about it, if every time you program the PIC, the memory content is close to your .hex file, with slight random differences. it's gotta be noise/interference somewhere on the signal path...

    You're close to success...
     
  10. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    I cannot agree with you on this. There is no random difference in this case. All the bytes are programmed correctly except where there is a discontinuity in the hex file memory address where the bytes are then shifted.

    The problem is the hex file or the ability of software to interpret the hex file properly.

    I attached a proper hex file in the previous post for gregmcc to try but I guess he didn't. :(
     
  11. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    eblc1388: thanks - I haven't tried your hex code yet. I'll try it asap before I make any other changes and let you know what happens.
     
  12. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    A even better orgainised hex file for you to try if the previous one still fails.
     

    Attached Files:

  13. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    eblc1388 :

    This is from gregmcc's first post. That's what I am refering to, and I am assuming this is still the case. Different random values get written where programming fails, other parts of program memory are fine. Maybe gregmcc can confirm this is still the case...
     
  14. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    Yes. But then he posted the source and the result and it changes everything.

    There are a lot of bytes in the programmed PIC. There is no value error in all of the bytes except two bytes is missing. This is anything but random.
     
  15. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    But this is only true for the one time he posted the results. How do you know the programmer behaves the same every time?

    Also, Nigel Goodwin, from his post, doesn't sound like he thinks his software is at fault.

    I think we're both assuming too much and gregmcc should clarify this : do you get similar/identical results everytime, or does the programed memory content jump around like crazy every time you try to program it?
     
  16. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    at last I've got some good news!! :D

    tried eblc1388's code on WinPicProg - the code programs and verifies 100% - everytime.

    Then tried the original blinking led code - its writes the same values everytime, but fails on verify. (on WinPicProg)

    I've just downloaded a programmer called PicAllW - the original code and eblc1388's code programs and verifies 100%

    Ive just programmed the original code and built the led blinker, and lo and behold the led blinks!!! Woooo Hooo!!!!

    No sure why it doesnt work with WinPicProg though. But thanks for all the help for everyone.
     
  17. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    Hmm strange, Nigel's SW should be OK. Have you tried Ic-prog ?
     
  18. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    Congrats to Mr. Chung then. He correctly diagnosed the problem about 2 pages worth of posts ago!

    gregmcc, you realize you had a working programmer all this time, n'est-ce pas? :p
     
  19. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    yip - cant get it to work at all with icprog.

    Yip - I now realize it :( Oh well - its goes towards learning :)
     
  20. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,213
    Likes:
    640
    Location:
    Derbyshire, UK
    I've just tried it here with WinPicProg, and the original HEX code posted, and it works fine!. As long as it's a valid HEX file it shouldn't make any difference, but strange things happen?.

    As your programmer wouldn't work with IC-Prog I wonder if there's a hardware problem somewhere?. IC-Prog should work, assuming you have it configured correctly?.

    WinPicProg is the fastest parallel port PIC programmer software, basically because it ONLY programs the bytes that are needed, so for your HEX file it programs the first byte (the GOTO), skips over the next three, then starts programming again from the GOTO target address.

    I can only suspect that something in your hardware is preventing the first two bytes being written when it starts programming again?.
     
  21. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    anythings possible - but I dont have a clue how to fix it :)

    maybe sometime i'll build another programmer from scratch and see how it goes.
     

Share This Page