/* Measure the time between this interrupt and the previous interrupt to calculate the timing jitter. Remember the maximum value the jitter has ever been calculated to be.  */
static void prvCalculateAndStoreJitter(void)
/* Measure the time between this interrupt and the previous interrupt to calculate the timing jitter. Remember the maximum value the jitter has ever been calculated to be.  */
static void prvCalculateAndStoreJitter(void)
{
static unsigned portSHORT usLastCount = 0, usSettleCount = 0;
unsigned portSHORT usThisCount, usDifference;
	usThisCount = TMR4;
	if( usSettleCount >= timerSETTLE_TIME )
	{
		usDifference = usThisCount - usLastCount;
		if( usDifference > usMaxJitter )
		{
			usMaxJitter = usDifference;
		}
	}
	else
	{
		usSettleCount++;
	}
	usLastCount = usThisCount;
}