Tool/software: Code Composer Studio
Hi team,
I am using the following example code for SD24 converters from the resource explorer:
#include <msp430.h>
#include <stdio.h>
/* Array to store SD24_B conversion results */
unsigned int results[3];
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
SD24BCTL0 |= SD24SSEL_1; // Select internal REF
SD24BCTL0 |= SD24REFS; // Select SMCLK as SD24_B clock source
SD24BCCTL0 = SD24SNGL | SD24SCS_5; // Single conversion, group 1
SD24BCCTL1 = SD24SNGL | SD24SCS_5; // Single conversion, group 1
SD24BCCTL2 = SD24SNGL | SD24SCS_5; // Single conversion, group 1
SD24BIE |= SD24IE2; // Enable channel 2 interrupt
__delay_cycles(0x3600); // Delay for 1.5V REF startup
while (1)
{
SD24BCTL1 |= SD24GRP1SC; // Set bit to start conversion
__bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts
SD24BCTL1 &= ~SD24GRP1SC; // Clear bit for next conversion
__no_operation(); // SET BREAKPOINT HERE
printf("Result1: %d \n",results[0]);
printf("Result2: %d \n",results[1]);
printf("Result3: %d \n",results[2]);
}
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=SD24B_VECTOR
__interrupt void SD24BISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(SD24B_VECTOR))) SD24BISR (void)
#else
#error Compiler not supported!
#endif
{
switch (SD24BIV)
{
case SD24BIV_SD24OVIFG: // SD24MEM Overflow
break;
case SD24BIV_SD24TRGIFG: // SD24 Trigger IFG
break;
case SD24BIV_SD24IFG0: // SD24MEM0 IFG
break;
case SD24BIV_SD24IFG1: // SD24MEM1 IFG
break;
case SD24BIV_SD24IFG2: // SD24MEM2 IFG
results[0] = SD24BMEMH0; // Save CH0 results (clears IFG)
results[1] = SD24BMEMH1; // Save CH1 results (clears IFG)
results[2] = SD24BMEMH2; // Save CH2 results (clears IFG)
break;
}
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
}
I am getting output results for 8-bit resolution.
I have a few questions:
1) How do I change my reference voltage to external reference(=3V) ? If I use an external reference, do I have to make any extra connections of capacitor to the MCU?
2) How do I change the resolution from 8-bit to 10-bit?
3) Is there a way to change the internal reference from 1.15V(from datasheet) to 3V?
4) I have single ended inputs coming to the positive inputs of the SD24 ports. So I am connecting the negative inputs of all the 3 inputs to ground. Will this work?
Thank you,
Keval