小弟菜鸟,第一次接触这个东东,希望得到各位高手的相助,非常感谢! 程序的目的是在TIM2-CC1作为输入捕捉,对输入这个引脚的信号频率进行测量,主要程序如下: 我用的是STM8L101芯片 void main(void) { /* Capture only every 8 events!!! */ /* Enable capture of TI1 */ TIM2->CCMR1 = 0x31; TIM2->CCER1 |= 0x01; /* Enable CC1 interrupt */ TIM2->IER |= 0x02; /* Enable TIM2 */ TIM2->CR1 |= 0x01; /* Clear CC1 Flag*/ TIM2->SR1 |= ~0x02; GPIOB->DDR |= ~0x01; GPIOB->CR1 |= 0x02; /* wait a capture on CC1 */ while((TIM2->SR1 & 0x02) != 0x02); /* Get CCR1 value*/ ICValue1 = TIM2_GetCapture1(); /*TIM2_ClearFlag(TIM2_FLAG_CC1);*/ TIM2->SR1 = ~0x02; /* wait a capture on cc1 */ while((TIM2->SR1 & 0x02) != 0x02); /* Get CCR1 value*/ ICValue2 = TIM2_GetCapture1(); /*TIM2_ClearFlag(TIM2_FLAG_CC1);*/ TIM2->SR1 = ~0x02; /* Compute LSI clock frequency */ LSIClockFreq = (8 * TIM2ClockFreq) / (ICValue2 - ICValue1); /* Insert a break point here */ while (1); } 通过st-link usb调试,编译的时候没有问题,可是执行Debug的时候,弹出如下画面: |
RE:高手帮忙看看那里出的问题
RE:高手帮忙看看那里出的问题