Here is the codes, the result on Keil console is right but on the LCD shown incorreclty please someone should help me out am new in microcontrollers. thanks in advance
float logR2, R2, T; float R1=9950; float c1 = 0.001125308852122, c2 = 0.000234711863267, c3 = 0.000000085663516; char write[16]=" ";
lcd_init(_LCD_4BIT, _LCD_FONT_5x8, _LCD_2LINE); lcd_print(1,1, "temperature"); HAL_Delay(10);
HAL_ADC_Start (&hadc1); HAL_ADC_PollForConversion (&hadc1, 5); adc_Val = HAL_ADC_GetValue(&hadc1); R2 = (R1*adc_Val/(4096-adc_Val)); logR2 = log(R2); T =(1/ (c1 + c2*logR2 + c3*logR2*logR2*logR2)); T= (T-273.15); sprintf(write,"%.2f C",T); HAL_Delay (500);
Hallo Yusuf,
could you please specify which value is displayed on the LCD and which value is displayed in the console.
Hello Mr. Ron
The value of temperature from the thermistor on the console display 24 to 25C, as it's showing on my room weather forecast screen as far that time. while sending the temperature variable values to the LCD it's showing around 187C, latter I find out after a depth observation that the values on my LCD are not the temperature value from the thermistor its something else because I removed the thermistor connection from the stm32 and debug again the same values of 187C keeps displaying. Now I learn that it is from the process of sending the temp value to the LCD, I think I have a problem in KEIL IDE on how to send a Variable value to LCD, the problem started from here
sprintf(write,"%.2f C",T);
lcd_print(2,1,write);HAL_Delay (500);
while the rest of the code is Ok. now I will like to knew how to send the value of T to the LCD (T= (T-273.15);). I will be really appreciated it if you can guide me though thanks in advance