stm8一个io口翻转产生脉冲,如果不开启外部中断的话,怎么去计数和检测下降沿,比如在tim1溢出中断里PD2端口通过置高置低产生脉冲:
#pragma vector=TIM1_OVR_UIF_vector
__interrupt void TIM1_OVR_UIF_IRQHandler(void)
{
TIM1_SR1=0X00;
count13++;
if(count13==3) //数3个脉冲后PD2置高
PD2=1;
if(count13==6) //数3个脉冲后PD2置低
PD2=0;
} |