Strange pic 16f877a memory loss


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113

    Default Strange pic 16f877a memory loss

    Hi, Well I had a really strange thing happen to my pic controller last night. For some reason or another the program was entirely erased off the pic or it became corrupted to the point it no longer functioned. I've been using the above controller with my program as a test for the past couple of months and it's been working fine without incidence until this morning that sometime in the night it died. I uploaded my program and everything is working fine now. My question would be what can cause something like this that would wipe the program out or corrupt it? Could it be the fact that almost all of the pins are wired directly to headers and nothing is tied to ground that is not in use? Could it just be a faulty pic? A little over a week ago we had a near miss on our house with lightning and we did have some damage to some electrical appliances in the home but the pic didn't seem to be affected directly at that time since it had continued to work for over a week after the storm. I didn't think the lightning damaged it but maybe a delayed damage?

    I know the controller board you will see if you follow the link above is for a 16f877 but I mounted a spare 16f877a on it, and it's always worked fine. I am careful with my program to make sure I have the correct things turned on and off for the 877a so thats never been an issue.

    If anyone has any ideas or suggestions they are appreciated.
    David

  2. #2
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Did you read out

    Hi,

    Did you try to read out the program memory from the faulty pic? How do you know you really had a problem? Do you have brown out turned on or off?

    Sometimes if BOR is off and the pic gets crazy pulling the plug on it might not be enought to reset it properly if BOR is turned off. The pic will continue runing on the charge in caps and power adapters. Pulling MCLR to GND will help :-)

    Also make sure low voltage programming is turned off or if you use that function make sure that pin is controlled properly ( if 877A has that feature)

    AND make sure you program is set up properly for the 877A. You can not run the same program on a 877 as an 877A without getting problems :-)

    One time is a freak accident.... 2 times is a bad habit

  3. #3
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jumper View Post
    Hi,

    Did you try to read out the program memory from the faulty pic? How do you know you really had a problem? Do you have brown out turned on or off?

    Sometimes if BOR is off and the pic gets crazy pulling the plug on it might not be enought to reset it properly if BOR is turned off. The pic will continue runing on the charge in caps and power adapters. Pulling MCLR to GND will help :-)

    Also make sure low voltage programming is turned off or if you use that function make sure that pin is controlled properly ( if 877A has that feature)

    AND make sure you program is set up properly for the 877A. You can not run the same program on a 877 as an 877A without getting problems :-)

    One time is a freak accident.... 2 times is a bad habit
    '16F877A specifics and Defines
    @ DEVICE pic16F877A, HS_OSC ' System Clock Options
    @ DEVICE pic16F877A, WDT_ON ' Watchdog Timer
    @ DEVICE pic16F877A, PWRT_ON ' Power-On Timer
    @ DEVICE pic16F877A, BOD_ON ' Brown-Out Detect
    @ DEVICE pic16F877A, LVP_ON ' Low-Voltage Programming
    @ DEVICE pic16F877A, CPD_OFF ' Data Memory Code Protect

    That board has a reset on it and the first thing I did was a simple reset and that did nothing. I unplugged it and left it unplugged for a minute or two then plugged it back in and still got nothing. I hplugged the RS232 in because I did have my program outputting some stats and I got nothing. So after trying reset a few more times and unplugging it a couple of times thats when I decided to load the program back on it. I did try and do a download but I have to be honest I had no idea if it downloaded the same program or not. Winpic indicated it was donwloading something and there was garbage in the HEX window but I've no way of knowing if it was garbage or was the original program I loaded, I did not save it. I uploaded my program again and it just went back to working like before.

    I am making sure I have the correct codes for the 877a I've never hd a problem before and the programmer I have won't program this unless LVP is on. I am wondering now what "Data Memory Code Protect" is perhaps that should be on. This is the first time I have every had a problem like this with these pic's.
    Thanks
    David

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I've seen eproms program correctly, and then verify without fault...
    But as soon as you take them out of the programmer they loose their contents like ram...
    Turns out it was a faulty batch...

  5. #5
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by comwarrior View Post
    I've seen eproms program correctly, and then verify without fault...
    But as soon as you take them out of the programmer they loose their contents like ram...
    Turns out it was a faulty batch...
    The thing about this is that it's been running non-stop without incident for a couple of months so I doubt this was a bad batch. I'm thinking it might have had something to do the storm and the close proximity lightning strike we had or perhaps the fact that most of the pins are left hanging tied to nothing. Maybe there was a build up or something.

    Thanks
    David

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


    Did you find this post helpful? Yes | No

    Default

    I've seen that happen several times.
    Most of my stuff is on Yachts and Oil rigs, so they take a lot of lightning strikes.

    Occasionally, a few bit's in both Flash (program memory) and/or EEPROM will get erased (to a 1). Not whole bytes, just random individual bits. Depending on which bits get erased, almost any problem imaginable can happen. Sometimes only one function doesn't work right anymore, other times it's just dead, locked up in a loop somewhere. Sometimes other components are black and crispy, other times all components are fine and only the memory got changed.

    Too bad you didn't save the download, a comparison with the original hex could have confirmed the hypothesis.

    I originally started out with Basic Stamps, which were a lot worse than PIC's. Their program corrupts if a butterfly farts nearby. And lightning usually takes them out completely.

    The PIC's were always fine, just reload and go.

    I've tried all kinds of MOV's, and Transient suppressors, and gas discharge tubes, but it still happens. Since a nearby strike normally enters through the "ground" on a boat, there's nowhere to shunt it to. So I stopped using them all together, because they create problems of their own as well.

    It's amazing that the lightning strike seems to affect the boat captains memory too. It's not till he finds out that there won't be any repair cost, that he suddenly remembers, oh yeah, it must have been that lightning strike we took. (lightning damage isn't covered by the warranty).
    <br>
    DT

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,804


    Did you find this post helpful? Yes | No

    Default

    Darrel, do you have your devices in metal enclosures?

    I had similar effects on devices placed in the car parkings and were exposed in the open. But were built in plastics...

    I wonder why the other electronics on-board still work, or not?

    Ioannis

  8. #8
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    Thanks everyone for your input. It appears this lightning strike was the cuplrit. If I ever see this again I plan on saving the downloaded code to see how much it actually deviates from the original source.

    Appreciate everyones time on this.

    David

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  2. help my bluetooth and PIC 16F877A?
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2008, 06:52
  3. Two PIC 16F877A fried in two days!
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th January 2007, 10:38
  4. Memory Loss??
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th October 2006, 11:10
  5. Matching PIC memory and program size?
    By manxman in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th August 2006, 08:02

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