I've searched and read other threads in this forum but I can't get this to be recognized. I want to take an ADC result and convert it to a string so I can send t out over UART.
itoa seems not to be recognized.
I'm in PSoC creator 4.1 and the compiler is GCC 18.104.22.16886
Thanks in advance.
Solved! Go to Solution.
Thanks Bob, now I have #include
Where can I find the documentation of all the extra functions that are in stdlib.h?
Thanks, one other question if I may... now I have the result coming from the ADC and I use itoa() to convert it, like this...
The char string built in buffy (an array of char) is clearly assuming that the integer input is signed so a 0xFFF result reads -2048, is there a simple way to cast this so that I don't have that issue?
itoa() macro is a kind of simple. Did you ever consider using formatted IO with printf().
This will require some settings:
In Project -> Build Settings -> Linker set "Use Newlib nano" and "use newlib nano float formatting" (if you need that)
In System view set Heap Size to 0x0200
In your modules #include <stdio.h>
For formatted I/O see here. Best will be sprintf(Buffer,...) and UART_PutString(Buffer)
Do not forget to put a delimiter at end of your string. So the receiver will be able to detect and syncronize to the begin of a new sequence.
Bob, thanks for those suggestion which I'll investigate. I read up on newlib-nano and it seems to be applying some neat algorithms to make sprintf() and printf() statements as small as possible in the compiled code. Can you comment on that? Thanks
Yes, newlib nano has a very small footprint. Only exception to standard is that the scanf() functions are not contained.