Forum Discussion
Altera_Forum
Honored Contributor
11 years agoConvert dec to hex using nios ii
I was curious if there were a list of functions, in Nios ii using C, that convert decimal values to hex, binary etc... I am use to programming in Matlab so I am use to the quick and easy hex2dec conv...
Altera_Forum
Honored Contributor
11 years agoNios or any other cpu always works with binary values. Other numeric bases makes sense only for formatted input/output.
In this case the common stdio printf/scanf functions can do what you are asking for: printf("%d", v) : v in decimal format printf("%x", v) : v in hex format printf("%o", v) : v in octal format