AN2039-Adding a Timer
Using MPLAB® Code Configurator (MCC) to add Timer1 function to an application
With the project opened in MPLAB X, from the main menu, selectTools > Microchip Embedded > MPLAB Code Configurator.
After MCC opens, from theDevice Resources menu, selectTimer1 to bring it into theProject Resources window:
Click onTMR1 to edit and enter values to configure TMR1:
To configure the TMR1 for a 1-millisecond (mS) interrupt using the 16 MHz internal clock, edit the Time Period to1.0 mS, check theEnable Timer Interrupt box, and edit the Callback Function Rate to1.
Click theGenerate Code button for MCC to create code for TMR1.
Using the MCC, this method can be used to initialize and create functions for the Analog-to-Digital Converter (ADC), Pulse Width Modulation (PWM), GPIO, Flash Memory, and I²C.






