We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I was tryning to use MDK-ARM 5 I find some difficulties in its configuration. This code is basically used to turn on the led that is connected to the pin 12 of the port D on the STM32F407VG. The problem is when I try to bild it, on error is appeared that says :
main.c(20): error: #268: declaration may not appear after executable statement in block GPIO_InitTypeDef GPIO_InitStructure;
#include "stm32f4xx.h" // Device header #include "stm32f4xx_rcc.h" // Keil::Device:StdPeriph Drivers:RCC #include "stm32f4xx_gpio.h" // Keil::Device:StdPeriph Drivers:GPIO void GPIO(void); int main(){ GPIO(); while(1){ GPIO_SetBits(GPIOD, GPIO_Pin_12); } } void GPIO(){ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); }
Can you tell me guys what could be the problem with that. Thank you.