STM32自己写了个底层,错误出了一堆,给位大佬看看哪里的问题?

2019-07-15 10:17发布

#include "STM32f10x.h"
#include "tiMcounter.h"
#include "sys.h"
#include "stm32f10x_gpio.h"
#include "timer.h"




GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50MʱÖÓËÙ¶È
GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> ×óÓÒÂö³åÊäÈë */

RCC_ClocksTypeDef RCC_ClockFreq;

SystemInit();

RCC_GetClocksFreq(&RCC_ClockFreq);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);



各位大佬帮忙看下,出了25个错,研究半天也没看出哪里错了,下面是编译结果
Build target 'ROBOT'
compiling TIMcounter.c...
..HARDWARETIMcounterTIMcounter.c(11): error:  #77-D: this declaration has no storage class or type specifier
  GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_12;
..HARDWARETIMcounterTIMcounter.c(11): error:  #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitStructure" (declared at line 10)
  GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_12;
..HARDWARETIMcounterTIMcounter.c(11): error:  #65: expected a ";"
  GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_12;
..HARDWARETIMcounterTIMcounter.c(12): error:  #77-D: this declaration has no storage class or type specifier
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
..HARDWARETIMcounterTIMcounter.c(12): error:  #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitStructure" (declared at line 11)
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
..HARDWARETIMcounterTIMcounter.c(12): error:  #65: expected a ";"
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
..HARDWARETIMcounterTIMcounter.c(13): error:  #77-D: this declaration has no storage class or type specifier
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50M时钟速度
..HARDWARETIMcounterTIMcounter.c(13): error:  #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitStructure" (declared at line 12)
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50M时钟速度
..HARDWARETIMcounterTIMcounter.c(13): error:  #65: expected a ";"
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50M时钟速度
..HARDWARETIMcounterTIMcounter.c(14): error:  #79: expected a type specifier
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..HARDWARETIMcounterTIMcounter.c(14): error:  #79: expected a type specifier
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..HARDWARETIMcounterTIMcounter.c(14): warning:  #77-D: this declaration has no storage class or type specifier
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..HARDWARETIMcounterTIMcounter.c(14): error:  #147: declaration is incompatible with "void GPIO_Init(GPIO_TypeDef *, GPIO_InitTypeDef *)" (declared at line 351 of "..STM32F10x_FWLibincstm32f10x_gpio.h")
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..HARDWARETIMcounterTIMcounter.c(18): warning:  #1295-D: Deprecated declaration SystemInit - give arg types
  SystemInit();//??system_stm32f10x.c??,????????,????RCC???.
..HARDWARETIMcounterTIMcounter.c(18): warning:  #77-D: this declaration has no storage class or type specifier
  SystemInit();//??system_stm32f10x.c??,????????,????RCC???.
..HARDWARETIMcounterTIMcounter.c(18): error:  #147: declaration is incompatible with "void SystemInit(void)" (declared at line 79 of "..USERsystem_stm32f10x.h")
  SystemInit();//??system_stm32f10x.c??,????????,????RCC???.
..HARDWARETIMcounterTIMcounter.c(19): error:  #79: expected a type specifier
  RCC_GetClocksFreq(&RCC_ClockFreq);
..HARDWARETIMcounterTIMcounter.c(19): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_GetClocksFreq(&RCC_ClockFreq);
..HARDWARETIMcounterTIMcounter.c(19): error:  #147: declaration is incompatible with "void RCC_GetClocksFreq(RCC_ClocksTypeDef *)" (declared at line 691 of "..STM32F10x_FWLibincstm32f10x_rcc.h")
  RCC_GetClocksFreq(&RCC_ClockFreq);
..HARDWARETIMcounterTIMcounter.c(21): error:  #79: expected a type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..HARDWARETIMcounterTIMcounter.c(21): error:  #757: constant "ENABLE" is not a type name
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..HARDWARETIMcounterTIMcounter.c(21): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..HARDWARETIMcounterTIMcounter.c(21): error:  #147: declaration is incompatible with "void RCC_APB2PeriphClockCmd(uint32_t, FunctionalState)" (declared at line 693 of "..STM32F10x_FWLibincstm32f10x_rcc.h")
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..HARDWARETIMcounterTIMcounter.c(22): error:  #79: expected a type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
..HARDWARETIMcounterTIMcounter.c(22): error:  #757: constant "ENABLE" is not a type name
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
..HARDWARETIMcounterTIMcounter.c(22): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
..HARDWARETIMcounterTIMcounter.c(23): error:  #79: expected a type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
..HARDWARETIMcounterTIMcounter.c(23): error:  #757: constant "ENABLE" is not a type name
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
..HARDWARETIMcounterTIMcounter.c(23): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
..HARDWARETIMcounterTIMcounter.c(24): warning:  #1-D: last line of file ends without a newline
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..HARDWARETIMcounterTIMcounter.c(24): error:  #79: expected a type specifier
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..HARDWARETIMcounterTIMcounter.c(24): error:  #757: constant "ENABLE" is not a type name
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..HARDWARETIMcounterTIMcounter.c(24): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..HARDWARETIMcounterTIMcounter.c(24): error:  #147: declaration is incompatible with "void RCC_APB1PeriphClockCmd(uint32_t, FunctionalState)" (declared at line 694 of "..STM32F10x_FWLibincstm32f10x_rcc.h")
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..HARDWARETIMcounterTIMcounter.c: 9 warnings, 25 errors
compiling stm32f10x_adc.c...
"no source": Error:  #5: cannot open source input file "C:UsersAdministratorDesktopstm32搴揬LQ-F103Z-SYS 20140917娴嬭瘯绋嬪簭stm32娴嬭瘯STM32F10x_FWLibsrcstm32f10x_adc.c": No such file or directory
C:UsersAdministratorDesktopstm32库LQ-F103Z-SYS 20140917测试程序stm32测试STM32F10x_FWLibsrcstm32f10x_adc.c: 0 warnings, 1 error
"..OBJPRACTICE.axf" - 25 Error(s), 9 Warning(s).
Target not created.
Build Time Elapsed:  00:00:01

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
10条回答
电178
1楼-- · 2019-07-16 00:14
哈哈哈哈哈
电178
2楼-- · 2019-07-16 00:48
将军问鼎 发表于 2017-7-6 20:31
哈哈,我一看怎么看怎么别扭,以后得注意函数的应用

给大佬双击666
电178
3楼-- · 2019-07-16 01:42
累死在了学单片机途中
sfd123
4楼-- · 2019-07-16 05:37
电178 发表于 2017-7-6 21:42
找到原因了,开头忘了写void mmmm()
{
}

你是在逗我们玩?
noNo_123
5楼-- · 2019-07-16 09:52
 精彩回答 2  元偷偷看……
电178
6楼-- · 2019-07-16 13:24
sfd123 发表于 2017-7-8 08:35
你是在逗我们玩?

一周热门 更多>