Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

How to read a 16-bit data into string in C code

I have a 16-bit data that is fed from FPGA in vhdl, The NIos II processor reads the 16-bit data from FPGA and do some processing tasks, where Nios II system is programmed in C code

How could I read this 16-bit data in string?

printf("%d", 16_bit_data);

// it shows a decimal value of 15282,

What should I do in order to get the result displayed as a string 0011101110110010?

Thank you in advance.