资源简介
STM32驱动 AMG8833 红外传感器系列程序 。
代码片段和文件信息
#include “amg88xx.h“
#include “iic.h“
void AMG88xx_Init(u8 div_add)
{
AMG88xx_wrte_byte(div_addAMG88xx_PCTLPCTL_NORMAL);
AMG88xx_wrte_byte(div_addAMG88xx_RSTRST_INITIAL);
AMG88xx_wrte_byte(div_addAMG88xx_INTCINT_DISABLE);
AMG88xx_wrte_byte(div_addAMG88xx_FPSCFPSC_10FPS);
}
void AMG88xx_wrte_byte(u8 div_addu8 regu8 data)
{
Start();
Send_Byte(div_add);
WaitAck();
Send_Byte(reg);
WaitAck();
Send_Byte(data);
WaitAck();
Stop();
}
float AMG88xx_read_byte(u8 div_addu8 reg)
{
uint8_t HIGHLOW;
float pixel;
uint8_t sign;
Start();
Send_Byte(div_add);
WaitAck();
Send_Byte(reg);
WaitAck();
Start();
Send_Byte(div_add+1);
WaitAck();
LOW=Read_Byte();
Ack();
HIGH=Read_Byte();
NAck();
Stop();
if(HIGH&0x08)
{
HIGH = ~HIGH;
LOW = ~LOW;
sign = 0;
}
else sign = 1;
pixel=(float)(HIGH<<8|LOW)*0.25;
if(sign)return pixel;
else return -pixel;
}
void AMG88xx_read64Pixels(u8 div_addfloat *bufu8 size)
{
uint8_t i;
uint8_t reg = AMG88xx_T01L;
for(i=0;i {
buf[i] = AMG88xx_read_byte(div_addreg);
reg+=2;
}
}
float AMG88xx_Readthermistor(u8 div_add)
{
uint8_t HIGHLOW;
float TEMP;
uint8_t sign;
Start();
Send_Byte(div_add);
WaitAck();
Send_Byte(AMG88xx_TTHL);
WaitAck();
Start();
Send_Byte(div_add+1);
WaitAck();
LOW=Read_Byte();
Ack();
HIGH=Read_Byte();
NAck();
Stop();
if(HIGH&0x08)
{
HIGH = HIGH&0X7F;
sign = 0;
}
else sign = 1;
TEMP=(float)(HIGH<<8|LOW)*0.0625;
if(sign)return TEMP;
else return -TEMP;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1603 2019-09-30 15:52 AMG88xx\AMG88xx.c
文件 2261 2019-09-30 15:47 AMG88xx\AMG88xx.h
目录 0 2019-09-30 15:52 AMG88xx\
- 上一篇:AMR-LBM-OpenMP-2D.rar
- 下一篇:机械专业课程设计三爪卡盘的设计
评论
共有 条评论