LMT86LP模拟温度传感器

介绍

LMT86是精密的CMOS温度传感器,它的大致参数如下:

  • 精度:±0.4误差
  • 范围:0°C 至 150°C
  • 封装:TO-92S
  • 引脚:VDD、GND、OUT
  • 价格:4RMB
  • 厂商:德州仪器
  • 供电:2.2V 至 5.5V

模块外观大概长这么样

在这里插入图片描述

硬件

VDD、GND、OUT引脚连线参考,电源端(VDD)加去耦电容、输出端(OUT)加滤波电容,连接ADC进行模拟量采集

在这里插入图片描述

关系表

温度和VOUT的对应关系

温度(°C) VOUT(mV) 温度(°C) VOUT(mV) 温度(°C) VOUT(mV) 温度(°C) VOUT(mV) 温度(°C) VOUT(mV)
-50 2616 -10 2207 30 1777 70 1335 110 883
-49 2607 -9 2197 31 1766 71 1324 111 872
-48 2598 -8 2186 32 1756 72 1313 112 860
-47 2589 -7 2175 33 1745 73 1301 113 849
-46 2580 -6 2164 34 1734 74 1290 114 837
-45 2571 -5 2154 35 1723 75 1279 115 826
-44 2562 -4 2143 36 1712 76 1268 116 814
-43 2553 -3 2132 37 1701 77 1257 117 803
-42 2543 -2 2122 38 1690 78 1245 118 791
-41 2533 -1 2111 39 1679 79 1234 119 780
-40 2522 0 2100 40 1668 80 1223 120 769
-39 2512 1 2089 41 1657 81 1212 121 757
-38 2501 2 2079 42 1646 82 1201 122 745
-37 2491 3 2068 43 1635 83 1189 123 734
-36 2481 4 2057 44 1624 84 1178 124 722
-35 2470 5 2047 45 1613 85 1167 125 711
-34 2460 6 2036 46 1602 86 1155 126 699
-33 2449 7 2025 47 1591 87 1144 127 688
-32 2439 8 2014 48 1580 88 1133 128 676
-31 2429 9 2004 49 1569 89 1122 129 665
-30 2418 10 1993 50 1558 90 1110 130 653
-29 2408 11 1982 51 1547 91 1099 131 642
-28 2397 12 1971 52 1536 92 1088 132 630
-27 2387 13 1961 53 1525 93 1076 133 618
-26 2376 14 1950 54 1514 94 1065 134 607
-25 2366 15 1939 55 1503 95 1054 135 595
-24 2355 16 1928 56 1492 96 1042 136 584
-23 2345 17 1918 57 1481 97 1031 137 572
-22 2334 18 1907 58 1470 98 1020 138 560
-21 2324 19 1896 59 1459 99 1008 139 549
-20 2313 20 1885 60 1448 100 997 140 537
-19 2302 21 1874 61 1436 101 986 141 525
-18 2292 22 1864 62 1425 102 974 142 514
-17 2281 23 1853 63 1414 103 963 143 502
-16 2271 24 1842 64 1403 104 951 144 490
-15 2260 25 1831 65 1391 105 940 145 479
-14 2250 26 1820 66 1380 106 929 146 467
-13 2239 27 1810 67 1369 107 917 147 455
-12 2228 28 1799 68 1358 108 906 148 443
-11 2218 29 1788 69 1346 109 895 149 432

驱动

ADC配置:初始化ADC2用于温度传感器读取

void InitAdc2(void)
{
   
   
    extern void DSP28x_usDelay(Uint32 Count);

    // To powerup the ADC2 the ADC2ENCLK bit should be set first to enable
    // clocks, followed by powering up the bandgap, reference circuitry, and
    // ADC2 core.
    // Before the first conversion is performed a 5ms delay must be observed
    // after power up to give all analog circuits time to power up and settle

    // Please note that for the delay function below to operate correctly the
    // CPU_RATE define statement in the F28M35x_Examples.h file must
    // contain the correct CPU clock period in nanoseconds.
    EALLOW;
    Adc2Regs.ADCCTL1.bit.ADCBGPWD  = 1;      // Power ADC2 BG
    Adc2Regs.ADCCTL1.bit.ADCREFPWD = 1;      // Power reference
    Adc2Regs.ADCCTL1.bit.ADCPWDN   = 1;      // Power ADC2
    Adc2Regs.ADCCTL1.bit.ADCENABLE = 1;      // Enable ADC2
    Adc2Regs.ADCCTL1.bit.ADCREFSEL = 0;      // Select interal BG
    EDIS;

    DELAY_US(ADC_usDELAY);         // Delay before converting ADC2 channels
}

void TempSensor_Init(void)
{
   
   
    EALLOW;

    // 初始化ADC2(假设已有InitAdc2()函数)
    InitAdc2();

    // 配置ADC2
    Adc2Regs.ADCCTL2.bit.ADCNONOVERLAP = 1;     // 启用非重叠模式
    Adc2Regs.ADCCTL1.bit.INTPULSEPOS   = 1;     // 中断在结果锁存后触发
    Adc2Regs.INTSEL1N2.bit.INT1E       = 1;     // 启用ADCINT1
    Adc2Regs.INTSEL1N2.bit.INT1CONT    = 0;     // 禁用连续模式
    Adc2Regs.INTSEL1N2.bit.INT1SEL     = 0;     // EOC0触发ADCINT1

    // 配置SOC0
    Adc2Regs.ADCSOC0CTL.bit.CHSEL      = 0;     // ADC2A0通道
    Adc2Regs.ADCSOC0CTL.bit.TRIGSEL    = 0;     // 软件触发
    Adc2Regs.ADCSOC0CTL.bit.ACQPS      = 6;     // 采样窗口7个ADC时钟周期

    EDIS;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

下里巴人hywing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值