This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
举一个简单的例程参考吧
//*****************************************************************************
// MSP430AFE25x Demo - SD24, Continuous Conversion on a Group of 3 Channels
//
// Description: This program uses the SD24 module to perform continuous
// conversions on a group of channels (0, 1 and 2). A SD24 interrupt occurs
// whenever the conversions have completed. Test by applying voltages to the
// 3 input channels and setting a breakpoint at the line indicated
// below. Run program until it reaches the breakpoint, then use
// the debugger's watch window to view the conversion results. Results
// (upper 16 bits only) are stored in three arrays, one for each channel.
// ACLK = n/a, MCLK = SMCLK = DCO = ~ 1.1MHz
// //* For minimum Vcc required for SD24 module - see datasheet *//
// //* 100nF cap btw Vref and AVss is recommended when using 1.2V ref *//
//
// MSP430AFE25x
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// Vin1+ -->|A0.0+ |
// Vin1- -->|A0.0- |
// Vin2+ -->|A1.0+ |
// Vin2- -->|A1.0- |
// Vin3+ -->|A2.0+ |
// Vin3- -->|A2.0- |
// | VREF |---+
// | | |
// | | -+- 100nF
// | | -+-
// | | |
// | AVss |---+
// | |
//
// Naveen Kala
// Texas Instruments, Inc
// March 2011
// Built with IAR Embedded Workbench Version: 5.20.1
//*****************************************************************************
#include <msp430afe253.h>
#define Num_of_Results 8
/* Arrays to store SD24 conversion results */
unsigned int Ch0results[Num_of_Results];
unsigned int Ch1results[Num_of_Results];
unsigned int Ch2results[Num_of_Results];
void main(void)
{
volatile unsigned int i; // Use volatile to prevent removal
// by compiler optimization
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= BIT0+BIT1; // Set P1.0, P1.1 to output
SD24CTL = SD24REFON + SD24SSEL0; // 1.2V ref, SMCLK
SD24CCTL0 |= SD24GRP+SD24DF; // Group with CH1
SD24CCTL1 |= SD24GRP+SD24DF; // Group with CH2
SD24CCTL2 |= SD24IE+SD24DF; // Enable interrupt
for (i = 0; i < 0x3600; i++); // Delay for 1.2V ref startup
SD24CCTL2 |= SD24SC; // Set bit to start conversion
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts
}
#pragma vector=SD24_VECTOR
__interrupt void SD24AISR(void)
{
static unsigned int index = 0;
switch (SD24IV)
{
case 2: // SD24MEM Overflow
break;
case 4: // SD24MEM0 IFG
break;
case 6: // SD24MEM1 IFG
break;
case 8: // SD24MEM2 IFG
Ch0results[index] = SD24MEM0; // Save CH0 results (clears IFG)
Ch1results[index] = SD24MEM1; // Save CH1 results (clears IFG)
Ch2results[index] = SD24MEM2; // Save CH2 results (clears IFG)
P1OUT ^=BIT0;
if (++index == Num_of_Results)
{
index = 0; // SET BREAKPOINT HERE
P1OUT ^=BIT1;
}
break;
}
}
楼主可以使用Peter_Zheng给的例程先跑一下,然后根据自己的需求进行AD24的配置修改,设计自己的应用,需要用的文档资料有msp430afe2X3 datasheet,msp430X2XX user's guide(重点看SD24_A部分)
guiliang cui,
例程可在此链接:http://www.ti.com/product/msp430afe253 的software 下载“MSP430AFE2x3, MSP430AFE2x2, MSP430AFE2x1 Code Examples”。
另外,上面链接在其 software & tool 部分有socket board:MSP430AFE2xx 16 Bit Microcontroller 24-Pin Socket Target Board;
Application note部分有很多应用手册可供参考!
希望对你有帮助!
BR,
Lina
guiliang cui,
其实socket board就是只有最基本的电路(JTAG, LED),并将所有管脚引出来而已,你可以看看socket board的电路图。在此链接对应文档的P43:http://www.ti.com.cn/cn/lit/ug/slau278p/slau278p.pdf
而各个模块的例程code example中都有了。
BR,
Lina