正在调STM32
用了systick计数器,它每次计满到1ms后,进入中断程序;
中断程序中有个变量TimingDelay,每进入一次,自减1,程序如下: void SysTickHandler(void) { if(TimingDelay != 0) TimingDelay--; }
在main.c文件中,定义一个Delay函数,程序如下:
void Delay(u32 param) { SysTick_CounterCmd(SysTick_Counter_Enable); TimingDelay = param; while(TimingDelay != 0) { } SysTick_CounterCmd(SysTick_Counter_Disable); SysTick_CounterCmd(SysTick_Counter_Clear); }
问题就来了,这个全局变量TimingDelay,如果我在stm32f10x_it.c文件中定义的话,编译main.c会报错 Error[Pe020]: identifier "TimingDelay" is undefined H:STM32_bookchapter_USART_ADCstm32_usart_adc_examplemain.c 397
如果在main.c中定义的话,编译stm32f10x_it.c还是报错 Error[Pe020]: identifier "TimingDelay" is undefined H:STM32_bookchapter_USART_ADCstm32_usart_adc_examplestm32f10x_it.c 158
问题在哪? 晕哪~~~
|