• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microchip controllers confusion.

Status
Not open for further replies.
I am confused with the following configuration in microchip controllers where oscillator setting and watchdog setting are done above main. How is this possible without entering into main when this code is executed?
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
In C the compiler has a "pre process" compilation process... Everything above the main falls into this category...

The compiler will need to know function definitions all prama's and includes before the complilation of the main function..
 

DirtyLude

Well-Known Member
This isn't actually code, it's configuration bits on the chip. It's simply a memory location that the compiler writes the configuration words to on the chip. When the PIC starts it checks these bit's internally and sets itself up before running any code. PIC compilers have special functions in order to tell the compiler and linker what goes in these bits when it programs the chip.

"The device configuration bits allow each user to customize certain aspects of the device to the needs of the application. When the device powers up, the state of these bits determines the modes that the device uses."
 

Jon Wilder

Active Member
#pragma config is a compiler directive. Everything passed to this directive gets written to the configuration word memory space.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top