Designing circuits with a longer lifetime
Before you start thinking about switching, make sure you have a good solid design. You need to start thinking about all the ways you could have problems in your design. A good way to do this is to stop thinking about a microprocessor as a "magic box" that you put code into and does what you tell it to and start thinking about how it functions, on a gate level and system level. You need to keep your microprocessor happy.
- Power - If the microprocessors power is not clean, it will not function correctly. That means looking at the PCB design and making sure you have a good low inductance pathway from your power supply and making sure you have adequate power caps close to the chip. Monitor and measure the power on a design you know doesn't work with an oscilloscope and voltmeter, is it the power? Do you see the problem happen when there is a spike or dip in the power? Do you see spikes or dips on your Vcc line?
- Code\Clock - Is there a fault in the code that is causing it to not function correctly? Have you looked at the code in an intermittent unit? Does it verify (match) the code that you have now? Are you getting flash degradation? What about the clock? Power can actually degrade the clock over time. Is your clock what it needs to be? If you slow the clock down does your code stop functioning?
- Environmental protection. Are you operating the microprocessor in the specs that it was designed for? Is the temperature constant in the units that fail? Are they in an area with environmental factors such as dust,EMI,ESD or Temperature that could cause it to fail. Are your inputs protected to the outside world, could people be zapping the unit? Heat will do bad things to electronics over time. Get a thermal camera an see if everything is normal
What you really need to do is find the failure mechanism, you need to know why it is failing. Once you know why its failing you can address the problem. If you cant find that then you will have to make your design invincible to stop any problems from occurring. If you don't you could switch microprocessors and still have the same problems. If you do want to switch, ST makes some great microprocessors that are more suited for industrial applications.
Since you don't say, I question how the troubled circuit is physically constructed - since this sounds like EXACTLY the type of problem that is typically seen when someone who does not solder constructs a circuit on a temporary "push to connect" breadboard and leaves it for a few months.
If this resembles your case, there's your problem; if not, I'd still suspect poor connections, but it becomes a "skill at soldering" issue more than a "failure to solder anything" issue.
You don't have a decoupling capacitor on the PIC supply, but on a small board like this you'll probably get away with it. You might also want to add brown-out protection so that the PIC is reset if the voltage drops below a threshold.
But I'd be looking at your code.
For starters, you should have the watchdog enabled on the micro. If the code stops working properly, the watchdog will restart it.
Most likely though, you've just got a bug somewhere. As an embedded software engineer by profession, I'd guess it's related to the interrupts, because that's where beginners most often make mistakes. As a beginner though, there's a massive set of mistakes you can make in code, so that's just the first place I'd look. (Don't be offended - I made a lot of those mistakes myself, including when I really should have known better. ;-)