STM32 单片机 读取 GY906 ML90614非接触式红外传感器 |
您所在的位置:网站首页 › mlx90614红外传感器电路图 › STM32 单片机 读取 GY906 ML90614非接触式红外传感器 |
MLX90614是一款红外非接触温度计,由内部状态机控制物体温度和环境温度的测量和计算,进行温度后处理,并将结果通过PWM或是SMBus模式输出。MCU主要通过SMBus协议与MLX90614通信来读取它的数据。 GY906模块主要分GY-906-BAA(或DAA,测距2CM),GY-906-BCC(或DCC,测距10CM)和GY-906-DCI(测距1M),这里使用的是GY906-DAA模块。 程序使用最新的STM32 HAL库产生, 与GY906模块通信的SDA SCL脚设置为开漏输出。 STM32使用IO口模拟来和GY906的SMBus总线通信, 启动信号: 停止信号: 调用SMBus_ReadMemory即可读取float型温度值: /******************************************************************************* * Function Name : SMBus_ReadMemory * Description : READ DATA FROM RAM/EEPROM * Input : slaveAddress, command * Output : None * Return : Data *******************************************************************************/ uint16_t SMBus_ReadMemory(uint8_t slaveAddress, uint8_t command) { uint16_t data; // Data storage (DataH:DataL) uint8_t Pec; // PEC byte storage uint8_t DataL=0; // Low data byte storage uint8_t DataH=0; // High data byte storage uint8_t arr[6]; // Buffer for the sent bytes uint8_t PecReg; // Calculated PEC byte storage uint8_t ErrorCounter; // Defines the number of the attempts for communication with MLX90614 ErrorCounter=0x00; // Initialising of ErrorCounter slaveAddress |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |