Jump to content

How to interpret the result from analogRead

Recommended Posts

In the classical temperature reading example in CCS, the following code is used for reading and calculation:


    ADC10CTL0 |= ENC + ADC10SC;             // Sampling and conversion start
   // oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = A10*423/1024 - 278
   temp = ADC10MEM;
   IntDegC = ((temp - 673) * 423) / 1024;


While in the sample code from Energia, the following line gave a substantially different forumla.. so I'm wondering there are differences between the two analog values read?


    values[j] = ((uint32_t)analogRead(TEMPSENSOR)*27069 - 18169625) *10 >> 16;

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...