• 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.

PIC chip keeps restarting

Status
Not open for further replies.

gois

New Member
Hi
I have written some code for a PIC16F874A to write a test message to an LCD module. After the message is written, I have the command "goto $".
When I simulate the program in MPLAB, naturally, the "goto $" puts the program in an infinate loop.
However, when I put the program on to the pic, it just keeps resetting once it has written the message, which means it clears the screen, reinitialises the LCD and then writes the message, and then starts all over again and again. I have tried making other similar loops and adding a delay in the loop, but no matter what, I cant get the thing to enter an infinate loop. I have tried this with a PIC16F874 and it does the same, and i just cant figure out why.
does anyone have any ideas of how to get the thing to stop. Oh and the watch dog timer is switched off.
Any help please!!
- Mike
 

TheAnimus

New Member
okay first off, post your "init" commands, where you are turning off the watch dog timer etc.

Also u might wanna try using somthing like
Code:
NOP
GOTO $-1
Also put a suitable capacitor across +5v and GND inputs. Tantalium (i can never spell it correctly :p) type for preferance.
 

jcastillo

New Member
gois,

I had a similiar problem to yours this past month. I too was writing the code to enter an indefinate loop once a condition was met, and like yours the PIC seemed to keep resetting. By accident, I found setting the watch dog timer ON in the configuration menu allowed my code to work correctly ( did not reset anymore). The thing is, I am not intending too use the WDtimer. In my code all prescaling instructions are configured for my TMR0 timer. I do not fully understand why this made a difference. I'm still studying my code and tinkering but my project is now working so i'm happy.

I hope this helps.
 

motion

New Member
Even if the watchdog timer were disabled, see if the ff. code fixes the problem:

Code:
LOOP:
     CLRWDT
     GOTO    LOOP
You lose nothing by inserting the CLRWDT instruction.
 

pike

Member
I had the same problem too with my old 16f84a recently. But i found out that my battery voltage had dropped down to about 2 volts which was causing the malfuctions.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top