| Author |
Message |
blastronics
Joined: 04 Jul 2005 Posts: 64 Helped: 3 Location: Between heaven and earth
|
23 Oct 2006 18:27 Degree C to degree F and vise versa |
|
|
|
|
im doing a PIC project that controls a digital temperature sensor.
My problem is how to convert the temperature from deg C to Deg F and vise versa.
I need a routine for this...
Anybody have done this before?
p.s.
im using PIC16F877
|
|
| Back to top |
|
 |
Google AdSense

|
23 Oct 2006 18:27 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
lambtron
Joined: 02 Nov 2005 Posts: 256 Helped: 26 Location: Portland, OR
|
23 Oct 2006 18:55 Re: Degree C to degree F and vise versa |
|
|
|
|
What programming language are you using? c/c++ or assembler?
It is quite simple in c/c++: F = 1.8 * C + 32
|
|
| Back to top |
|
 |
jhbbunch
Joined: 21 Feb 2006 Posts: 222 Helped: 16
|
24 Oct 2006 6:21 Re: Degree C to degree F and vise versa |
|
|
|
|
| It might be easier if you make it F = 18*C + 320 and adjust the decimal point on your display. That way you can do shift C four places and add it to C shifted 1 place which is the same as 16*C + 2*C = 18*C. Then add this to the 320. The shifts and add would need to be done in 16 bit math, but it's all integer math and quite simple to do.
|
|
| Back to top |
|
 |