Detailed explanation for PIC boot sequence

microcontrollerpic

I have doubts about the boot sequence of about every microcontroller but since I own a PIC I figure I should start with those first. I would like someone to explain how the PIC's boot sequence progresses. While explaining that I would also like to know how the PIC sets its clock setting such as internal or external clock without first knowing which one to use does it use its internal clock and then sets the clock to external once the register has been set?

Best Answer

PIC don't really have "boot sequences", since that's a software abstraction and there is no standard software that runs on a PIC, like a bios on a PC. PIC are generally programmed with code that performs a dedicated task, usually without a operating system. The code is stored in the same non-volatile memory it is executed from (except some PIC 32s can be set up to execute from RAM), so there is nothing to "boot".

The diferrent PIC architectures vary a bit in what happens on powerup or after a reset, but mostly execution just starts at a single known address. The start of your code has to be at that address.

As for configuration settings that have to be made before any code can execute, like the oscillator selection, these are stored in the configuration bits. These are special non-volatile bits that are used directly by the hardware.

This is, of course, all described in detail in the datasheet or family reference manual.