Joined: 21 Feb 2004 Posts: 12 Location: Santiago - Chile
decimal counter to 16 bit data
Posted: Mon Mar 01, 2004 5:20 pm
Hi.
I need to program a decimal counter beginning from 0 ( EX: 0 , 1 , 2 ... 10000) but my problem is the format of the data because the final saved data its must be like in XXXXh format (example 1= 0001h , 27=001Bh 75=004Bh).
Any ideas how to solve this problem?
thnks
ignacio
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Tue Mar 02, 2004 12:54 am
Use printf. It will re-format your binary value into whatever
form you want (or nearly so). Of course, the output is in
ASCII, but I assume that's what you want. You want
to display a binary value as ASCII hexadecimal.
Look in the CCS manual, in the section on printf, and
find the format string that will give you ASCII hex output.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum