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.

What happens inside the microcontroller?

Status
Not open for further replies.

maanas

Newbie level 6
Joined
Aug 14, 2009
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,378
micro controller problem

hi everyone
i want to know what actually happens inside the controller when micro controller hangs.

if micro controller jumps to unprogrammed area (by any problem) then will program counter revert back to the reset value after traversing to all the nop instructions.

please help
 

Re: microcontroller problem

That depends on where the program pointer 'landed' after the crash.

It is quite possible that an opcode was executed saying 'jump back one instruction' so it stuck in a loop forever.

Brian.
 

Re: microcontroller problem

For that use Watch Dog Timer it will restart the microcontroller if it hangs
 

Re: microcontroller problem

maanas said:
hi everyone
i want to know what actually happens inside the controller when micro controller hangs.

if micro controller jumps to unprogrammed area (by any problem) then will program counter revert back to the reset value after traversing to all the nop instructions.

please help

possible,if the program jumps to unknown area of your program, the microcontroller executes nothing..thus, it appears like it hangs up..also, if you are calling procedures, you should put a return syntax, so that your program will return to where it is called..otherwise if you dont the program will executes the next line..
hope this answers your query..:D
 

Re: microcontroller problem

if micro controller jumps to unprogrammed area (by any problem) then will program counter revert back to the reset value after traversing to all the nop instructions.

No, it will not. As mentioned, the watchdog timer will cause it to vector to the reset address.
 

Re: microcontroller problem

i am talking about the case when we are not using watch dog timer.

if controller hangs in an indefinite loop then we can't do nothing but what about unprogrammed area or NOP area.

so the controller design is such that even if it gets stuck in unprogrammed area the program counter will not revert back to 0000 after executing all nop instructions.
 

Re: microcontroller problem

Good programming practice says fill the unused areas with code that will *TRY* to recover the situation. For example, fill with NOP instructions so at least no harm is done and the program counter eventually rolls over back to the reset vector. A better way is to fill the space with instructions to jump to the reset vector but again, if the instruction is multi-byte, you could crash into the middle of the instruction and do something completely different.

Of course, there's no guarantee you crash into unused memory anyway, you could be running loops in your existing code or polling some hardware that will never respond.

In short, apart from a hardware watchdog AND suitably written code to reset it, there is no way to be sure of recovery.

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top