Part Number:MSP430I2021
测试MSP430I2021芯片,A0.0+接信号、A0.0-接GND,我给A0.0+ 加压了, SD24MEM0 一直只有272的值, 且无变化。
代码如下:
#include "msp430.h"
int __low_level_init(void);
unsigned int results; // SD24 Conversion Results
unsigned int checksum = 0;
unsigned char *TLV_address_for_parse = ((unsigned char *)TLV_START);
unsigned int *TLV_address_for_checksum = ((unsigned int *)TLV_START + 1);
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
__low_level_init();
SD24CTL = SD24REFS; // Internal ref
SD24CCTL0 |= SD24SNGL | SD24DF | SD24IE; // Enable interrupt
__delay_cycles(3200); // Delay ~200us for 1.2V ref to settle
while(1) {
__no_operation(); // SET BREAKPOINT HERE
SD24CCTL0 |= SD24SC; // Set bit to start conversion
__bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts
__no_operation(); // For debugger
}
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=SD24_VECTOR
__interrupt void SD24_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(SD24_VECTOR))) SD24_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch (__even_in_range(SD24IV,SD24IV_SD24MEM1)) {
case SD24IV_NONE: break;
case SD24IV_SD24OVIFG: break;
case SD24IV_SD24MEM0:
results = SD24MEM0; // Save CH0 results (clears IFG)
break;
case SD24IV_SD24MEM1:
results = SD24MEM1; // Save CH0 results (clears IFG)
break;
default: break;
}
__bic_SR_register_on_exit(LPM0_bits); // Wake up from LPM0
}
Susan Yang:
请问您是否有采用TI例程直接测试?是否能复现这样的情况?
,
huichen liu:
上面的代码就是TI例程,能复现,每次都是这样