初级会员

- 积分
- 167
- 金钱
- 167
- 注册时间
- 2017-7-17
- 在线时间
- 40 小时
|
1金钱
本帖最后由 荆白雪 于 2017-7-27 21:06 编辑
最近使用V3调试max30100程序,在论坛里看了空心杯大神的程序@空心杯,发现自己始终测不到正常的温度数据,Tint = Read_One_Byte(0x16);读整数温度数据时,串口输出只有31,47,63,而且不变,这是读温度函数,只初始化开启测温那一位。使用原子的软件IIC。有遇到过类似问题的小伙伴帮个忙。拜谢float Temp_Read(void){
float temp;
Write_One_Byte(0x06,0x08);//config_addr=0x06
delay_ms(100);
Tint = Read_One_Byte(0x16);
//temp = Tint;
Tfrac = Read_One_Byte(0x17);
temp = Tint + Tfrac /100;
return temp;
}
这是main函数:
int main(void)
{
float temp;
uart_init(115200);
delay_init();
IIC_Init();
while(1)
{
temp = 0;
temp = Temp_Read();
printf("temp: %.1f\r\n", temp);
//delay_ms(800);
}
}
|
|