hardware for programming pic controller

Thread Starter

Seema01

Joined Jan 11, 2020
53
I'm programming my PIC controller on board...After programming it, the circuit works fine for 1 month but the program misfunctions after that. Can anyone suggest a good on circuit hardware for 18f4520 controller?
 

Ian Rogers

Joined Dec 12, 2012
915
I very much doubt the flash program is changing... Someting else is wrong.. Your circuit or your software.

I predominately use a pickit 3 to program my chips, but it will be no different with " in circuit" if the program writes and verifies the program won't change.. Maybe your variables are being manipulated wrong.. Software bugs are horrible.. A 0 in one of your divisions can halt operation..
 

Beau Schwabe

Joined Nov 7, 2019
100
Your direct drive to TR1 is most likely the problem ... you need to buffer it with a transistor to drive the transformer.

Even though you have a diode across TR1, the forward voltage across that diode is 1.1 V .... so your injecting a negative voltage into the substrate of the PIC. The PIC has protection diodes built into the I/O's but not designed for the back emf currents produced by TR1. Over time, this will eventually kill the PIC.

A schottky diode would be better across TR1, but ideally you should buffer the I/O with a transistor.
 
Last edited:

Thread Starter

Seema01

Joined Jan 11, 2020
53
Your direct drive to TR1 is most likely the problem ... you need to buffer it with a transistor to drive the transformer.

Even though you have a diode across TR1, the forward voltage across that diode is 1.1 V .... so your injecting a negative voltage into the substrate of the PIC. The PIC has protection diodes built into the I/O's but not designed for the back emf currents produced by TR1. Over time, this will eventually kill the PIC.

A schottky diode would be better across TR1, but ideally you should buffer the I/O with a transistor.
Thanks. Will try.
 

LesJones

Joined Jan 8, 2017
3,472
Have you tried reading the program memory from the pic after it has failed and comparing it with the data that was programmed into it ? It may be worth doing this more than once to see if it is the same locations in program memory that have been changed.
Does any of the code intentionally write to program memory ? It could be some code that is trying to write to EEPROM writing to the wrong address. (Or the The EEPGD control bit set to the wrong state when attempting to write to EEPROM.)

Les.
 

Thread Starter

Seema01

Joined Jan 11, 2020
53
Never thought of that. I'll try.
Have you tried reading the program memory from the pic after it has failed and comparing it with the data that was programmed into it ? It may be worth doing this more than once to see if it is the same locations in program memory that have been changed.
Does any of the code intentionally write to program memory ? It could be some code that is trying to write to EEPROM writing to the wrong address. (Or the The EEPGD control bit set to the wrong state when attempting to write to EEPROM.)

Les.
 

Ian Rogers

Joined Dec 12, 2012
915
Here's one I did..

I used flash as a "kinda" dataloger. This was on a pic32.. I forgot to loop my "log" counter when It maxed out... When the 16 bit counter reached max, you have to re-point to the start... It went to 0 and wiped out quite a few bytes of code... I had to do what you just did.. Pitfalls of programming...
 
Top