View previous topic :: View next topic |
Author |
Message |
John Ilicitean
Joined: 07 Jul 2005 Posts: 27 Location: Rotova
|
Convert Hexadecimal to Decimal |
Posted: Thu Mar 09, 2006 6:25 am |
|
|
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
|
|
Posted: Thu Mar 09, 2006 9:35 am |
|
|
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
|
|
Posted: Thu Mar 09, 2006 11:15 am |
|
|
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? |
|
|
|