Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic 16f886 firm ware getting currepted

Status
Not open for further replies.

raman00084

Full Member level 6
Joined
Nov 29, 2010
Messages
362
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
4,006
i have found a problem in pic 16f886 with ccs cpmplier, i am controlling a stepper motor i have done 5 same kits testing for a weak, in the testing period i found one kit not working junk values in lcd and motor not running, i thought the chip is faulty, then finally i re flashed the program every thing got normal and the kit is working. i have found this problem many times in pic how to aviod this kindly help.

regards
kalyan
 

Please show a schematic. It is probably an electical issue rather than software. Are you using LVP mode to program the PIC?

Brian.
 

You have not really given us much to go on, but I'll make a couple of guesses:
1) you are using the on-board data EEPROM that your chip has
2) you are not clearing the EEADRH register when you try to write to the data EEPROM and/or not properly handling the EEPGD bit
3) therefore when perform the write operation, you are actually writing to the program flash and not the data EEPROM, thereby corrupting the program
4) worse still, as the flash write occurs in blocks of 8 words, the values in memory above the one you are trying to write will also be written to the flash memory
I know you are dealing with a stepper motor and those things are notorious for putting noise onto supply and data lines, but the chances that the noise could emulate the programming signal sequence is vanishingly small.
The bottom line is that the flash memory is unlikely to be changing by itself and therefore you need to look at your program for the actual cause and, because of the similarity of the way you write to flash and data I an guessing that the problem lies there.
Susan
 

Hi,

Maybe supply voltage is not stable. OR voltage on I/O pins are out of range..spikes?

Or frequency is not stable.

Klaus
 

the schematic are as per the requirement of microchip site. i am not using lvp
 
  • Like
Reactions: betwixt

    betwixt

    Points: 2
    Helpful Answer Positive Rating
the schematic are as per the requirement of microchip site
Still not very helpful. Are you copying a schematic from their web site and if so, which schematic is it?

If the problem is electrical it means something else in the circuit is producing voltages which are outside the absolute limits of the PIC or is dipping the voltage and crashing it during EEPROM write operations. The PIC has good under-voltage protection and should halt EEPROM writes to prevent corruption but if your software is writing multiple bytes it is possible the later ones will not have time to complete before all the data is stored. As it seems it is your program rather than data memory that corrupts that isn't a likely scenario unless you are using program memory as RAM.

As Susan points out, stepper motors and other inductive devices tend to sink and/or source spikes of current and these could be reaching back to the PIC. Without schematics to see how you have it wired we can't give specific advice, only general comments on possible reasons.

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top