初级会员

- 积分
- 63
- 金钱
- 63
- 注册时间
- 2015-4-29
- 在线时间
- 0 小时
|
5金钱
#include <stm32f10x_lib.h>
#include "sys.h"
#include "usart.h"
#include "delay.h"
int main(void)
{
unsigned char i_Loop;
unsigned char n_Counter;
#ifdef DEBUG
debug();
#endif
void RCC_Configuration(void); // System Clocks Configuration
void NVIC_Configuration(void); // NVIC configuration
void GPIO_Configuration(void); // Configure the GPIO ports
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_TimeBaseStructure.TIM_Period = 0xFFFF;
TIM_TimeBaseStructure.TIM_Prescaler = 0x00;
TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
TIM_TimeBaseStructure.TIM_CounterMode =TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); // Time base configuration
TIM_ETRClockMode2Config(TIM2, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0);
TIM_SetCounter(TIM2, 0);
TIM_Cmd(TIM2, ENABLE);
for(i_Loop = 0; i_Loop < 100; i_Loop ++)
{
void GPIO_SetBits(GPIOC, GPIO_Pin_6);
delay_init(10);
void GPIO_ResetBits(GPIOC, GPIO_Pin_6);
delay_init(10);
}
n_Counter = TIM_GetCounter(TIM2);
return(n_Counter)
while (1)
{
}
}
以下是编译错误:
Build target 'Target 1'
compiling test.c...
test.c(31): error: #79: expected a type specifier
test.c(31): error: #79: expected a type specifier
test.c(33): error: #268: declaration may not appear after executable statement in block
test.c(33): error: #79: expected a type specifier
test.c(33): error: #79: expected a type specifier
test.c(38): error: #65: expected a ";"
test.c(42): warning: #12-D: parsing restarts here after previous syntax error
Target not created
谢谢,以上程序也是网上档的,但是自己编译就出错了,大神们帮帮忙,都弄了快一星期了,要疯了,我从来没有接触过STM32,真是菜鸟中的菜鸟!!!
|
最佳答案
查看完整内容[请看2#楼]
你函数申明都写到函数里面去了。。。。点击报错的信息,就可以定位到报错的行
然后 return(n_Counter),这里分号都没有。。。 这里也提醒你了:test.c(38): error: #65: expected a ";"
|