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] Random execution of code after a reset.

Status
Not open for further replies.

ArvindEdaB

Newbie level 4
Joined
Oct 11, 2018
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
96
Hi All,

I think All strange problems are with me...:p:(

After the code is flashed On first power On, the code works fine...

And I start executing some part code by external USART Messages which ends up with an intentional WDGT reset..

Once reset happens...

Code starts behaving in weird manner...

The Execution directly starts executing the "DoSomething" in default without even calling the function....

This is how the Template code is


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void SomeFunction(void)
{
  Switch( Variable )
  {
      case 1:
           Do Something;
           break;
      case 2:
           Do Something:
           break;
      default:
            Dosomething;
            break;
    }
}




How come this could happen...

Can anyone helpme with this thing??
 

We would have to see the full code but usually this happens because some variable isn't initialized. A hardware reset and a watchdog reset are not identical, you should refer to the data sheet to see the state of registers after each occurs.

Brian.
 

I second the call to see all of the code (or, preferably, a short but complete code example that demonstrates the problem).
What device?
Can you explain how you are determining where the code starts after a WDT reset?
As the code is 'C', I'm certain that there will be code executed as part of the C runtime that sets things up before the 'main' is called. Are you setting a breakpoint in this startup code or just somewhere in your own code?
Susan
 

PIC and other 8-bit microcontrollers doesn't support core fault vectors, in case of any troubles with pointers they just getting crazy. That's why learning with arms or linux is better for begginers. You can at least understand where you doing something wrong and stop guessing.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top