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

Convert Hexadecimal to Decimal

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



Joined: 07 Jul 2005
Posts: 27
Location: Rotova

View user's profile Send private message

Convert Hexadecimal to Decimal
PostPosted: Thu Mar 09, 2006 6:25 am     Reply with quote

Hello!!!
I 'm connect a AD7788 of 16 bits to PIC16F877. The AD7788 send the output register with the data of conversion. I keep the data with a variable "long" call result.
Code:

result=make32(spi_read(0),spi_read(0));

This value I want show in display , but this value is in Hexadecimal.

How I can convert this value in decimal?
Ttelmah
Guest







PostPosted: Thu Mar 09, 2006 9:35 am     Reply with quote

Use a different printout...
The numbers internally, are binary. It is the output command that changes them to the displayed format. %Lx, will print the value in 'hex', while %Ld will print the number in decimal.
Why 'make32'?. You only need to use Make16...

Best Wishes
John Ilicitean



Joined: 07 Jul 2005
Posts: 27
Location: Rotova

View user's profile Send private message

PostPosted: Thu Mar 09, 2006 11:15 am     Reply with quote

Thank's!! Now, I see in display a decimal number.

But I want to manipulate this data. I'm doing a digital thermometer using a PTR.
I simulate the PTR with a potentiometer. When I change of value the potentiometer I see in the display,the minimum value is "2047" and the maximum value is "14990".

Good so , I want that when the value is "2047" I show in the display "0.00 C�"
and from being here increasing the value of the temperature in function of "result".
How I can do it?
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