CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

decimal counter to 16 bit data

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
iseron



Joined: 21 Feb 2004
Posts: 12
Location: Santiago - Chile

View user's profile Send private message

decimal counter to 16 bit data
PostPosted: Mon Mar 01, 2004 5:20 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 02, 2004 12:54 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group