Hi
is it possible create a function with variable parameters on CW6.3 SE ?
I did a function void SendUart(byte *pbFrase,byte bQUart ) and and works perfectly
With a MCF51QE128 if If I transmit SendUart("Hello",2 ) I receive OK on a serial terminal.
I do void SendUart(byte *pbFrase,byte bQUart,... ) to acept variable parameters CW6.3 doesn`t give errors
but not work well.
When I debbug the function don´t pass well the parameters.
Maybe U have another way to define these functions.
ia there some experience in this area?
Eugenio
已解决! 转到解答。
Hello
Just an additional comment on using functions with variable parameters.
When you are invoking such a function it is mandatory to have a prototype of the function specified before you actually call it.
Often parameter passing scheme for normal function and function with variable parameter differs a bit.
So you have to use a function prototype before you invoke such a function.
CrasyCat
Hello
Just an additional comment on using functions with variable parameters.
When you are invoking such a function it is mandatory to have a prototype of the function specified before you actually call it.
Often parameter passing scheme for normal function and function with variable parameter differs a bit.
So you have to use a function prototype before you invoke such a function.
CrasyCat
Thanks for your response, now the function works well.
Maybe you can ask another question, When I include <stdio.h> the printf function should work, but it is not accepted by the compiler.
printf does not change color in the editor and it does not work.
That thing I have not taken into account?
Eugenio
Color in IDE doesn't matter. Even if it changes, sometimes it changes only after successfull build.
Printf may not work without output driver routine (look into library source or search examples folders for projects that are using printf). You may try sprintf, which also takes variable number of arguments, but doesn't depend on output routines.
Thanks for your help
Finally I found the problem
I describe below in case anyone needs it.
To use functions like sprintf , printf and others besides include <Stdio.c> you need to add the printf.c file in your project
The functions started to work when I added printf.c in Libs next to the MCF51QE128.C and console_io_cf.c
console_io_cf.c was added automatically when I create the project and I´m not sure if it is important
printf.c is in
C:\Programs Files\Freescale\CodeWarrior for Microcontrollers V6.3\ColdFire_Support\ewl\EWL_C\src\printf.c.
Best Regards
Eugenio