Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Converting A/D value to float

Status
Not open for further replies.

salman83

Newbie level 4
Joined
May 23, 2006
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,343
Hi,

I am reading the teamperature sensor values using ADS1278 converter.

I do not know how to convert the A/D value into float.

Remember that A/D converter is 24 bit. Also, I am attaching a text file which contains some logged points.

Any help will be highly appreciated.

Regards.
 

Attachments

  • data.txt
    1.3 KB · Views: 68

Try this:

Code:
float  result =  ( float ) variable / 2^24
 

For example, I will take the first A/D value in the attached text file which is 5478960

So, 5478960 / 2^24 = 0.32657146453857421875

This is wrong, the above value is referenced for 200 degree centigrade. I need to map that value around 200 deg C
 

You did not mention the full scale before.
Ok, so multiply the resulted value with the full scalle that you want:

Code:
result =  ( float ) variable * ( 200/5478960 )
 

Hello


What sensor ?
What is the scale of this sensor ...and relation chip Degres ..mV
What is YOUR desired scaling ex: 0 to 100°C

What is the scale of ADC 24bits .. How many mV for result 0xFFFFFF result
signed or not signed
0xFFFFFF or +- 8FFFFF

Then we can go further ....
f1= (float) ADCvalue * Scaling_coeff
 

Hello!

Paulfjujo is right, you have to calibrate your thermometer.
You have 2 solutions:
1. The "no factory calibration" method. It means that you know exactly what your sensor
outputs, and at which temperature. Then you can calculate theoretically the ADC output
numbers, and therefore calculate the temperature back from the ADC reading.
2. The factory calibration method. Assuming you have some linearity, once your device is build,
measure 2 different temperatures. then you can interpolate between these temperatures, and
extrapolate out of that range.

Now a quick statistic analysis shows that you have a noise of 293 LSBs. As it is close to 256,
we can say that you don't have 24 bit accuracy, but 16 only.

You can improve this value by oversampling, but the problem is that your system will become
less reactive. Remember that if you want to gain 4 bit accuracy, you have to sample 256 times
faster.

Dora.
 

You did not mention the full scale before.
Ok, so multiply the resulted value with the full scalle that you want:

Code:
result =  ( float ) variable * ( 200/5478960 )

The ratio in the parantheses would evaluate to zero here. You should write them as float:

Code:
result =  ( float ) variable * ( 200.0/5478960.0 )
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top