请教各位大神,先感谢!!!我想要2ms和1ms 交替的计时周期 K8F413 T2定时器在中断程序中不能改变周期。程序如下: if(T2IF&&T2IE){ //PP5初值2ms
T2IF = 0;
P0LR1 = !P0LR1;
if(TMR2_int_state == 0){
PP5H = 0X7D; //2ms
PP5L = 0X00;
TMR2_int_state = 1;
}else{
PP5H = 0X3E; //1ms
PP5L = 0X80;
TMR2_int_state = 0;
}
}
实际测试都是2ms定时时间没有1ms
|