在编译定时器的程序时,编译后报错:
compiling main.c...
main.c(27): error: #136: struct "<unnamed>" has no field "TIM_Channel"
main.c(30): warning: #223-D: function "TIM_OCInit" declared implicitly
main.c(35): error: #136: struct "<unnamed>" has no field "TIM_Channel"
main.c(43): error: #136: struct "<unnamed>" has no field "TIM_Channel"
main.c(51): error: #136: struct "<unnamed>" has no field "TIM_Channel"
Target not created
是哪里出错了,请大伙帮忙看看,附上一段源程序
/*通道1 输出比较模式*/
TIM_OCInitStructure.TIM_OCMode=TIM_OCMode_Toggle;
TIM_OCInitStructure.TIM_Channel=TIM_Channel_1;
TIM_OCInitStructure.TIM_Pulse=CCR1_Val;
TIM_OCInitStructure.TIM_OCPolarity=TIM_OCPolarity_Low;
TIM_OCInit(TIM2, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Disable);
/*通道2 输出比较模式 */
TIM_OCInitStructure.TIM_OCMode=TIM_OCMode_Toggle;
TIM_OCInitStructure.TIM_Channel=TIM_Channel_2;
TIM_OCInitStructure.TIM_Pulse=CCR2_Val;
TIM_OCInitStructure.TIM_OCPolarity=TIM_OCPolarity_Low;
TIM_OCInit(TIM2, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Disable);
/*通道3 输出比较模式*/
TIM_OCInitStructure.TIM_OCMode=TIM_OCMode_Toggle;
TIM_OCInitStructure.TIM_Channel=TIM_Channel_3;
TIM_OCInitStructure.TIM_Pulse=CCR3_Val;
TIM_OCInitStructure.TIM_OCPolarity=TIM_OCPolarity_Low;
TIM_OCInit(TIM2, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Disable);
/*通道4 输出比较模式*/
TIM_OCInitStructure.TIM_OCMode=TIM_OCMode_Toggle;
TIM_OCInitStructure.TIM_Channel=TIM_Channel_4;
TIM_OCInitStructure.TIM_Pulse=CCR4_Val;
TIM_OCInitStructure.TIM_OCPolarity=TIM_OCPolarity_Low;
TIM_OCInit(TIM2, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Disable);
TIM_Cmd(TIM2, ENABLE);
TIM_ITConfig(TIM2, TIM_IT_CC1|TIM_IT_CC2|TIM_IT_CC3|TIM_IT_CC4,ENABLE);
|