float getTemperatureLM35(void) { ADC12_B_startConversion( ADC12_B_BASE, ADCSTARTMEMORY, ADC12_B_SINGLECHANNEL ); __low_power_mode_3(); // LPM3, ADC12_B_ISR will force exit //Temperature = (ADCValue*Vref)/ADCResolution; Porting the same equation to IQMath library float temperature = _IQ7toF(_IQ7div(_IQ7mpy(_IQ7(ADCValue), _IQ7(VRef)), _IQ7(ADC))); return temperature; }
TEST(IQmath_ExtractInteger, IQ7int) { LONGS_EQUAL(16777215, _IQ7int(_IQ7(16777215.9921875))) ; LONGS_EQUAL(-16777216, _IQ7int(_IQ7(-16777216.0))) ; }