title: CodeWarrior compiler warning: "Possible loss of data"
body: <p>Please consider the following code:</p>
  
  <pre><code>unsigned int  beta;
  
  unsigned int theta;
  
  unsigned int m = 4;
  
  unsigned int c = 986;
  
  unsigned int Rpre = 49900;
  
  
  
  unsigned int getUAnalog(unsigned char channel) // to get the PT1000 Signal
  
  {
  
  unsigned int result;
  
  unsigned int f_temp;
  
  //select channel and initiate conversion
  
  ADCSC1 |= (channel &amp; 0b11111);
  
  
  
  //wait until conversion is complete
  
  while(!ADCSC1_COCO);
  
  
  
  f_temp = ADCRH;
  
  f_temp &lt;&lt;= 8;
  
  f_temp += ADCRL;
  
  
  
  beta = (((f_temp) / (4096*28))*1000); // warning: possible loss of data.
  
  theta = ((((beta)*(Rpre))/(1-beta))*1000);
  
  result = (theta-c)/(m);
  
  return result;
  }
  </code></pre>
  
  <p>I am using MC9S08DZ60 (<a href="http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08DZ60.pdf" rel="nofollow">http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08DZ60.pdf</a>) with PT1000-Temperature Sensor on CodeWarrior version 5.9.0 . This function is meant to calculate the temp and return "result". But the "beta" and "theta" values remain 0. No Change.</p>
  
  <p>Also i get the warning as C2705: Possible Loss of Data.  The value of "result" is not right. PLease help as i dont have clue of what going wrong!!</p>
  
  <p>Thanks in advance!</p>