#include "delay.h"
#include "sys.h"
#include "timer.h"
//ALIENTEK Mini STM32¿a·¢°å·¶ày′úÂë7
//¶¨ê±Æ÷ÖD¶ÏêμÑé
//¼¼êõÖ§3Ö£o
www.openedv.com
//1ãÖYêDDÇòíμç×ó¿Æ¼¼óDÏT1«Ë¾
int main(void)
{
//Ñóê±oˉêy3õê¼»ˉ
// éèÖÃÖD¶ÏóÅÏ輶·Ö×é2
GPIO_InitTypeDef GPIO_InitStructure;
TIM3_Int_Init(4999,7199);//10KhzμļÆêyÆμÂ꣬¼Æêyμ½5000Îa500ms
//ê1ÄüA6¿ú£¬2¢½øDDÅäÖÃ
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA , ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; //TIM_CH1
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //¸′óÃíÆíìêä3ö
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
int TIM3_IRQHandler();
GPIO_SetBits(GPIOA,GPIO_Pin_6);
int TIM3_GetCounter ();
if (TIM_GetCounter >=300)
{
GPIO_ResetBits(GPIOA,GPIO_Pin_6);
}
}
以上是主函数,编译后是以下问题
Build target 'Target 1'
compiling main.c...
main.c(22): error: #268: declaration may not appear after executable statement in block
int TIM3_IRQHandler();
main.c(24): error: #268: declaration may not appear after executable statement in block
int TIM3_GetCounter ();
main.c(25): error: #42: operand types are incompatible ("uint16_t (*)(TIM_TypeDef *)" and "int")
if (TIM_GetCounter >=300)
main.c: 0 warnings, 3 errors
"..OBJTIMER.axf" - 3 Error(s), 0 Warning(s).
Target not created.
compiling main.c...
main.c(23): warning: #223-D: function "TIM3_IRQHandler" declared implicitly
TIM3_IRQHandler();
main.c(25): warning: #223-D: function "TIM3_GetCounter" declared implicitly
TIM3_GetCounter();
main.c: 2 warnings, 0 errors
"main.c" - 0 Error(s), 2 Warning(s).
一周热门 更多>