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

CODE for Call void function with parameter?

void PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
{
.
.
.
}

int main()
{

PWM_Config();   // THIS LINE SHOWS AN ERROR

.
.
.
}

ERROR LIST:

main.c(251): error: #165: too few arguments in function call PWM_Config();

BUT, If I write the program below, there is an no error

void PWM_Config()
{
.
.
.
}

int main()
{

PWM_Config();   // NO ERROR

.
.
.
}

KINDLY HELP!

Parents
  • please understand.I am not cleared with your words.

    Initially, I programmed

    void PWM_Config()
    {
    .
    .
    .
    }
    
    int main()
    {
    
    PWM_Config();   // NO ERROR
    
    .
    .
    .
    }
    

    The above program was been made, because some value is declared within the program.

    Now. the values are input from outside of program so I am using COMMAND HANDLER so when I give certain value it should have to store in the TIM_PERIOD and TIM_PULSE .

    so I am rewriting the program,like below

    void PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
    {
    .
    .
    .
    }
    
    int main()
    {
    
    PWM_Config();   // THIS LINE SHOWS AN ERROR
    
    .
    .
    .
    }
    

    Now this shows an error. I want to know the exact reason.

    Moreover, I also want to know the write way to call this below function from the int main()

    void PWM_Configvoid PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
    

    Thank you

Reply
  • please understand.I am not cleared with your words.

    Initially, I programmed

    void PWM_Config()
    {
    .
    .
    .
    }
    
    int main()
    {
    
    PWM_Config();   // NO ERROR
    
    .
    .
    .
    }
    

    The above program was been made, because some value is declared within the program.

    Now. the values are input from outside of program so I am using COMMAND HANDLER so when I give certain value it should have to store in the TIM_PERIOD and TIM_PULSE .

    so I am rewriting the program,like below

    void PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
    {
    .
    .
    .
    }
    
    int main()
    {
    
    PWM_Config();   // THIS LINE SHOWS AN ERROR
    
    .
    .
    .
    }
    

    Now this shows an error. I want to know the exact reason.

    Moreover, I also want to know the write way to call this below function from the int main()

    void PWM_Configvoid PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
    

    Thank you

Children