共2条
1/1 1 跳转至页
MSP430F1232,AD10 关于MSP430F1232 AD10 内部二极管测温程序
问
//******************************************************************************
// MSP-FET430P120 Demo - ADC10 Sample A10Temp and Convert to oC and oF
//
// Description; A single sample is made on A10 with refernce to internal
// 1.5V Vref. Software sets ADC10SC to start sample and conversion - ADC10SC
// automatically cleared at EOC. ADC10 internal oscillator/4 times sample
// (64x) and conversion. In Mainloop MSP430 waits in LPM0 to save power until
// ADC10 conversion complete, ADC10_ISR will force exit from any LPMx in
// Mainloop on reti. Temperaure in oC stored in IntDegC, oF in IntDegF.
//
// Uncalibrated temperature measured from device to devive will vary with
// slope and offset from device to device - please see datasheet.
// //*MSP430F1232 or MSP430F1132 Device Required*//
//
// MSP430F1232
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// |A10 |
//
// M.Buccini
// Texas Instruments, Inc
// January 2002
// Built with IAR Embedded Workbench Version: 1.25A
//******************************************************************************
#include <MSP430x12x2.h>
unsigned int long temp;
unsigned int long IntDegF;
unsigned int long IntDegC;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
ADC10CTL1 = INCH_10+ADC10DIV_3; // Temp Sensor ADC10CLK/4
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE;
while(1)
{
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
_BIS_SR(CPUOFF + GIE); // LPM0 with interrupts enabled
// oF = ((A10/1024)*1500mV)-923mV)*1/1.97mV = x*761/1024 - 468
temp = ADC10MEM;
IntDegF = ((temp - 630) * 761) / 1024;
// oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = x*423/1024 - 278
temp = ADC10MEM;
IntDegC = ((temp - 673) * 423) / 1024;
_NOP(); // SET BREAKPOINT HERE
}
}
// ADC10 interrupt service routine
interrupt[ADC10_VECTOR] void ADC10_ISR (void)
{
_BIC_SR_IRQ(CPUOFF); // Clear CPUOFF bit from 0(SR)
} 答 1: 好东西,顶!!!!!
// MSP-FET430P120 Demo - ADC10 Sample A10Temp and Convert to oC and oF
//
// Description; A single sample is made on A10 with refernce to internal
// 1.5V Vref. Software sets ADC10SC to start sample and conversion - ADC10SC
// automatically cleared at EOC. ADC10 internal oscillator/4 times sample
// (64x) and conversion. In Mainloop MSP430 waits in LPM0 to save power until
// ADC10 conversion complete, ADC10_ISR will force exit from any LPMx in
// Mainloop on reti. Temperaure in oC stored in IntDegC, oF in IntDegF.
//
// Uncalibrated temperature measured from device to devive will vary with
// slope and offset from device to device - please see datasheet.
// //*MSP430F1232 or MSP430F1132 Device Required*//
//
// MSP430F1232
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// |A10 |
//
// M.Buccini
// Texas Instruments, Inc
// January 2002
// Built with IAR Embedded Workbench Version: 1.25A
//******************************************************************************
#include <MSP430x12x2.h>
unsigned int long temp;
unsigned int long IntDegF;
unsigned int long IntDegC;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
ADC10CTL1 = INCH_10+ADC10DIV_3; // Temp Sensor ADC10CLK/4
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE;
while(1)
{
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
_BIS_SR(CPUOFF + GIE); // LPM0 with interrupts enabled
// oF = ((A10/1024)*1500mV)-923mV)*1/1.97mV = x*761/1024 - 468
temp = ADC10MEM;
IntDegF = ((temp - 630) * 761) / 1024;
// oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = x*423/1024 - 278
temp = ADC10MEM;
IntDegC = ((temp - 673) * 423) / 1024;
_NOP(); // SET BREAKPOINT HERE
}
}
// ADC10 interrupt service routine
interrupt[ADC10_VECTOR] void ADC10_ISR (void)
{
_BIC_SR_IRQ(CPUOFF); // Clear CPUOFF bit from 0(SR)
} 答 1: 好东西,顶!!!!!
共2条
1/1 1 跳转至页
回复
| 有奖活动 | |
|---|---|
| 2026年“我要开发板活动”第三季,开始了! | |
| 硬核工程师专属补给计划——填盲盒 | |
| “我踩过的那些坑”主题活动——第002期 | |
| 【EEPW电子工程师创研计划】技术变现通道已开启~ | |
| 发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
| 【EEPW在线】E起听工程师的声音! | |
| 高校联络员开始招募啦!有惊喜!! | |
| 【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
我要赚赏金打赏帖 |
|
|---|---|
| 【FreeRtos】第一个任务的启动过程被打赏¥21元 | |
| 【分享开发笔记,赚取电动螺丝刀】FPB-RA6E2开发板的WDT功能测试被打赏¥22元 | |
| 关于cmakelist特性presets的使用被打赏¥20元 | |
| 【分享开发笔记,赚取电动螺丝刀】M5STACK系列屏幕质量测试程序,竟然有块亮斑?被打赏¥20元 | |
| 【分享开发笔记,赚取电动螺丝刀】快速搭建瑞萨FPB-RA6E2开发板开发环境被打赏¥14元 | |
| 【分享开发笔记,赚取电动螺丝刀】在音频测试中顺序的调整可改变功效被打赏¥18元 | |
| 【分享开发笔记,赚取电动螺丝刀】点阵显示模块及其应用-----献给新年的小礼物被打赏¥22元 | |
| 基于地奇星开发板的数码管模块显示技术被打赏¥23元 | |
| 【分享开发笔记,赚取电动螺丝刀】摇杆模块控制实现LED贪吃蛇游戏被打赏¥33元 | |
| window下生成compilecommands.json的的方法被打赏¥22元 | |
我要赚赏金
