LTlib LaurTec Library  4.0.1
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
PIC18F4550_config.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3 Author : Mauro Laurenti
4 Version : 1.2
5 Created on Date : 02/02/2013
6 Last update : 30/01/2016
7 
8 CopyRight 2006-2013 all rights are reserved
9 
10 ********************************************************
11 SOFTWARE LICENSE AGREEMENT
12 ********************************************************
13 
14 The usage of the supplied software imply the acceptance of the following license.
15 
16 The software supplied herewith by Mauro Laurenti (the Author)
17 is intended for use solely and exclusively on Microchip PIC Microcontroller (registered mark).
18 The software is owned by the Author, and is protected under applicable copyright laws.
19 All rights are reserved.
20 Any use in violation of the foregoing restrictions may subject the
21 user to criminal sanctions under applicable laws (Italian or International ones), as well as to
22 civil liability for the breach of the terms and conditions of this license.
23 Commercial use is forbidden without a written acknowledgement with the Author.
24 Personal or educational use is allowed if the application containing the following
25 software doesn't aim to commercial use or monetary earning of any kind.
26 
27 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
28 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
29 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
30 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT,
31 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
32 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
33 
34 ********************************************************
35 PURPOSES
36 ********************************************************
37 
38 This file contains all the configuration words needed for the PIC18F4550.
39 It can be easily adapted to other PICs according to the available configurations.
40 
41 ****** WARNING ******
42 
43 The configurations must be changed to reflect the application needs!
44 
45 *******************************************************************************/
46 
47 
48 #ifndef PIC18F4550_CONFIG_H
49 #define PIC18F4550_CONFIG_H
50 
51 #ifdef __XC8
52  #include <xc.h>
53 #endif
54 
55 
56 //******************************************************************************
57 // LTlib configurations
58 //******************************************************************************
59 #define IO_LIBRARY_SUPPORTED
60 #define INT_LIBRARY_SUPPORTED
61 #define UART_LIBRARY_SUPPORTED
62 #define SPI_LIBRARY_SUPPORTED
63 #define I2C_LIBRARY_SUPPORTED
64 #define EEPROM_LIBRARY_SUPPORTED
65 
66 
67 //******************************************************************************
68 // Peripheral configurations
69 //******************************************************************************
70 #define UART_MODULE_TYPE_1
71 #define SPI_MODULE_TYPE_1
72 #define I2C_MODULE_TYPE_3
73 
74 #define NUMBER_OF_IO_PORTS 5
75 
76 #define ADC_WITH_NO_ANSEL_REG
77 
78 #define PULL_UP_RESISTORS_AVAILABLE
79 #define PULL_UP_ENABLE_BIT INTCON2bits.RBPU
80 
81 
82 //******************************************************************************
83 // MCU configurations
84 //******************************************************************************
85 // CONFIG1L
86 #pragma config PLLDIV = 1 // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
87 #pragma config CPUDIV = OSC1_PLL2// System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
88 #pragma config USBDIV = 2 // USB Clock Selection bit (used in Full-Speed USB mode only; UCFG:FSEN = 1) (USB clock source comes from the 96 MHz PLL divided by 2)
89 
90 // CONFIG1H
91 #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator (HS))
92 #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
93 #pragma config IESO = OFF // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)
94 
95 // CONFIG2L
96 #pragma config PWRT = ON // Power-up Timer Enable bit (PWRT enabled)
97 #pragma config BOR = OFF // Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
98 #pragma config BORV = 0 // Brown-out Reset Voltage bits (Maximum setting 4.59V)
99 #pragma config VREGEN = OFF // USB Voltage Regulator Enable bit (USB voltage regulator disabled)
100 
101 // CONFIG2H
102 #pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
103 #pragma config WDTPS = 1 // Watchdog Timer Postscale Select bits (1:1)
104 
105 // CONFIG3H
106 #pragma config CCP2MX = ON // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
107 #pragma config PBADEN = OFF // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
108 #pragma config LPT1OSC = OFF // Low-Power Timer 1 Oscillator Enable bit (Timer1 configured for higher power operation)
109 #pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
110 
111 // CONFIG4L
112 #pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
113 #pragma config LVP = OFF // Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
114 #pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming Port (ICPORT) Enable bit (ICPORT disabled)
115 #pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
116 
117 // CONFIG5L
118 #pragma config CP0 = OFF // Code Protection bit (Block 0 (000800-001FFFh) is not code-protected)
119 #pragma config CP1 = OFF // Code Protection bit (Block 1 (002000-003FFFh) is not code-protected)
120 #pragma config CP2 = OFF // Code Protection bit (Block 2 (004000-005FFFh) is not code-protected)
121 #pragma config CP3 = OFF // Code Protection bit (Block 3 (006000-007FFFh) is not code-protected)
122 
123 // CONFIG5H
124 #pragma config CPB = OFF // Boot Block Code Protection bit (Boot block (000000-0007FFh) is not code-protected)
125 #pragma config CPD = OFF // Data EEPROM Code Protection bit (Data EEPROM is not code-protected)
126 
127 // CONFIG6L
128 #pragma config WRT0 = OFF // Write Protection bit (Block 0 (000800-001FFFh) is not write-protected)
129 #pragma config WRT1 = OFF // Write Protection bit (Block 1 (002000-003FFFh) is not write-protected)
130 #pragma config WRT2 = OFF // Write Protection bit (Block 2 (004000-005FFFh) is not write-protected)
131 #pragma config WRT3 = OFF // Write Protection bit (Block 3 (006000-007FFFh) is not write-protected)
132 
133 // CONFIG6H
134 #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) are not write-protected)
135 #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot block (000000-0007FFh) is not write-protected)
136 #pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM is not write-protected)
137 
138 // CONFIG7L
139 #pragma config EBTR0 = OFF // Table Read Protection bit (Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks)
140 #pragma config EBTR1 = OFF // Table Read Protection bit (Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks)
141 #pragma config EBTR2 = OFF // Table Read Protection bit (Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks)
142 #pragma config EBTR3 = OFF // Table Read Protection bit (Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks)
143 
144 // CONFIG7H
145 #pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot block (000000-0007FFh) is not protected from table reads executed in other blocks)
146 
147 #endif