1 | #include <xc.h>
|
2 |
|
3 | #pragma config FOSC = IRC // Oscillator Selection bits (Internal RC oscillator)
|
4 | #pragma config PLLEN = OFF // 4 X PLL Enable bit (PLL is under software control)
|
5 | #pragma config PCLKEN = ON // Primary Clock Enable bit (Primary clock enabled)
|
6 | #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor disabled)
|
7 | #pragma config IESO = OFF // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)
|
8 |
|
9 | // CONFIG2L
|
10 | #pragma config PWRTEN = OFF // Power-up Timer Enable bit (PWRT disabled)
|
11 | #pragma config BOREN = SBORDIS // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
|
12 | #pragma config BORV = 19 // Brown Out Reset Voltage bits (VBOR set to 1.9 V nominal)
|
13 |
|
14 | // CONFIG2H
|
15 | #pragma config WDTEN = OFF // Watchdog Timer Enable bit (WDT is controlled by SWDTEN bit of the WDTCON register)
|
16 | #pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768)
|
17 |
|
18 | // CONFIG3H
|
19 | #pragma config HFOFST = ON // HFINTOSC Fast Start-up bit (HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.)
|
20 | #pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled, RA3 input pin disabled)
|
21 |
|
22 | // CONFIG4L
|
23 | #pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
|
24 | #pragma config LVP = ON // Single-Supply ICSP Enable bit (Single-Supply ICSP enabled)
|
25 | #pragma config BBSIZ = OFF // Boot Block Size Select bit (1kW boot block size)
|
26 | #pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
|
27 |
|
28 | // CONFIG5L
|
29 | #pragma config CP0 = OFF // Code Protection bit (Block 0 not code-protected)
|
30 | #pragma config CP1 = OFF // Code Protection bit (Block 1 not code-protected)
|
31 |
|
32 | // CONFIG5H
|
33 | #pragma config CPB = OFF // Boot Block Code Protection bit (Boot block not code-protected)
|
34 | #pragma config CPD = OFF // Data EEPROM Code Protection bit (Data EEPROM not code-protected)
|
35 |
|
36 | // CONFIG6L
|
37 | #pragma config WRT0 = OFF // Write Protection bit (Block 0 not write-protected)
|
38 | #pragma config WRT1 = OFF // Write Protection bit (Block 1 not write-protected)
|
39 |
|
40 | // CONFIG6H
|
41 | #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers not write-protected)
|
42 | #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot block not write-protected)
|
43 | #pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM not write-protected)
|
44 |
|
45 | // CONFIG7L
|
46 | #pragma config EBTR0 = OFF // Table Read Protection bit (Block 0 not protected from table reads executed in other blocks)
|
47 | #pragma config EBTR1 = OFF // Table Read Protection bit (Block 1 not protected from table reads executed in other blocks)
|
48 |
|
49 | // CONFIG7H
|
50 | #pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot block not protected from table reads executed in other blocks)
|
51 |
|
52 | #define _XTAL_FREQ 1000000
|
53 |
|
54 |
|
55 | #include <stdio.h>
|
56 | #include <stdlib.h>
|
57 |
|
58 |
|
59 | void main(void)
|
60 | {
|
61 | ANSEL=0x00;
|
62 | ANSELH=0x00;
|
63 | TRISC=0x00;
|
64 | LATC=0x00;
|
65 |
|
66 | while(1);
|
67 | {
|
68 | LATC=~LATC;
|
69 | __delay_ms(500);
|
70 | }
|
71 |
|
72 | }
|