PIC18F26J11 Configuration bits

The configuration bits are important part to set the project efficiently and not have problems when uploading it to the microcontroller. MPLAB help menu contain a topic for this specifications which contain each pic from all their families will each individual configurations settings and commands.

The Pic18 contain all this introductions to set its configurations bits. The configuration is done by using the pragma command. Which microchip defines as:

Pragma; A directive that has meaning to a specific compiler…The ANSI C standard provides each C implementation a method for defining unique constructs, as required by the architecture of the target processor. This is done using the #pragma directive. (2005, Microchip)

Below you have an example of all the configuration bits from the pic18f26j11.

/** C O N F I G U R A T I O N B I T S ******************************/#pragma config WDTEN = OFF //Watchdor timer OFF

#pragma config STVREN =OFF //Stack overflow/Underflow Rest
#pragma config XINST = OFF //Extended Instruction Set OFF
#pragma config DEBUG = OFF //Background DEbug OFF
#pragma config CP0 = OFF //Progam memory is not code-protected
#pragma config OSC = INTOSC //Internal Oscilator
#pragma config T1DIG = OFF //Secondary Oscillator clock source may not be selected
#pragma config LPT1OSC = OFF //High power operation
#pragma config FCMEN = OFF //Fail-Safe clock monitor Off
#pragma config IESO = OFF //Internal External Oscillator Switch Over mode
#pragma config WDTPS = 1 //Watchdog Postcaler = 1.1 in this case
#pragma config DSWDTOSC = INTOSCREF //RTCC clock select, RTCC uses INTRC
#pragma config DSBOREN = OFF //Deep Sleep BOR; Dissable
#pragma config DSWDTEN = OFF //Deep Sleep Watchdog Timer; Disable
#pragma config DSWDTPS = 2 //Deep Sleep Watchdog Postcaler; 1:2(2.1ms) 
#pragma config IOL1WAY = OFF //The IOLOCK bit (PPSCON<0>) 
#pragma config MSSP7B_EN = MSK7 //5 or in this case 7 bit address masking mode
#pragma config WPFP = PAGE_0 //Write protect program flash page 0 
#pragma config WPEND = PAGE_0 //Page 0 throught WPFP<0:5>erase/write protected                    
#pragma config WPCFG = OFF //Configutation words page not erase/write protected
#pragma config WPDIS = OFF //WPFP<5:0>/WPEND region ignored*/

The following code was used for the arm-robot configuration as it was assumed that the rest will be set as default.

#pragma config OSC = INTOSC
#pragma config WDTEN = OFF, XINST = OFF
#pragma config IOL1WAY = ON

 

Leave a Reply

Your email address will not be published. Required fields are marked *