in real the function "myFunction" is declared in an external header-file. in a former version of the function i used the parameter "str1" for printf. but i removed the printf-command because i got only trash.
as you can see the serial port monitor should show me "xhok" in this version, but it shows me "xxxxxok" instead. this means, that the function "myFunction" is executed five times although it is called only once! but when i remove "char *str1" so the function receives no more parameter, it works fine. but i need the parameter for the printf-command in the function.
so what can be the reason of that the function is executed several times and that the pointer "str1" points to invalid data and how can i get that fixed?
thank you!
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
Posted: Wed Aug 04, 2004 10:37 am
Pointers to string constants are not supported. You will need to copy "Hello" to RAM and then call your function with the address of the RAM variable. The reason it is being called 5 times is that the compiler calls it for each char in your string.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum