Using A Timer OpenTimer2((T2_ON | T2_IDLE_CON | T2_GATE_OFF | T2_PS_1_1 | T2_SOURCE_INT), 40); INTClearFlag(INT_T2); while (!INTGetFlag(INT_T2)) ;
Category: Timers and Delays
Non IRQ timer
Using a Timer Without An IRQ //Setup the timer OpenTimer2((T2_ON | T2_IDLE_CON | T2_GATE_OFF | T2_PS_1_1 | T2_32BIT_MODE_OFF | T2_SOURCE_INT), 100); INTClearFlag(INT_T2); //Wait for timer to loop while (!INTGetFlag(INT_T2)) ; INTClearFlag(INT_T2); Faster Bit Test Of IRQ Flag The INTGetFlag() function is not particuarly fast. If you want very tight timing then do a bit […]
Delays
uS Delay Function Using Core Timer mS Delay Function Using Core Timer