This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, I'm working with the serial and I'm having trouble printing a hexadecimal value in uppercase. In lower case it works very well, in fact, I have:
System_sprintf(value, "%02x %02x %02x %02x\n ", Myvar, Myvar, Myvar, Myvar);
UART_write(uart, value, 29);
And I see: 5e 5e 5e 5e
If I use:
System_sprintf(value, "%02X %02X %02X %02X\n ", Myvar, Myvar, Myvar, Myvar);
UART_write(uart, value, 29);
I see: X X X X
I remember I had told not to use System_printf and UART_write at the same time.
If my post answers your question, please click on "This Resolved my issue" button to benefit others who have the same issue.
How to check APS ack in TI Z-Stack
How to detect button hold in CC26x2, CC13x0, CC13x2 SDK.
660 Zigbee devices in the same Zigbee network!
How to setup Mosquitto on Raspberry Pi and make Contiki/Contiki-NG cc26xx-web-demo do mqtt publish to it.
How to connect Contiki-NG cc26xx-web-demo to IBM Watson IoT Platform
How to build and run Contiki-NG cc26xx-web-demo running on LAUNCHXL-CC1310 and rpl-border-router on Raspberry Pi with slip radio running on LAUNCHXL-CC131
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to YiKai Chen:
If I use only System_sprintf it is the same thing. But you didn't answer my question
In reply to Mark Felsberg:
I had told you to use sprintf to format hex values to a string buffer and use System_printf to print the buffer.
I'm doing as you said, but still not printing hex in Upper case. Why do you still not answer my question?
In C language, lower case “x” in sprintf means to be replaced by the value in hex and upper case “X” in sprintf means to print upper case “X” directly.
I try but not works. In C language to printf a hex value with two value (f.e 6e), you should to need of use %02x in lower case and upper case "%02X" but this not works, I see only X.
What do you try but not work?
Capital X is not supported in System_printf. Here are the supported ones
Take a look at the cdoc for the xdc.runtime.System module for more details.
In reply to ToddMullanix:
Then I can't to use the X to see the hex value in uppercase?
I doesn’t work in this way.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.