Microchip Technology ICD 3 In-Circuit Debugger DV164035 DV164035 Manuel D’Utilisation
Codes de produits
DV164035
MPLAB
®
ICD 3 In-Circuit Debugger User’s Guide
DS51766A-page 32
© 2008 Microchip Technology Inc.
timer.c
/*****************************************************************************
* MPLAB ICD 3 In-Circuit Debugger Tutorial
* Timer program
*
*****************************************************************************
* Demo Board: Explorer 16
* Processor: PIC24FJ128GA010
* Compiler: MPLAB C30
* Linker: MPLAB LINK30
* Company: Microchip Technology Incorporated
*
*****************************************************************************/
#include "p24FJ128GA010.h"
//declare functions
extern void TimerInit(void);
extern unsigned char TimerIsOverflowEvent(void);
/*********************************************************************
* Function: TimerInit
*
* PreCondition: None.
*
* Input: None.
*
* Output: None.
*
* Overview: Initializes Timer1 for use.
*
********************************************************************/
void TimerInit(void)
{
PR1 = 0xFFFF;
IPC0bits.T1IP = 5;
T1CON = 0b1000000000010000;
IFS0bits.T1IF = 0;
}
/*********************************************************************
* Function: TimerIsOverflowEvent
*
* PreCondition: None.
*
* Input: None.
*
* Output: Status.
*
* Overview: Checks for an overflow event, returns TRUE if
* an overflow occured.
*
* Note: This function should be checked at least twice
* per overflow period.
********************************************************************/
unsigned char TimerIsOverflowEvent(void)
{
if (IFS0bits.T1IF)
{