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.
Hello Everyone!
I´m trying to sample 5 sensors thought MSP430 EZ430-RF2500 (MSP430F2274) and send the info via serial port to the PC (Windows 7). This time, instead of "manually" changing INCH, I took a shot at DTC. But it really doesn´t seem to work... Could someone Help me?
The major problem seems to be the stop at that main loop, where it is supposed to be sampling. In the code above, it will go until P1OUT = 0x03, but won´t go back to the beginning of the FOR LOOP.
Another two questions are:
1)The way the program is written, are my results already in the “saida1” vector at the end of a loop (Right after the P1OUT = 0x03;) ?
2)I saw some programs that use a pointer in ADC10SA and retrieve the vector info in the ADC10 ISR, but I assumed that, at this point, the ADC´s still working. Is this correct?
Here is my code and its description.
Thanks a lot for your attention, and Please Help! =)
void start(void){
/*ADC10 variables*/
ADC10CTL1 = INCH_4 + CONSEQ_3; // A4, A3, A2, A1, A0
ADC10AE0 = BIT0+BIT1+BIT2+BIT3+BIT4; //OUTPUT selection
ADC10CTL0 = ADC10ON + REFON + REF2_5V + MSC + ADC10SHT_3;
ADC10DTC1 = 0x05;
TACCR0 = 30; // Delay to allow Ref to settle
TACCTL0 |= CCIE; // Compare-mode interrupt
TACTL = TASSEL_2 + MC_1; // TACLK = SMCLK, Up mode
__bis_SR_register(CPUOFF + GIE);
TACCTL0 &= ~CCIE; // Disable timer Interrupt
/*END ADC10 variables*/
}
void main(void){
int saida1[5];
float saida2[5];
int i=0;
WDTCTL = WDTPW|WDTHOLD;
start(); //start the variables
ADC10SA = (int) saida1;
ADC10DTC1 = 0x05;
P1DIR = 0x03;
for(;;)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY);
ADC10SA = (int) saida1;
ADC10CTL0 |= ENC + ADC10SC; //Begin sampling and convervison
__bis_SR_register(CPUOFF + GIE); // LPM0 com interrupt disponível.
P1OUT = 0x03;
}
}
//ISR routines
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR(void)
{
__bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR)
}
//////////////////////////////
//////////////////////////////
#pragma vector=TIMERA0_VECTOR
__interrupt void TA0_ISR(void)
{
TACTL = 0;
// Clear Timer_A control registers
__bic_SR_register_on_exit(CPUOFF);
// Clear CPUOFF bit from 0(SR)
}
As near as I can tell, there are no interrupts enabled when you go into LPM, so it will wait forever.
Try setting ADC10IE.
**Attention** This is a public forum