pic24_configbits.c

Go to the documentation of this file.
00001 /*
00002  * "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")"
00003  * All rights reserved.
00004  * (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University)
00005  * (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University)
00006  * (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University)
00007  *
00008  * Permission to use, copy, modify, and distribute this software and its
00009  * documentation for any purpose, without fee, and without written agreement is
00010  * hereby granted, provided that the above copyright notice, the following
00011  * two paragraphs and the authors appear in all copies of this software.
00012  *
00013  * IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
00014  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
00015  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
00016  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00017  *
00018  * THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
00019  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00020  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
00021  * ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
00022  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
00023  *
00024  * Please maintain this header in its entirety when copying/modifying
00025  * these files.
00026  *
00027  *
00028  */
00029 
00030 
00031 // Documentation for this file. If the \file tag isn't present,
00032 // this file won't be documented.
00066 #include "pic24_all.h"
00067 
00069 
00070 #if (defined(__PIC24HJ12GP202__) || \
00071 defined(__PIC24HJ12GP201__) || \
00072 defined(__PIC24HJ32GP202__) || \
00073 defined(__PIC24HJ32GP202__) || \
00074 defined(__PIC24HJ16GP304__) || \
00075 defined(__DOXYGEN__)) // NOTE: DOXYGEN only used for documentation generation
00076 
00077 
00102 _FBS(BWRP_WRPROTECT_OFF);
00103 
00104 /* FSS: Secure Code Segment Configuration Register
00105 ** Not present on this chip.
00106 */
00107 
00127 _FGS(GSS_OFF & GCP_OFF & GWRP_OFF);
00128 
00129 
00148 _FOSCSEL(FNOSC_FRC & IESO_OFF);
00149 
00174 _FOSC(FCKSM_CSECMD & IOL1WAY_OFF & OSCIOFNC_ON & POSCMD_SEL);
00175 
00176 
00211 _FWDT(FWDTEN_OFF & WINDIS_OFF & WDTPRE_PR128 & WDTPOST_PS512);
00212 
00231 _FPOR(FPWRT_PWR16 & ALTI2C_OFF);
00232 
00251 _FICD(JTAGEN_OFF & ICS_PGD1);
00252 
00254 #define CONFIG_BITS_DEFINED
00256 
00257 #endif // #ifdef (lots of PIC24H devices)
00258 
00259 
00260 
00261 #if defined(EXPLORER16_100P) && defined(__PIC24HJ256GP610__)
00262 _FBS(BWRP_WRPROTECT_OFF);
00263 _FGS(GSS_OFF & GCP_OFF & GWRP_OFF);
00264 _FOSCSEL(FNOSC_FRC & IESO_OFF);
00265 _FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_SEL);
00266 _FWDT(FWDTEN_OFF & WINDIS_OFF & WDTPRE_PR128 & WDTPOST_PS512);
00267 _FPOR(FPWRT_PWR16);
00268 _FICD(JTAGEN_OFF & ICS_PGD1);
00269 #define CONFIG_BITS_DEFINED
00270 #endif
00271 
00272 
00274 
00275 #if (defined(__PIC24FJ64GA002__) ) || defined(__DOXYGEN__)
00276 
00336 _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & COE_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS512);
00337 
00338 
00384 _CONFIG2(IESO_OFF & FNOSC_FRC & FCKSM_CSECMD & OSCIOFNC_ON & IOL1WAY_OFF & POSCMD_SEL);
00385 
00386 
00388 #define CONFIG_BITS_DEFINED
00390 
00391 #endif // #ifdef PIC24F processors
00392 
00393 #if defined(EXPLORER16_100P) && defined(__PIC24FJ128GA010__)
00394 _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & COE_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS512);
00395 _CONFIG2(IESO_OFF & FNOSC_FRC & FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_SEL);
00396 #define CONFIG_BITS_DEFINED
00397 #endif
00398 
00399 #if defined(__PIC24FJ64GB002__) ||(__PIC24FJ64GB004__) 
00400 _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF  & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS512);
00401 _CONFIG2(IESO_OFF & FNOSC_FRC & FCKSM_CSECMD & OSCIOFNC_ON & IOL1WAY_OFF & POSCMD_SEL & PLL96MHZ_OFF & PLLDIV_DIV2 );
00402 _CONFIG4(DSWDTPS_DSWDTPSF & DSWDTEN_OFF & DSBOREN_OFF)
00403 #define CONFIG_BITS_DEFINED
00405 #endif
00406 
00407 //default config bits, use these if a processor is not defined.
00408 #ifndef CONFIG_BITS_DEFINED
00409 #ifdef __PIC24H__
00410 _FBS(BWRP_WRPROTECT_OFF);
00411 _FGS(GSS_OFF & GCP_OFF & GWRP_OFF);
00412 
00413 #ifdef RSS_NO_RAM
00414 _FSS(RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF); 
00415 #endif
00416 
00417 #ifdef IOL1WAY_OFF
00418 _FOSC(FCKSM_CSECMD & IOL1WAY_OFF & OSCIOFNC_ON & POSCMD_SEL);
00419 #else
00420 _FOSC(FCKSM_CSECMD & OSCIOFNC_ON & POSCMD_SEL);
00421 #endif
00422 _FOSCSEL(FNOSC_FRC & IESO_OFF);
00423 _FWDT(FWDTEN_OFF & WINDIS_OFF & WDTPRE_PR128 & WDTPOST_PS512);
00424 _FPOR(FPWRT_PWR16);
00425 _FICD(JTAGEN_OFF & ICS_PGD1);
00426 
00427 #warning Warning: Using default config bit settings in 'common/pic24_configbits.c' for PIC24H family.
00428 #warning edit 'common/pic24_configbits.c' to define bits for your processor!
00430 #define CONFIG_BITS_DEFINED
00432 #endif
00433 
00434 #ifdef __PIC24F__
00435 
00436 #ifndef BKBUG_OFF
00437 #define BKBUG_OFF 0xFFFF
00438 #endif
00439 #ifndef COE_OFF
00440 #define COE_OFF 0xFFFF
00441 #endif
00442 
00443 _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & COE_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS512);
00444 
00445 #ifndef IOL1WAY_OFF
00446 #define IOL1WAY_OFF 0xFFFF
00447 #endif
00448 _CONFIG2(IESO_OFF & FNOSC_FRC & FCKSM_CSECMD & OSCIOFNC_ON & IOL1WAY_OFF & POSCMD_SEL);
00449 
00450 #warning Using default config bit settings in 'common/pic24_configbits.c' for PIC24F family.
00451 #warning edit 'common/pic24_configbits.c' to define bits for your processor!
00453 #define CONFIG_BITS_DEFINED
00455 #endif
00456 
00457 /* The PIC24FK is a subfamily of the PIC24F -- functionality like the PIC24F, but config bits like the PIC24H */
00458 #ifdef __PIC24FK__
00459 _FBS(BSS_OFF & BWRP_OFF);
00460 _FGS(GCP_OFF & GWRP_OFF);
00461 
00462 #if  (POSC_FREQ < 100000L) 
00463 _FOSC(FCKSM_CSECMD & OSCIOFNC_ON & POSCMD_SEL & POSCFREQ_LS);
00464 #elif (POSC_FREQ > 8000000L) 
00465 _FOSC(FCKSM_CSECMD & OSCIOFNC_ON & POSCMD_SEL & POSCFREQ_HS);
00466 #else
00467 _FOSC(FCKSM_CSECMD & OSCIOFNC_ON & POSCMD_SEL & POSCFREQ_MS);
00468 #endif
00469 
00470 
00471 _FOSCSEL(FNOSC_FRC & IESO_OFF);
00472 _FWDT(FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS512);
00473 _FPOR(PWRTEN_ON & MCLRE_ON & I2C1SEL_PRI);
00474 _FICD(BKBUG_OFF & ICS_PGx1);
00475 
00476 //new config word for deep sleep operation, set these for your needs
00477 _FDS(DSWDTEN_OFF & DSBOREN_OFF & RTCOSC_LPRC & DSWDTOSC_SOSC);
00478 
00479 #warning Warning: Using default config bit settings in 'common/pic24_configbits.c' for PIC24FK family.
00480 #warning edit 'common/pic24_configbits.c' to define bits for your processor!
00482 #define CONFIG_BITS_DEFINED
00484 #endif
00485 
00486 
00487 #ifdef __dsPIC33F__
00488 _FBS(BWRP_WRPROTECT_OFF);
00489 _FGS(GSS_OFF & GCP_OFF & GWRP_OFF);
00490 _FOSCSEL(FNOSC_FRC & IESO_OFF);
00491 #ifdef RSS_NO_RAM
00492 _FSS(RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF); 
00493 #endif
00494 #ifdef IOL1WAY_OFF
00495 _FOSC(FCKSM_CSECMD & IOL1WAY_OFF & OSCIOFNC_ON & POSCMD_SEL);
00496 #else
00497 _FOSC(FCKSM_CSECMD & OSCIOFNC_ON & POSCMD_SEL);
00498 #endif
00499 _FWDT(FWDTEN_OFF & WINDIS_OFF & WDTPRE_PR128 & WDTPOST_PS512);
00500 _FPOR(FPWRT_PWR16);
00501 _FICD(JTAGEN_OFF & ICS_PGD1);
00502 #warning Using default config bit settings in 'common/pic24_configbits.c' for dsPIC33F family.
00503 #warning edit 'common/pic24_configbits.c' to define bits for your processor!
00505 #define CONFIG_BITS_DEFINED
00507 #endif
00508 #endif
00509 
00510 
00511 #ifndef CONFIG_BITS_DEFINED
00512 #error Edit 'common/pic24_configbits.c' to add config bits for your processor!
00513 #endif

Generated on Mon Oct 18 07:40:46 2010 for Python-on-a-chip by  doxygen 1.5.9