//******************************************************************************
// MSP430F54x Demo - ADC12, Using the Internal Reference
//
// Description: This example shows how to use the internal reference of ADC12.
// It uses the internal 2.5V reference and performs a single conversion
// on channel A0. The conversion results are stored in ADC12MEM0. Test by
// applying a voltage to channel A0, then setting and running to a break point
// at the "__no_operation()" instruction. To view the conversion results,
// open an ADC12 register window in debugger and view the contents of ADC12MEM0
//
// MSP430F5438
// -----------------
// /|\| |
// | | |
// --|RST |
// | |
// Vin -->|P6.0/A0 |
// | |
//
// M Smertneck / W. Goh
// Texas Instruments Inc.
// September 2008
// Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B
//******************************************************************************
#include "msp430x54x.h"
void main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V;
// Turn on ADC12, Sampling time
// On Reference Generator and set to
// 2.5V
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL0 = ADC12SREF_1; // Vr+=Vref+ and Vr-=AVss
for ( i=0; i<0x30; i++); // Delay for reference start-up
ADC12CTL0 |= ADC12ENC; // Enable conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
while (!(ADC12IFG & BIT0));
__no_operation(); // SET BREAKPOINT HERE
}
}
我改了三句,如下,不行。
P6SEL |= 0x40;
ADC12MCTL6 =0x16;
while (!(ADC12IFG & BIT6));
这段程序是TI官网的MSP430的ADC12程序,配置在A0口,现在我想配置在A6.请高手帮忙,谢谢
答案:2 mip版
解决时间 2021-01-27 18:33
- 提问者网友:〖舉燈向ηáη〗
- 2021-01-27 05:50
最佳答案
- 二级知识专家网友:清酒孤欢
- 2021-01-27 06:35
试试:
ADC12MCTL0 = INCH_6+ADC12SREF_1+EOS;
ADC12MCTL0 = INCH_6+ADC12SREF_1+EOS;
全部回答
- 1楼网友:选择重头再来
- 2021-01-27 07:48
可以私聊我~
我要举报
如以上问答内容为低俗/色情/暴力/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!
点此我要举报以上问答信息
推荐资讯