AnsweredAssumed Answered

Software reset and program counter on MC9S08DV32

Question asked by Sebastian Paul on Jan 17, 2012
Latest reply on Jan 20, 2012 by Sebastian Paul

Hi,

 

i want to reset my mircocontroller by software. After the reset the controller should start at Startup and do everything from the beginning (start at reset vector, load variables with initial values, load the main() function, etc.). I've read that i can do this f.e. through ILOP Code, so i try it with this:

 

asm bgnd; //Reset

 

 When the program enters this instruction, my hardware obvoisly resets (leds in my ciruit turn shortly off) but the code continues after the reset at the next line next to the reset command, and doesn't begin from startup?! In the controllers datasheet i find: "During reset, most control and status registers are forced to initial values and the program counter is loaded from the reset vector (0xFFFE:0xFFFF)." But the program counter holds it old value. Also the RAM variables hold their old values.

 

How can i reset correctly?

I also try "asm jmp _Startup;" and it works... but i doesn't really know what happens with the old values in stack and stack pointer?

 

I am working with CodeWarrior 5.9.0, with Device Initialization, C-Code

Outcomes