User manual

Table Of Contents
PICDEM
TM
Lab Development Board User’s Guide
DS41369A-page 44 © 2009 Microchip Technology Inc.
1. Copy/paste the function code in Example 3-17 into the top of the firmware source
template under the section marked:
/**SUPPORT ROUTINES*************************************
EXAMPLE 3-17: DELAY_5MS() CODE FOR LAB 5
2. Copy/paste the code in Example 3-18 into the Initialize() over the code
from the previous lab.
/*---------------------------------------------------------
Subroutine: Delay_5mS
Parameters: none
Returns:nothing
Synopsis:Creates a 5mS delay when called
---------------------------------------------------------*/
void Delay_5mS(void)
{
//Make sure the T0IF is cleared
T0IF = 0;
//preload the TMR0 register
TMR0 = 100;
//Sit here and wait for Timer0 to overflow
while (T0IF == 0);
}