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

Fixed Point Decimal - How to use ? (_fixed(n))

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



Joined: 08 Sep 2008
Posts: 21

View user's profile Send private message

Fixed Point Decimal - How to use ? (_fixed(n))
PostPosted: Wed Jan 14, 2009 11:05 am     Reply with quote

I see in the manual it lists the _fixed(n) type qualifier. I'm not really sure how to use it. Do I do something like

Code:
int_fixed(2) nTest;

for a 2 place decimal value? Then when I use that, is it already formatted to 2 decimal places? Is there any good example for using it?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 14, 2009 4:19 pm     Reply with quote

Here's the CCS new features page with an example:
http://www.ccsinfo.com/content.php?page=fpdec

We tested it a little bit in this thread and it failed (GPF'ed). However, I
believe this was because the array was placed in ROM with the 'const'
keyword. So just don't attempt to declare _fixed variables as 'const'.
http://www.ccsinfo.com/forum/viewtopic.php?t=36734

Other than that, I don't think much testing has been done on it (at least
based on articles posted in the forum).
mayler



Joined: 13 Nov 2008
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 16, 2009 9:53 am     Reply with quote

You can use a normal number and use %w in printf to generate a formatted output. See in printf manual.
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