微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > STM32自己写了个底层,错误出了一堆,给位大佬看看哪里的问题?

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

时间:10-02 整理:3721RD 点击:
#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-> ×óóò??3?ê?è? */
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...
..\HARDWARE\TIMcounter\TIMcounter.c(11): error:  #77-D: this declaration has no storage class or type specifier
  GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_12;
..\HARDWARE\TIMcounter\TIMcounter.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;
..\HARDWARE\TIMcounter\TIMcounter.c(11): error:  #65: expected a ";"
  GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_12;
..\HARDWARE\TIMcounter\TIMcounter.c(12): error:  #77-D: this declaration has no storage class or type specifier
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
..\HARDWARE\TIMcounter\TIMcounter.c(12): error:  #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitStructure" (declared at line 11)
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
..\HARDWARE\TIMcounter\TIMcounter.c(12): error:  #65: expected a ";"
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
..\HARDWARE\TIMcounter\TIMcounter.c(13): error:  #77-D: this declaration has no storage class or type specifier
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50M时钟速度
..\HARDWARE\TIMcounter\TIMcounter.c(13): error:  #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitStructure" (declared at line 12)
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50M时钟速度
..\HARDWARE\TIMcounter\TIMcounter.c(13): error:  #65: expected a ";"
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //50M时钟速度
..\HARDWARE\TIMcounter\TIMcounter.c(14): error:  #79: expected a type specifier
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..\HARDWARE\TIMcounter\TIMcounter.c(14): error:  #79: expected a type specifier
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..\HARDWARE\TIMcounter\TIMcounter.c(14): warning:  #77-D: this declaration has no storage class or type specifier
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..\HARDWARE\TIMcounter\TIMcounter.c(14): error:  #147: declaration is incompatible with "void GPIO_Init(GPIO_TypeDef *, GPIO_InitTypeDef *)" (declared at line 351 of "..\STM32F10x_FWLib\inc\stm32f10x_gpio.h")
  GPIO_Init(GPIOA, &GPIO_InitStructure);/* PA0,PA12-> 左右脉冲输入 */
..\HARDWARE\TIMcounter\TIMcounter.c(18): warning:  #1295-D: Deprecated declaration SystemInit - give arg types
  SystemInit();//?system_stm32f10x.c?,?,?RCC?.
..\HARDWARE\TIMcounter\TIMcounter.c(18): warning:  #77-D: this declaration has no storage class or type specifier
  SystemInit();//?system_stm32f10x.c?,?,?RCC?.
..\HARDWARE\TIMcounter\TIMcounter.c(18): error:  #147: declaration is incompatible with "void SystemInit(void)" (declared at line 79 of "..\USER\system_stm32f10x.h")
  SystemInit();//?system_stm32f10x.c?,?,?RCC?.
..\HARDWARE\TIMcounter\TIMcounter.c(19): error:  #79: expected a type specifier
  RCC_GetClocksFreq(&RCC_ClockFreq);
..\HARDWARE\TIMcounter\TIMcounter.c(19): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_GetClocksFreq(&RCC_ClockFreq);
..\HARDWARE\TIMcounter\TIMcounter.c(19): error:  #147: declaration is incompatible with "void RCC_GetClocksFreq(RCC_ClocksTypeDef *)" (declared at line 691 of "..\STM32F10x_FWLib\inc\stm32f10x_rcc.h")
  RCC_GetClocksFreq(&RCC_ClockFreq);
..\HARDWARE\TIMcounter\TIMcounter.c(21): error:  #79: expected a type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(21): error:  #757: constant "ENABLE" is not a type name
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(21): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(21): error:  #147: declaration is incompatible with "void RCC_APB2PeriphClockCmd(uint32_t, FunctionalState)" (declared at line 693 of "..\STM32F10x_FWLib\inc\stm32f10x_rcc.h")
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(22): error:  #79: expected a type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(22): error:  #757: constant "ENABLE" is not a type name
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(22): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(23): error:  #79: expected a type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(23): error:  #757: constant "ENABLE" is not a type name
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(23): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(24): warning:  #1-D: last line of file ends without a newline
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(24): error:  #79: expected a type specifier
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(24): error:  #757: constant "ENABLE" is not a type name
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(24): warning:  #77-D: this declaration has no storage class or type specifier
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c(24): error:  #147: declaration is incompatible with "void RCC_APB1PeriphClockCmd(uint32_t, FunctionalState)" (declared at line 694 of "..\STM32F10x_FWLib\inc\stm32f10x_rcc.h")
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
..\HARDWARE\TIMcounter\TIMcounter.c: 9 warnings, 25 errors
compiling stm32f10x_adc.c...
"no source": Error:  #5: cannot open source input file "C:\Users\Administrator\Desktop\stm32搴揬LQ-F103Z-SYS 20140917\娴嬭瘯绋嬪簭\stm32娴嬭瘯\STM32F10x_FWLib\src\stm32f10x_adc.c": No such file or directory
C:\Users\Administrator\Desktop\stm32库\LQ-F103Z-SYS 20140917\测试程序\stm32测试\STM32F10x_FWLib\src\stm32f10x_adc.c: 0 warnings, 1 error
"..\OBJ\PRACTICE.axf" - 25 Error(s), 9 Warning(s).
Target not created.
Build Time Elapsed:  00:00:01

哈哈,我一看怎么看怎么别扭,以后得注意函数的应用

找到原因了,开头忘了写void mmmm()
{
}

哈哈哈哈哈

给大佬双击666

累死在了学单片机途中

你是在逗我们玩?

给大佬  哈哈哈哈哈!

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top