cancel
Showing results for 
Search instead for 
Did you mean: 

two weired error in a c programin keil

mhdizgah
Associate II
Posted on September 24, 2014 at 18:34

hi every body

i declared a void function

[CODE]

void SPI_MFRC522_Init(void)

{

..............

}

[/CODE]

& used it in a main program

[CODE]

void RC522_IO_Init(void)

{

GPIO_InitTypeDef GPIO_InitStruct;

RCC_APB2PeriphClockCmd(RC522_RESET_GPIO_CLK,ENABLE);

GPIO_InitStruct.GPIO_Pin = RC522_RESET_PIN;

GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;

GPIO_Init(RC522_RESET_GPIO_PORT, &GPIO_InitStruct);

[B][COLOR=''&sharpFF0000''] SPI_MFRC522_Init(void);[/COLOR][/B]

}

[/CODE]

and keil shows me this 2 error:

&sharp29:expected an expression 

&sharp140:too many arguments in function call

0690X00000602xoQAA.jpg

#keil #stm32f103
3 REPLIES 3
frankmeyer9
Associate II
Posted on September 24, 2014 at 20:35

That is a general C language issue.

''void'' is not a valid argument when calling a function. And second ''void'' means (in this context) that a function takes no arguments.

Therefore the compiler correctly complains about ''too much arguments''.

Posted on September 25, 2014 at 09:51

Hi Mahmoud,

You've just to call your function as follows:

SPI_MFRC522_Init();

Regards, Heisenberg.
frankmeyer9
Associate II
Posted on September 26, 2014 at 09:00

You've just to call your function as follows: ...

Perhaps you should add a special subforum, dedicated to basic C language teachings and questions ...