20260324
This commit is contained in:
14
IAPV1.1/Driver/temp/TEMP.C
Normal file
14
IAPV1.1/Driver/temp/TEMP.C
Normal file
@ -0,0 +1,14 @@
|
||||
#include "temp.h"
|
||||
#include "stm32l1xx.h"
|
||||
#include "adc.h"
|
||||
void get_temperature(u16 *temp)
|
||||
{
|
||||
|
||||
float temperate;
|
||||
temperate=Get_Adc_Average(ADC_CH_TEMP,1);
|
||||
temperate=temperate*(3.3/4096);
|
||||
temperate=(1.43-temperate)/0.0043+25; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>¶<EFBFBD>ֵ
|
||||
*temp=temperate*10;//<2F>õ<EFBFBD><C3B5>¶<EFBFBD>
|
||||
// temp[2]='.';temp[3]=t%10+'0';temp[4]=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user