beautypg.com

Appendix b: example of configuration values – Digilent 410-295P-KIT User Manual

Page 28

background image

ChipKIT Pro MX4 Reference Manual

Copyright Digilent, Inc. All rights reserved.

Other product and company names mentioned may be trademarks of their respective owners.

Page 28 of 37

Appendix B: Example of Configuration Values

The following example illustrates setting the configuration values in the PIC32 microcontroller on the ChipKIT Pro

MX4. The microcontroller configuration should be done in a single source file in the project, and is typically done in

the ‘main’ project source file. This example sets all configuration values to valid values for the ChipKIT Pro MX4

board. It sets the system clock for processor operation at 80Mhz, and the peripheral bus at 10Mhz.


/* ------------------------------------------------------------ */
/*

PIC32 Configuration Settings

*/

/* ------------------------------------------------------------ */

/* Oscillator Settings
*/
#pragma config FNOSC

= PRIPLL

// Oscillator selection

#pragma config POSCMOD = EC

// Primary oscillator mode

#pragma config FPLLIDIV = DIV_2

// PLL input divider

#pragma config FPLLMUL = MUL_20

// PLL multiplier

#pragma config FPLLODIV = DIV_1

// PLL output divider

#pragma config FPBDIV

= DIV_8

// Peripheral bus clock divider

#pragma config FSOSCEN = OFF

// Secondary oscillator enable


/* Clock control settings
*/
#pragma config IESO

= OFF

// Internal/external clock switchover

#pragma config FCKSM

= CSDCMD

// Clock switching (CSx)/Clock monitor

(CMx)
#pragma config OSCIOFNC = OFF

// Clock output on OSCO pin enable


/* USB Settings
*/
#pragma config UPLLEN

= ON

// USB PLL enable

#pragma config UPLLIDIV = DIV_2

// USB PLL input divider

#pragma config FVBUSONIO = OFF

// VBUS pin control

#pragma config FUSBIDIO = OFF

// USBID pin control


/* Other Peripheral Device settings
*/
#pragma config FWDTEN

= OFF

// Watchdog timer enable

#pragma config WDTPS

= PS1024

// Watchdog timer post-scaler

#pragma config FSRSSEL = PRIORITY_7 // SRS interrupt priority

/* Code Protection settings
*/
#pragma config CP

= OFF

// Code protection

#pragma config BWP

= OFF

// Boot flash write protect

#pragma config PWP

= OFF

// Program flash write protect


/* Debug settings
*/
//#pragma config ICESEL = ICS_PGx2 // ICE pin selection