完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
HTS221读取所有湿度寄存器后的最终值始终为29.0%且未及时更改。所有数据寄存器都包含0xAE值。 HTS221的ST固件驱动程序也返回了29.0%和0xAE寄存器值。
根据数据表,标准的连接图 。 尝试了几个传感器,一个和同一个。对不起我的英语不好。 以上来自于谷歌翻译 以下为原文 HTS221 after read all humidity registers final value always 29.0% and not changed in time. All data register contain 0xAE values. ST firmware driver for HTS221 also returned 29.0% and 0xAE registers values. Connection diagram of the standard, according to datasheet . Tried several sensors, one and the same. sorry for my english. |
|
相关推荐
3个回答
|
|
你好,
我也在尝试使用HTS221传感器,并一直怀疑固件。我想知道你是否有一个名为HAL_EnvSensors.h的文件以及HTS221固件。如果有的话,请你分享一下这个文件吗? 谢谢, 以上来自于谷歌翻译 以下为原文 Hello, I am also trying to work with HTS221 sensor and have been posting doubts about the firmware. I would like to know if you have a file called HAL_EnvSensors.h along with the HTS221 firmware. Can you please share the file, in case you have it? Thanks, |
|
|
|
交换传感器测试,工作,固定标识符读取正确(188或0xBC)两者的数据表,但寄存器中的数据不更新。尝试了所有选项注册设置。始终是同一个29%的湿度。温度也是固定的。准备就绪将数据准备好的报告记录为温度和湿度。显然是有缺陷的批次。
我的代码: &LT;&LT; // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++ //ÃÃÃÃååHTS221 #define HTS221R 0xBF #define HTS221W 0xBE //ÃÃÃèèÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃèÿ void HTS221_Init(void) { uint8_t Dat [2]; //ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃððÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃà ÃÃÃÃÃÃÃÃÃâ1Ãö¶ Dat [0] = 0x20; Dat [1] = 0x85; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,Dat,2,100); //ÃÃÃÃÃÃÃÃÃðÃÃÃÃÃÃÃÃÃÃÃ?à Dat [0] = 0x10; Dat [1] = 0x1B; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,Dat,2,100); } //Ã-ÃÃÃÃÃÃÃÃÃÃÃÀÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃüà void HTS221_GetHymidity(void) { uint8_t Dat [4]; int16_t H0_T0_out,H1_T0_out,H_T_out; int16_t H0_rh,H1_rh; uint32_t tmp; Dat [0] = 0x30; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,Dat,1,100); HAL_I2C_Master_Receive(&amp; hi2c1,HTS221R,Dat,2,100); H0_rh = Dat [0]&gt;&gt; 1; H1_rh = Dat [1]&gt;&gt; 1; Dat [0] = 0x30; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,Dat,1,100); HAL_I2C_Master_Receive(&amp; hi2c1,HTS221R,Dat,2,100); H0_T0_out =(((uint16_t)Dat [1])&lt;&lt; 8)| (uint16_t)Dat [0]; Dat [0] = 0x3A; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,Dat,1,100); HAL_I2C_Master_Receive(&amp; hi2c1,HTS221R,Dat,2,100); H1_T0_out =(((uint16_t)Dat [1])&lt;&lt; 8)| (uint16_t)Dat [0]; Dat [0] = 0x28; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,Dat,1,100); HAL_I2C_Master_Receive(&amp; hi2c1,HTS221R,Dat,2,100); H_T_out =(((uint16_t)Dat [1])&lt;&lt; 8)| (uint16_t)Dat [0]; //ÃÃÃÃÃÃåå tmp =((uint32_t)(H_T_out - H0_T0_out))*((uint32_t)(H1_rh - H0_rh)* 10); CHymidity = tmp /(H1_T0_out - H0_T0_out)+ H0_rh * 10; if(CHymidity> 1000)CHymidity = 1000; CHymidity / = 10.0; } //Ã'ÃÃÃÃÃÃÃÃÃñ uint8_t HTS221_GetStatus(void) { uint8_t Byte = 0x27; HAL_I2C_Master_Transmit(&amp; hi2c1,HTS221W,&amp; Byte,1,100); HAL_I2C_Master_Receive(&amp; hi2c1,HTS221R,&amp; Byte,1,100); 返回字节; } // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++ &GT;&GT; 以上来自于谷歌翻译 以下为原文 Exchange with sensor tested, working, fixed identifier read correctly (188 or 0xBC) datasheet for both, but the data in the registers are not updated. Having tried all the options register settings. Always one and the same humidity of 29%. The temperature is also fixed. readiness Register reports that are ready the data as temperature and humidity. Apparently the defective batch. My code: << // ++++++++++++++++++++++++++++++++ HTS221 +++++++++++++++++++++++++++++++++++++ // Àäðåñ HTS221 #define HTS221R 0xBF #define HTS221W 0xBE // ÈÃèöèà ëèçà öèÿ void HTS221_Init(void) { uint8_t Dat[2]; // Ã�à ñòðîéêà ðåæèìà è ñêîðîñòè îòäà ÷è äà ÃÃûõ â 1 Ãö Dat[0] = 0x20; Dat[1] = 0x85; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, Dat, 2, 100); // Ã�à ñòðîéêà òî÷Ãîñòè Dat[0] = 0x10; Dat[1] = 0x1B; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, Dat, 2, 100); } // ×èòà åì âëà æÃîñòü void HTS221_GetHymidity(void) { uint8_t Dat[4]; int16_t H0_T0_out, H1_T0_out, H_T_out; int16_t H0_rh, H1_rh; uint32_t tmp; Dat[0] = 0x30; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, Dat, 1, 100); HAL_I2C_Master_Receive(&hi2c1, HTS221R, Dat, 2, 100); H0_rh = Dat[0] >> 1; H1_rh = Dat[1] >> 1; Dat[0] = 0x30; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, Dat, 1, 100); HAL_I2C_Master_Receive(&hi2c1, HTS221R, Dat, 2, 100); H0_T0_out = (((uint16_t) Dat[1]) << 8) | (uint16_t) Dat[0]; Dat[0] = 0x3A; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, Dat, 1, 100); HAL_I2C_Master_Receive(&hi2c1, HTS221R, Dat, 2, 100); H1_T0_out = (((uint16_t) Dat[1]) << 8) | (uint16_t) Dat[0]; Dat[0] = 0x28; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, Dat, 1, 100); HAL_I2C_Master_Receive(&hi2c1, HTS221R, Dat, 2, 100); H_T_out = (((uint16_t)Dat[1]) << 8) | (uint16_t) Dat[0]; // Ã�à ñ÷åò tmp =((uint32_t)(H_T_out - H0_T0_out)) * ((uint32_t)(H1_rh - H0_rh) * 10); CHymidity = tmp / (H1_T0_out - H0_T0_out) + H0_rh * 10; if (CHymidity > 1000) CHymidity = 1000; CHymidity /= 10.0; } // Ñòà òóñ uint8_t HTS221_GetStatus(void) { uint8_t Byte = 0x27; HAL_I2C_Master_Transmit(&hi2c1, HTS221W, &Byte, 1, 100); HAL_I2C_Master_Receive(&hi2c1, HTS221R, &Byte, 1, 100); return Byte; } // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> |
|
|
|
嗨,
我见过你的代码,我有一些建议和问题:1。在设置AV_CONF(10h)寄存器然后设置CTRL_REG1(20h)寄存器之前,应该更好地改变HTS221_Init的设置顺序。 2.在HTS221_GetHymidity中,我猜有一个错误。 要获得H0_T0_out值,必须读取0x36寄存器而不是0x30; 3。我不清楚你在哪里使用函数HTS221_GetStatus。 在调用HTS221_GetHymidity之前,您是否调用了此功能并检查了湿度数据是否准备就绪? 安东内拉 以上来自于谷歌翻译 以下为原文 Hi, I 've seen your code and I have some suggestions and questions:1. In the HTS221_Init should be better change the order of settings, before set the AV_CONF (10h) register and then the CTRL_REG1 (20h) register. 2. In the HTS221_GetHymidity, I guess there is an mistake. To get the H0_T0_out value, you have to read the 0x36 register and not 0x30;3. I am not clear where you use the function HTS221_GetStatus. Did you call this function and checked that the humidity data is ready before to call the HTS221_GetHymidity?Regards Antonella |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2725 浏览 1 评论
3237 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1807 浏览 1 评论
3646 浏览 6 评论
6034 浏览 21 评论
1337浏览 4评论
197浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
442浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
273浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 20:23 , Processed in 1.185473 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号