This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to using the Modulo Mode of the Time3

Hi  all !

i want  to using  the  Timer3 to generate 38Khz clock.

When i try to Free-Running Mode  and UP-Down Mdoe ,it seems Timer3 is working。

 i have  not got  the right vaule to get 38Khz clock 。

as the Timer3 setting : 

void InitTimer3(void)
{
  EA=0;   
 
  //定时器每计数加1需要耗时 1/(16000000/2) = 0.125us 
  T3CTL |= 0x20;    //设置分频  2分频: 
  
  T3CTL |= 0x02;    //设置运行模式 模计数 模式,
  T3CC0 = 0xD3;     //设定初值,211 
  
  T3CTL |= 0x08 ;   //使能定时器3 溢出中断
  T3IE  = 1;        //开定时器 T3中断
  EA=1;             //开总中断
  
  T3CTL |=0X10;     //启动 
}

and i toggle the PIN state in the interruption of T3

#pragma vector = T3_VECTOR  
__interrupt void T3_ISR(void)  
{  
  if(T3OVFIF == 1)   //Timer3溢出         
  {  
    F38KHz = !F38KHz;//载波发射  
  } 
   
}

         Q1:

but  Modulo Mode seems not work, i set a break point in the interruption,

and  i found  that  the T3 have not going into the interruption。

Q2:

if  the system clock is 32Mhz ,what is the vaule should i set in  the Timer presaler and ideal timer value ?

I follow this table, but  i have  not get the right clock out !

as  the table setting, 4 prescaler    ideal timer vaule  211  ====》 result clock :9.477Khz

 2 prescaler    ideal timer vaule  211  ====》 result clock :19 Khz

0  prescaler   ideal timer vaule  211  ====》 result clock :27 Khz

i am so confused ~~~~