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.

Problem with PIC16f876 in MPLAB 6.60 as the PIC resets all the time

Status
Not open for further replies.

Tulkas

Member level 4
Joined
May 30, 2002
Messages
70
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
646
Hi, i have been using pics several years and i have never had this problem. Few time after pic start running it reset. I have not programed it with watchdog and other configuration bits wich could cause the reset. i have used debugger of the mplab and i can see something extrain. I use some delays subroutines and they are used continuosly during the program, but there is a point in the code where there is a call to a delay subroutine and in that subroutine there is other call to other delay subroutine, when the second call is executed the value of the stack in the first position change to the initial position of the code, and then when it execute the second return the program reset. I have this:

Code:
          ORG     0x000
              
             goto    ini

          ORG     0x004
             .
             .
             .
             retfie
   
          ORG     0x100

ini
             .
             .
             .
             call    delay1
             .
             .
             goto   $

delay1
             .
             .
             call   delay2
             return

delay2
             .
             .
             .
             return


               end

Always the stack change to the first position of the code in 0x101, if i write the code in ORG 0x60 for example stack change to 0x61, for that reason i'm not sure that a reset take place, and there isn't any jump to the label 'ini'. Anybody can help me?.

Sorry for my english, sorry for the post, sorry for all. Thanks
:D
 

pic resets all time

Hi,

What PIC are you using?
Also, try to download from the Microchip web site the Errata and see if there is anything there that you might be doing.

If you found my answer useful, click on the button that says Helped me. ( NO points will be taken from you! )


Good luck.
 

    Tulkas

    Points: 2
    Helpful Answer Positive Rating
Re: pic resets all time

It could be because you have a lot of code writen between the returns. It's been so long since i dont use PIC, as long as i recall, the jumps in a program are not to any position you want, there are boundries to those jumps depending on the instruction you use to do the jumps.

Like using relative jumps to XX instructions before, you can not use this instruction to do long jumps ause the pointer have those boundries and when it excedes the number of iunstructions it resets and starts counting again from 0.

Check the datasheet for the description on the jumping instructions.

Hope you solve your problem.

Take it easy.
 

pic resets all time

check ur MCLR... check whether it is pull high enuff...

low MCLR will make the pic not stable n it will keep on hardware reset...

sp
 

pic resets all time

Wat kind of PIC you are using?

Maybe you have a stack overflow.
 

Re: pic resets all time

I am using pic16f876 with MPLAB 6.60, i haven't stack overflow because i see it with debugger and i can see clearly what the pic is doing. With respect to the jumps and boundaries, i think with goto instruction you can access to all memory positions, i read that in datasheet, but i don't know if the same thing happens with call instruction, i need to have a look to the datasheet.
 

Re: pic resets all time

The worst question: hardware or software

Have you tried, "commenting" routines one after the other to see when that resetting stops?

Or do it the other way round. Start with the real possible minimum and keep adding software to see when that starts happening again.

Breadboard or PCB?
 

Re: pic resets all time

did u used watchdog timer
if yes then u should clear the watchdog timer before it gets overflow
otherwise it will resets the controller
 

Re: pic resets all time

I also have the same problem before.
Please check your LVP bit.

Enabling LVP bit will cause your controller go into low voltage programming mode.
Thus, you will see that your controller go "reset".
 

pic resets all time

I agree with DarkJedi. Make sure you setup PCLATH correctly before your call. If it's jumping to 0x101 or 0x61 instead of 0x00, it's NOT a reset. Remember, call like goto gets the two high bits from PCLATH.
 

Re: pic resets all time

I am sorry to have been late so much in answering.

i had an indirect access to memory into one loop and pic was getting crazy.

Thank you for everyting.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top