This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Procedure for Init GPIO

Hi guy,

I'm using ARM STM32F103RC, Cortex M3.

when I compiler the code with this order:

  //GPIO structure used to initialize port

  GPIO_InitTypeDef GPIO_InitStructure;

   

    //Enable clock on APB2 pripheral bus where button and LEDs are connected

  RCC_APB2PeriphClockCmd(LEDPORTCLK | BUTTONPORTCLK,  ENABLE);

 

is okay,

But I want to enable clock first,

the compiler give the error

main.c(28): error:  #268: declaration may not appear after executable statement in block

    GPIO_InitTypeDef  GPIO_InitStructure;

would you like to explain to me why this happened?

Minh

0