13.07.2015 Views

MPLAB ICD 3 In-Circuit Debugger User's Guide

MPLAB ICD 3 In-Circuit Debugger User's Guide

MPLAB ICD 3 In-Circuit Debugger User's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>MPLAB</strong> ® <strong>ICD</strong> 3 <strong>In</strong>-<strong>Circuit</strong> <strong>Debugger</strong> User’s <strong>Guide</strong>timer.c/****************************************************************************** <strong>MPLAB</strong> <strong>ICD</strong> 3 <strong>In</strong>-<strong>Circuit</strong> <strong>Debugger</strong> Tutorial* Timer program******************************************************************************* Demo Board: Explorer 16* Processor: PIC24FJ128GA010* Compiler: <strong>MPLAB</strong> C30* Linker: <strong>MPLAB</strong> LINK30* Company: Microchip Technology <strong>In</strong>corporated******************************************************************************/#include "p24FJ128GA010.h"//declare functionsextern void Timer<strong>In</strong>it(void);extern unsigned char TimerIsOverflowEvent(void);/********************************************************************** Function: Timer<strong>In</strong>it** PreCondition: None.** <strong>In</strong>put: None.** Output: None.** Overview: <strong>In</strong>itializes Timer1 for use.*********************************************************************/void Timer<strong>In</strong>it(void){PR1 = 0xFFFF;}IPC0bits.T1IP = 5;T1CON = 0b1000000000010000;IFS0bits.T1IF = 0;/********************************************************************** Function: TimerIsOverflowEvent** PreCondition: None.** <strong>In</strong>put: 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){DS51766A-page 32© 2008 Microchip Technology <strong>In</strong>c.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!