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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tutorialcounter.c/****************************************************************************** <strong>MPLAB</strong> <strong>ICD</strong> 3 <strong>In</strong>-<strong>Circuit</strong> <strong>Debugger</strong> Tutorial* Counting 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"// Set up configuration bits_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & FNOSC_PRI )void Timer<strong>In</strong>it(void);unsigned char TimerIsOverflowEvent(void);// Set up user-defined variables#define INIT_COUNT 0unsigned int counter;int main(void){// Set up PortA IOs as digital outputAD1PCFG = 0xffff;TRISA = 0x0000;// Set up Timer1Timer<strong>In</strong>it();// <strong>In</strong>itialize variablescounter = INIT_COUNT;while (1) {// Wait for Timer1 overflowif (TimerIsOverflowEvent()){counter++; //increment counterPORTA = counter; //display on port LEDs}// End of if...}// End of while loop...}// End of main()...© 2008 Microchip Technology <strong>In</strong>c. DS51766A-page 31

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

Saved successfully!

Ooh no, something went wrong!