參考鏈接:
BMP390高精度壓力傳感器數據讀取與處理(基于STM32)-CSDN博客? ??
https://blog.csdn.net/qq_43862401/article/details/106502397
?利用usb轉iic模塊測試bmp390l傳感器采集當前環境的溫度和氣壓數據,下圖中reserved表示保留位,不允許寫入數據,此時可以默認為0.
結合以下代碼可知,iic通信過程中各自寄存器對應的命令:
u8 BMP390_Init(void)
{u8 BMP390_ID;BMP390_Write_Byte(CMD_Addr,0xB6);//RESETdelay_ms(100);BMP390_ID = BMP390_Read_Byte(CHIP_ID_Addr);//Read the CHIP_ID-0x60BMP390_Write_Byte(PWR_CTRL_Addr,0x33);//Set Working mode and state of sensorBMP390_Write_Byte(IF_CONF_Addr,0x00);//Serial interface settingsBMP390_Write_Byte(INT_CTRL_Addr,0x02);//Set interrupt configBMP390_Write_Byte(OSR_Addr,0x15);//Set the PM-RATE and PM-PRC,Set the TMPI-RATE and TMP-PRCBMP390_Write_Byte(ODR_Addr,0x04);//Set the configuration of the output data rates by means of setting the subdivision/subsampling.BMP390_Write_Byte(CONFIG_Addr,0x00);//IIR filter coeffcientsreturn BMP390_ID;
}
至于傳感器本身的地址,可以接好線后輸入數據手冊對應的chip_id傳感器測試下是否為手冊中對應的默認數據位,如下,0x76_0x00和0x770x_00分別嘗試,返回0x60的就是對應IIC的通信地址
? ? 我的傳感器地址為0xEC,也就是0x76左移一位。對比上述程序,可以得到對應的iic寄存器通信的命令如下:
讀:EC7EB6(reset)→EC1A00→EC1902→EC1C15→EC1D04→EC1F00→EC1B33? ? ? ? ? ? ? ? ? (0x33→00110011)
但需要注意,EC1B33設置傳感器讀取模式需要放在最后,否則可能會無法正常設置傳感器數據讀取模式。
寫:EC04(temp&pree)或者輸入EC07(temp)
另附上傳感器的數據位和對應的作用(數據手冊內容)