September 22, 2017

What happens when power is given to microcontroller or a processor, Part – 2

So after reaching the power reset vector what does it do ? (Click  here to read the first part)

Simple it starts executing the instruction in order, according to PC(Program counter). As we understood from the part-1 The processor does initialization of the registers and then does a reset on the PC. After executing the first instruction, it increments the program counter, which will point to to the next instruction in program memory. This will keep on going until power is given to the chip or it goes to sleep mode.

Now if the PC value keep on incrementing how does we have the full control of the chip. That’s what the instruction written in the program does. When we write if, else,  while condition what is actually happening inside the chip, it changes the program counter so that the next instruction will be the jump to new instruction set we had written for a particular logic.  So it is upto the programmer to write the instruction to meet the task the micro controller/processor has to execute.