Advertisement
AtomSoft

PIC18F27J53_CONFIGBITS

Mar 25th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 8.11 KB | None | 0 0
  1. /*
  2.  *  Copyright (c) 2011-2012, http://atomsoft.wordpress.com
  3.  *  All rights reserved.
  4.  * 
  5.  *  Thanks go out to Proprojects.wordpress.com
  6.  *
  7.  *  Redistribution and use in source and binary forms, with or without modification,
  8.  *  are permitted provided that the following conditions are met:
  9.  *
  10.  *  1.- Redistributions of source code must retain the above copyright notice,
  11.  *      this list of conditions and the following disclaimer.
  12.  *  2.- Redistributions in binary form must reproduce the above copyright notice,
  13.  *      this list of conditions and the following disclaimer in the documentation
  14.  *      and/or other materials provided with the distribution.
  15.  *
  16.  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  17.  *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18.  *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19.  *  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  20.  *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21.  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  22.  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23.  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
  24.  *  WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25.  */
  26.  
  27. /*********************************************************************
  28.  * By:              Jason Lopez
  29.  * Company:         http://atomsoft.wordpress.com
  30.  * Processor:       PIC18
  31.  * Compiler:        C18 v3.4
  32.  * File Name:       18F27J53_ConfigBits.h
  33.  * Description:     PIC18F27J53 Configuration Bits
  34.  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35.  * Rev.     Date        Comment
  36.  * 1.0      xx/xx/xx    Initial version
  37.  *********************************************************************/
  38.  
  39. #ifndef __18F27J53_CONFIGBITS_H
  40. #define __18F27J53_CONFIGBITS_H
  41.  
  42.     #pragma config WDTEN = OFF          // Watchdog Timer:
  43.                                         // OFF          Disabled - Controlled by SWDTEN bit
  44.                                         // ON           Enabled
  45.                                        
  46.     #pragma config PLLDIV = 3           // PLL Prescaler Selection:
  47.                                         // 12           Divide by 12 (48 MHz oscillator input)
  48.                                         // 10           Divide by 10 (40 MHz oscillator input)
  49.                                         // 6            Divide by 6 (24 MHz oscillator input)
  50.                                         // 5            Divide by 5 (20 MHz oscillator input)
  51.                                         // 4            Divide by 4 (16 MHz oscillator input)
  52.                                         // 3            Divide by 3 (12 MHz oscillator input)
  53.                                         // 2            Divide by 2 (8 MHz oscillator input)
  54.                                         // 1            No prescale (4 MHz oscillator input drives PLL directly)
  55.                                        
  56.     #pragma config CFGPLLEN = ON        // PLL Enable Configuration Bit:
  57.                                         // ON           PLL Enabled
  58.                                         // OFF          PLL Disabled
  59.                                        
  60.     #pragma config STVREN = OFF         // Stack Overflow/Underflow Reset:
  61.                                         // OFF          Disabled
  62.                                         // ON           Enabled
  63.                                        
  64.     #pragma config XINST = OFF          // Extended Instruction Set:
  65.                                         // OFF          Disabled
  66.                                         // ON           Enabled
  67.                                        
  68.     #pragma config CPUDIV = OSC1        // CPU System Clock Postscaler:
  69.                                         // OSC4_PLL6    CPU system clock divide by 6
  70.                                         // OSC3_PLL3    CPU system clock divide by 3
  71.                                         // OSC2_PLL2    CPU system clock divide by 2
  72.                                         // OSC1         No CPU system clock divide
  73.                                        
  74.     #pragma config CP0 = OFF            // Code Protect:
  75.                                         // ON           Program memory is code-protected
  76.                                         // OFF          Program memory is not code-protected
  77.                                        
  78.     #pragma config OSC = HSPLL          // Oscillator:
  79.                                         // INTOSC       INTOSC
  80.                                         // INTOSCO      INTOSCO (CLKO-RA6)
  81.                                         // INTOSCPLL    INTOSCPLL
  82.                                         // INTOSCPLLO   INTOSCPLLO (CLKO-RA6)
  83.                                         // HS           HS, USB-HS
  84.                                         // HSPLL        HS+PLL, USB-HS+PLL
  85.                                         // EC           EC (CLKO-RA6), USB-EC
  86.                                         // ECPLL        EC+PLL (CLKO-RA6), USB-EC+PLL
  87.                                        
  88.     #pragma config SOSCSEL = DIG        // T1OSC/SOSC Power Selection Bits:
  89.                                         // RESERVED     Reserved
  90.                                         // LOW          Low Power T1OSC/SOSC circuit selected
  91.                                         // DIG          Digital (SCLKI) mode selected
  92.                                         // HIGH         High Power T1OSC/SOSC circuit selected
  93.                                        
  94.     #pragma config CLKOEC = OFF     // EC Clock Out Enable Bit:
  95.                                         // OFF          CLKO output disabled on the RA6 pin
  96.                                         // ON           CLKO output enabled on the RA6 pin
  97.                                        
  98.     #pragma config FCMEN = OFF          // Fail-Safe Clock Monitor:
  99.                                         // OFF          Disabled
  100.                                         // ON           Enabled
  101.                                        
  102.     #pragma config IESO = OFF           // Internal External Oscillator Switch Over Mode:
  103.                                         // OFF          Disabled
  104.                                         // ON           Enabled
  105.                                        
  106.     //#pragma config WDTPS = 32768      // Watchdog Postscaler:
  107.                                         // 1            1:1
  108.                                         // 2            1:2
  109.                                         // 4            1:4
  110.                                         // 8            1:8
  111.                                         // 16           1:16
  112.                                         // 32           1:32
  113.                                         // 64           1:64
  114.                                         // 128          1:128
  115.                                         // 256          1:256
  116.                                         // 512          1:512
  117.                                         // 1024         1:1024
  118.                                         // 2048         1:2048
  119.                                         // 4096         1:1096
  120.                                         // 8192         1:8192
  121.                                         // 16384        1:16384
  122.                                         // 32768        1:32768
  123.                                        
  124.     #pragma config DSWDTOSC = INTOSCREF // DSWDT Clock Select:
  125.                                         // T1OSCREF     DSWDT uses T1OSC/T1CKI
  126.                                         // INTOSCREF    DSWDT uses INTRC
  127.                                        
  128.     #pragma config RTCOSC = INTOSCREF   // RTCC Clock Select:
  129.                                         // INTOSCREF    RTCC uses INTRC
  130.                                         // T1OSCREF     RTCC uses T1OSC/T1CKI
  131.                                        
  132.     #pragma config DSBOREN = OFF        // Deep Sleep BOR:
  133.                                         // OFF          Disabled
  134.                                         // ON           Enabled
  135.                                        
  136.     //#pragma config DSWDTPS = G2           // Deep Sleep Watchdog Postscaler:
  137.                                         // 2            1:2 (2.1 ms)
  138.                                         // 8            1:8 (8.3 ms)
  139.                                         // 32           1:32 (33 ms)
  140.                                         // 128          1:128 (132 ms)
  141.                                         // 512          1:512 (528 ms)
  142.                                         // 2048         1:2,048 (2.1 seconds)
  143.                                         // 8192         1:8,192 (8.5 seconds)
  144.                                         // K32          1:32,768 (34 seconds)
  145.                                         // K131         1:131,072 (135 seconds)
  146.                                         // K524         1:524,288 (9 minutes)
  147.                                         // M2           1:2,097,152 (36 minutes)
  148.                                         // M8           1:8,388,608 (2.4 hours)
  149.                                         // M33          1:33,554,432 (9.6 hours)
  150.                                         // M134         1:134,217,728 (38.5 hours)  
  151.                                         // M536         1:536,870,912 (6.4 days)
  152.                                         // G2           1:2,147,483,648 (25.7 days)
  153.     #pragma config IOL1WAY = OFF        // IOLOCK One-Way Set Enable bit:
  154.                                         // OFF          The IOLOCK bit (PPSCON<0>) can be set and cleared as needed
  155.                                         // ON           The IOLOCK bit (PPSCON<0>) can be set once
  156.                                        
  157.     #pragma config ADCSEL = BIT12       // ADC 10 or 12 Bit Select:
  158.                                         // BIT12        12 - Bit ADC Enabled
  159.                                         // BIT10        10 - Bit ADC Enabled
  160.                                        
  161.     #pragma config MSSP7B_EN = MSK7     // MSSP address masking:
  162.                                         // MSK5         5 Bit address masking mode
  163.                                         // MSK7         7 Bit address masking mode
  164.                                        
  165.     //#pragma config WPFP = PAGE_0      // Write/Erase Protect Page Start/End Location:
  166.                                         // PAGE_1       Write Protect Program Flash Page 1
  167.                                         // PAGE_2       Write Protect Program Flash Page 2
  168.                                         // PAGE_...     Write Protect Program Flash Page ...
  169.                                         // PAGE_126     Write Protect Program Flash Page 126
  170.                                         // PAGE_127     Write Protect Program Flash Page 127
  171.                                        
  172.     #pragma config WPCFG = OFF          // Write/Erase Protect Configuration Region :
  173.                                         // ON           Configuration Words page erase/write-protected
  174.                                         // OFF          Configuration Words page not erase/write-protected
  175.                                        
  176.     #pragma config WPDIS = ON           // Write Protect Disable bit:
  177.                                         // ON           WPFP[5:0], WPEND, and WPCFG bits enabled
  178.                                         // OFF          WPFP[6:0], WPEND, and WPCFG bits ignored
  179.                                        
  180.     #pragma config WPEND = PAGE_0       // Write/Erase Protect Region Select bit (valid when WPDIS = 0):
  181.                                         // PAGE_0       Page 0 to WPFP<6:0> erase/write-protected
  182.                                         // PAGE_WPFP    Pages WPFP<6:0> to (Configuration Words page) write/erase protected
  183.                                        
  184.     #pragma config LS48MHZ = SYS48X8    // Low Speed USB mode with 48 MHz system clock bit:
  185.                                         // SYS24X4      System clock at 24 MHz USB CLKEN divide-by is set to 4
  186.                                         // SYS48X8      System clock at 48 MHz USB CLKEN divide-by is set to 8
  187.  
  188. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement