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
51 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