Microcomputer Fundamentals
Stack Pointer SP (Stack Pointer)
"Picture this, everyone: a microcontroller running code is just like you reading an incredibly thick novel (and that novel is the Flash memory).
Your eyes can't take in a whole page at once — you have to read it line by line. To keep from losing your place, you'd use your index finger to point at whatever line you're reading right now. Finish a line, and the finger slides down one line.
That index finger used for pointing the way is the PC (Program Counter)!
What the PC holds is always an address, which is basically telling you: 'Boss CPU, which line of code should be executed next?'
What if a phone call suddenly comes in (an interrupt)? What do you do? You'd write down where your finger is currently pointing on a slip of paper (saving the context), then run off to answer the call. When you're back, you glance at the slip of paper, point your finger back at that line, and keep reading! But if you forcibly bend that finger over to a blank page full of gibberish (say, pointing it at 0x00000000), you'll instantly freeze up and the whole thing dies — that's a HardFault!"
Summary: the value of the PC register is the location of the next piece of code to be executed — extremely important!!