TIE_C4I = 0;
You set this to 1 to enable the interrupt.
"The bits in TIE correspond bit-for-bit with the bits in the TFLG1 status register. If cleared, the corresponding flag is disabled from causing a hardware interrupt. If set, the corresponding flag is enabled to cause a interrupt"while(TFLG1_C4F =0 ); You mean '=='
if you learn to write:
while( 0 == TFLG1_C4F ); Then the compiler will flag this common error.
TC4 = 0xfffc; I think you want TC4 = TCNT + mydelay;
Otherwise you will get a random delay depending upon the value of TCNT.
TSCR2_PR = 7; // prescaler 0 : 25Mhz (7= Divide by 128)
You should set the prescaler before you need to use the delay:
"The newly selected prescale factor will not take effect until the next synchronized edge where all prescale counter stages equal zero."
Message Edited by JimDon on
2008-01-27 09:50 AM