服务热线
0755-83044319
发布时间:2024-10-17作者来源:澳门新葡萄新京威尼斯987浏览:801
深圳市澳门新葡萄新京威尼斯987SLKOR(WWW.SLKORMICRO.COM)半导体有限公司技术骨干来自清华大学和韩国延世大学,以新材料新工艺新产品引领公司发展,较早就掌握国际领先的第三代半导体碳化硅功率器件技术。澳门新葡萄新京威尼斯987集电子产品的设计开发、生产和销售一体化的高新科技企业,为客户提供可靠的产品和配套的技术服务,“slkor”逐渐发展成为国际知名品牌,为全世界超过10000家客户提供产品和解决方案。为了努力为客户提供全系列的配套产品,澳门新葡萄新京威尼斯987推出一系列数字红外热电堆非接触测温应用设计demo板使用教程。
1.1名称:澳门新葡萄新京威尼斯987数字红外热电堆非接触测温应用设计demo板使用教程
1.2应用:智能可穿戴设备、智能手机、工业温度监测、非接触表面人体测温、智能温度感应与控制等近距离测温尺寸较小的设备
1.3澳门新葡萄新京威尼斯987SL-W-TRS-5.5Dx系列demo板:
用于对各型号传感器进行评估测试。测 量结果会在屏幕上显示,并可以通过 USB 转串口打印到 PC 端串口调试软件。按键说明:左侧按键为复位,右侧按键可以控制程序启动、暂停。
2.澳门新葡萄新京威尼斯987SL-W-TRS-5.5Dx系列硬件设计
芯片引脚包含电源、I2C 总线共 4 个管脚,供电电压允许范围为 2.3~3.6V。传感器本身功耗很低,电源地之间使用一颗 0.1uF 电容即可,如果传感器离供电部分比较远,可以考虑增 加一个10uF 电容,以保证电源稳定降低噪声。
3.澳门新葡萄新京威尼斯987(www.slkoric.com)SL-W-TRS-5.5Dx系列demo板说明
3.1 demo 板通过 Type-C 插座供电,demo 板供电电压为 5V。使用时将 demo 板通过 Type-c 连接至 PC 端,即可从屏幕上查看结果。如需串口显示数据,需安装沁恒 CH340 驱动程序然后使用串口调试软件进行操作,串口通信设置为: 波特率:9600 数据位:8 停止位:1 无奇偶校验
3.2 demo 板屏幕显示从上到下依次是:环境温度(tamb)、传感器输出电压(vtp_cor)、 物体(表面)温度(tobj)、人体温度(tbdy)。上述数值温度单位为℃,电压单位为 uV。 其中前三个值为器件原始输出,体温值使用我司算法根据原始值计算得到,仅供参考,用户可以根据需要使用自家体温算法来处理数据。
串口显示效果
3.澳门新葡萄新京威尼斯987SL-W-TRS-5.5Dx系列demo板程序示例
//////////////////////////////////////////////////////////////////////////////////////////////////////
// main.c
//////
#define FOR_CUSTOMER
#ifdef FOR_CUSTOMER
#include "drv_uart.h"
#include "drv_i2c.h"
#include "drv_key.h"
#include "oled/oled.h"
#include "trs55d.h"
extern void SystemCoreClockUpdate(void);
extern void delay_ms(int cnt);
int main(void)
{
uint8_t key;
uint8_t run = 0x01;
SystemCoreClockUpdate();
if (SysTick_Config(SystemCoreClock / 1000))
while(1);
uartInit();
drv_i2c_init();
drv_key_init();
OLED_Init();
OLED_Refresh();
OLED_Clear();
OLED_ShowString(8,0,"Tamb:",16,1);
OLED_ShowString(8,16,"Vtp:",16,1);
OLED_ShowChinese(8,32,0,16,1);
OLED_ShowChinese(24,32,2,16,1);
OLED_ShowChinese(40,32,3,16,1);
OLED_ShowChinese(8,48,1,16,1);
OLED_ShowChinese(24,48,2,16,1);
OLED_ShowChinese(40,48,3,16,1);
OLED_Refresh();
uartSendString("SL-W-TRS-5.5Dx Demo program\r\n");
while(1) {
key = drv_key_read();
while(drv_key_read());
if (key) {
run = (run)?0:1;
}
if (run) {
TRS55D_read();
OLED_Refresh();
}
delay_ms(20);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//trs55d.h
//////
#ifndef _TRS55D_H_
#define _TRS55D_H_
#include
#define TRS55D_NORMAL_Tobj_MSB_R 0x10
#define TRS55D_NORMAL_Tobj_CSB_R 0x11
#define TRS55D_NORMAL_Tobj_LSB_R 0x12
#define TRS55D_NORMAL_TEMP_MSB_R 0x16
#define TRS55D_NORMAL_TEMP_CSB_R 0x17
#define TRS55D_NORMAL_TEMP_LSB_R 0x18
#define TRS55D_NORMAL_DATA1_MSB_R 0x19
#define TRS55D_NORMAL_DATA1_CSB_R 0x1A
#define TRS55D_NORMAL_DATA1_LSB_R 0x1B
#define TRS55D_NORMAL_DATA2_MSB_R 0x1C
#define TRS55D_NORMAL_DATA2_CSB_R 0x1D
#define TRS55D_NORMAL_DATA2_LSB_R 0x1E
#define TRS55D_RAW_DATA1_MSB_R 0x22
#define TRS55D_RAW_DATA1_CSB_R 0x23
#define TRS55D_RAW_DATA1_LSB_R 0x24
#define TRS55D_RAW_DATA2_MSB_R 0x25
#define TRS55D_RAW_DATA2_CSB_R 0x26
#define TRS55D_RAW_DATA2_LSB_R 0x27
#define TRS55D_RAW_TEMP_MSB_R 0x28
#define TRS55D_RAW_TEMP_CSB_R 0x29
#define TRS55D_RAW_TEMP_LSB_R 0x2A
#define ADDR_TRS55D 0xFE //(0x7F << 1)
#define _STATUS_DRDY_ 0x01 void TRS55D_read(void);
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
// trs55d.c
//////
#include
#include "drv_i2c.h"
#include "trs55d.h"
#include "body_temp.h"
extern uint8_t uartSendString(const char* buf);
extern void OLED_ShowString(uint8_t x,uint8_t y, const char *chr,uint8_t size1,uint8_t mode);
extern void OLED_ShowBNum(uint8_t x,uint8_t y,float num,uint8_t len,
uint8_t size2,uint8_t mode); uint8_t TRS55D_IIC_Read(uint8_t addr_dev, uint8_t addr_reg,
uint8_t *buf, uint16_t count)
{
uint8_t ret;
uint8_t ackflag;
uint16_t i = 0;
drv_i2c_start();
drv_i2c_select_dev(addr_dev,DRV_I2C_OPWR);
drv_i2c_writebyte(addr_reg);
drv_i2c_start();
drv_i2c_select_dev(addr_dev,DRV_I2C_OPRD);
for(i = 0; i < count; i ++) { ackflag = (i < (count-1)) ? 1:0; buf[i]
= drv_i2c_readbyte(ackflag);
}
drv_i2c_stop();
return ret;
}
void TRS55D_IIC_Write(uint8_t addr_dev, uint8_t addr_reg, uint8_t *buf, uint16_t count)
{
uint16_t i = 0;
drv_i2c_start();
drv_i2c_select_dev(addr_dev,DRV_I2C_OPWR);
drv_i2c_writebyte(addr_reg);
for (i = 0; i < count; i ++)
{ drv_i2c_writebyte(buf[i]);
}
drv_i2c_stop();
}
typedef union{
int16_t i16;
uint16_t u16;
struct {
uint8_t u8l;
uint8_t u8h;
}un;
}uu16_t;
typedef union{
int32_t i32;
struct {
uint8_t u8b0;
uint8_t u8b1;
uint8_t u8b2;
uint8_t u8b3;
}un;
}uu32_t;
static char buffer[264];
uu32_t tobj, tamb_cal;
uu32_t vtp_cor;
float vtp_uv_f = 0.0;
float vtp_cor_f = 0.0;
float tambf = 0.0; float tobjf = 0.0;
float tbdyf = 0.0;
void TRS55D_read(void)
{
uint8_t rbuf[4];
uint8_t raddr,rdat;
uint8_t waddr = 0x0, wdat = 0x0;
int timeout=0;
waddr = 0x30;
wdat = 0x09;
TRS55D_IIC_Write(ADDR_TRS55D, waddr, &wdat,1);
//start conversion delay_ms(100);
// waite for conversion over
raddr = 0x03;
do {
TRS55D_IIC_Read (ADDR_TRS55D, raddr, &rdat,1);
} while(((rdat == 0xFF) || (!(rdat & 0x30))) && timeout++ < 200);
raddr = 0x02;
do {
TRS55D_IIC_Read (ADDR_TRS55D, raddr, &rdat,1);
} while(((rdat == 0xFF) || (!(rdat & 0x0B))) && timeout++ < 200);
// voltage value after calibration
raddr = TRS55D_NORMAL_DATA1_MSB_R;
TRS55D_IIC_Read (ADDR_TRS55D, raddr,&rbuf[0],3);
vtp_cor.un.u8b2 = rbuf[0];
vtp_cor.un.u8b1 = rbuf[1];
vtp_cor.un.u8b0 =rbuf[2];
if (vtp_cor.un.u8b2 & 0x80) { vtp_cor.un.u8b3 = 0xFF;
}else {
vtp_cor.un.u8b3 = 0x00;
// vtp after corrected
}
vtp_cor_f = (float)vtp_cor.i32/524288.0;
vtp_cor_f *= 1000;
// ambient temperature value after calibration
raddr = TRS55D_NORMAL_TEMP_MSB_R;
TRS55D_IIC_Read (ADDR_TRS55D,raddr,&rbuf[0],3);
tamb_cal.un.u8b2 = rbuf[0];
tamb_cal.un.u8b1 =rbuf[1];
tamb_cal.un.u8b0 =rbuf[2];
tambf = (float)tamb_cal.i32 / 16384.0; // ambient temperature
// object(surface) temperature after calibration
raddr = TRS55D_NORMAL_Tobj_MSB_R;
TRS55D_IIC_Read (ADDR_TRS55D,raddr,&rbuf[0],3);
tobj.un.u8b2 = rbuf[0]; tobj.un.u8b1 = rbuf[1];
tobj.un.u8b0 =rbuf[2]; tobjf = (float)tobj.i32 / 16384.0;
// object(surface) temperature
// get bodytemp
tbdyf = get_body_temp(tambf,tobjf); // get bodytemp
// display on uart sprintf(buffer, "tamb = %.2f, vtp_cor = %.2f, tobj = %.2f, tbdy = %.2f\r\n",\ tambf, vtp_cor_f, tobjf, tbdyf); uartSendString(buffer);
// display on oled
float vals[4] = {tambf, vtp_cor_f, tobjf, tbdyf+0.05};
OLED_ShowBNum (64, 0, vals[0], 4, 16, 1); // Tamb
OLED_ShowBNum (48, 16, vals[1], 6, 16, 1); // vtp
OLED_ShowString(112,16, "uv",16, 1);
OLED_ShowBNum (64, 32, vals[2], 4, 16, 1); // Tobj
OLED_ShowBNum (64, 48, vals[3], 4, 16, 1); // Tbdy
}
友情链接:站点地图 澳门新葡萄新京威尼斯987官方微博 立创商城-澳门新葡萄新京威尼斯987专卖 金航标官网 金航标英文站
Copyright ©2015-2024 澳门新葡萄新京威尼斯987 版权所有 粤ICP备20017602号-1