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

gidimiz

Advanced Member level 1
Advanced Member level 1
Joined
Feb 3, 2005
Messages
427
Helped
125
Reputation
250
Reaction score
41
Trophy points
1,308
Activity points
5,157
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

DarkJedi

Full Member level 2
Full Member level 2
Joined
May 25, 2004
Messages
145
Helped
9
Reputation
18
Reaction score
1
Trophy points
1,298
Location
Lima, Perú
Activity points
1,722
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.
 

sp

Full Member level 6
Full Member level 6
Joined
Jan 1, 2004
Messages
395
Helped
23
Reputation
46
Reaction score
2
Trophy points
1,298
Location
Floating Garden
Activity points
4,044
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
 

are

Advanced Member level 4
Full Member level 1
Joined
Nov 16, 2004
Messages
109
Helped
17
Reputation
34
Reaction score
11
Trophy points
1,298
Location
Balen (Belgie)
Activity points
644
pic resets all time

Wat kind of PIC you are using?

Maybe you have a stack overflow.
 

Tulkas

Member level 4
Member level 4
Joined
May 30, 2002
Messages
70
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
646
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.
 

atferrari

Full Member level 4
Full Member level 4
Joined
Jun 29, 2004
Messages
237
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Location
Buenos Aires - Argentina
Activity points
1,996
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?
 

pvinbox@yahoo.com

Full Member level 2
Full Member level 2
Joined
May 28, 2004
Messages
125
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,298
Location
Coimbatore, INDIA
Activity points
944
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
 

ckmai

Newbie level 2
Newbie level 2
Joined
Dec 14, 2005
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,304
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".
 

jonw0224

Full Member level 4
Full Member level 4
Joined
Nov 22, 2004
Messages
211
Helped
45
Reputation
90
Reaction score
14
Trophy points
1,298
Location
USA
Activity points
2,528
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.
 

Tulkas

Member level 4
Member level 4
Joined
May 30, 2002
Messages
70
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
646
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top