MyTimer.c

void MyTimer_Init(void)

      Initiates a 1ms timer

      Turn timer system on

      Set prescale to get 3.0MHz frequency

      Set cap/comp 4 to output compare

      Schedule first event for channel 4 to occur every 1 ms

      Clear OC4 flag

      Enable OC4 interrupts

 

unsigned int MyTimer_GetTime(void)

      return the current time in ms

 

void wait(unsigned int ms)

      implements blocking code for a given number of ms.

      Used primarily for debugging and development

 

void interrupt _Vec_tim0ch4 myTimerIntRoutin(void)

      increment curTime variable every time 1 ms occurs during OC interrupt