Today is...
Sunday, August 20, 2017
Welcome to Control.com, the global online
community of automation professionals.
Featured Video...
Featured Video
EtherCAT with CTC’s master lets your multivendor network play well together...
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Converting Integer Data Type to Celsius or Fahrenheit
Simple conversion escapes me

How do I convert an integer data type to Celsius or Fahrenheit? For example 0-32767

1 out of 2 members thought this post was helpful...

What temperature value does your count of 32767 represent? C or F?
What temperature value does your count of 0 represent? C or F?

0 out of 1 members thought this post was helpful...

32767 = 3400F
It is for scaling a temperature sensor in liquid steel bath.

>What temperature value does your count of 32767 represent?
>C or F?
>What temperature value does your count of 0 represent? C or
>F?

By pvbrowser on 19 June, 2017 - 9:44 am
1 out of 1 members thought this post was helpful...

case C2FAHRENHEIT:
ret = (val * 9.0f / 5.0f) + 32.0f;
break;
case FAHRENHEIT2C:
ret = (val - 32.0f) * 5.0f / 9.0f;
break;

1 out of 1 members thought this post was helpful...

Starting with the raw value stored in a register called "integer" and assuming that 0-32767 = 0-3400F:

DegF = (integer/32767) * 3400

DegC = (DegF - 32)*5/9