xil_printf in format %08x is printing out the value: "8x". What's goign on here?

I'm reading out a 32 bit GPI from VHDL file, and I print it out using xil_printf with format type %08x. For some reason it is printing out 8x, when it normally should print something like 00000003 in hexadecimal format.

finishnEnd3 = (0xFFFFFFFF & XIOModule_DiscreteRead(&iom, 3) ); xil_printf("finishnend3 : %08x ,val: %d",finishnEnd3, finishnEnd3); 

And the output I get are: finishenend3 : 8x ,val: 101187738

5

1 Answer

xil_printf only supports a subset of what printf supports. Use sprintf to create a C string then pass it to xil_printf with the %s flag.

const int STR_MAX = 100; int hex = 0xDEADBEEF; char str[STR_MAX]; sprintf(str, "%08x", hex); xil_printf("%s",str); 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like