LTlib LaurTec Library  4.0.3
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
PIC16F877A_config.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3 Author : Mauro Laurenti
4 Version : 1.2
5 Created on Date : 18/11/2015
6 Last update : 30/07/2016
7 
8 CopyRight 2006-2016 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 PIC16F877A.
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 PIC16F877A_CONFIG_H
49 #define PIC16F877A_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 #define ADC_LIBRARY_SUPPORTED
66 
67 
68 //******************************************************************************
69 // Module Types
70 //******************************************************************************
71 #define UART_MODULE_TYPE_4
72 #define SPI_MODULE_TYPE_4
73 #define I2C_MODULE_TYPE_4
74 #define ADC_MODULE_TYPE_4
75 
76 
77 //******************************************************************************
78 // Peripheral configurations
79 //******************************************************************************
80 #define NUMBER_OF_IO_PORTS 5
81 
82 #define ADC_WITH_NO_ANSEL_REG
83 
84 #define PULL_UP_RESISTORS_AVAILABLE
85 #define PULL_UP_ENABLE_BIT OPTION_REGbits.nRBPU
86 
87 #define ADC_NUMBER_OF_CHANNELS 8
88 #define ADC_ENABLE_BIT ADCON0bits.ADON
89 #define ADC_START_CONVERSION_BIT ADCON0bits.GO
90 #define ADC_CHANNEL_SELECTION_REGISTER ADCON0
91 #define ADC_BUFFER_HIGH ADRESH
92 #define ADC_BUFFER_LOW ADRESL
93 #define ADC_JUSTIFICATION ADCON1bits.ADFM
94 #define ADC_SETTINGS_0 ADCON0
95 #define ADC_SETTINGS_1 ADCON1
96 
97 #define ADC_CH0 0x00000001
98 #define ADC_CH1 0x00000002
99 #define ADC_CH2 0x00000004
100 #define ADC_CH3 0x00000008
101 #define ADC_CH4 0x00000010
102 #define ADC_CH5 0x00000020
103 #define ADC_CH6 0x00000040
104 #define ADC_CH7 0x00000080
105 
106 
107 //******************************************************************************
108 // MCU configurations
109 //******************************************************************************
110 #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
111 #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
112 #pragma config PWRTE = ON // Power-up Timer Enable bit (PWRT enabled)
113 #pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
114 #pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
115 #pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
116 #pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
117 #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
118 
119 #endif