hello,

I tried to setup a MSP430F1232 to take continuous samples from a single
ADC10 channel. As trigger source I planned to use TA0.
So far so good - everything behaves as expected (continuous interrupt occurrences).

The next step was to use the two block mode of the DTC to take some
samples triggered by TA0 and transfer them to a memory location
automatically. After the number of desired DTC transfers is done,
the ISR should evaluate the ADC samples from memory while the
ADC and the DTC are still running (using the other DTC block).

For the application it's important that the ADC samples are exactly
continuous.

But if I enable the DTC mechanism nothing happens (no interrupt occurrences). Even if I just use a simple DTC transfer.

Attached you'll find a code snipped of a test program where I tried to
figure out these issues.

All the examples I found are using just the software trigger and requiring a toggle of the ENC bit.

Has anybody uses the DTC in a similar way, or has anybody some ideas what I am doing wrong ?

thanks,
 matthias



#define ADC_BLOCK_SAMPLES 2
static unsigned int adc_block_mem[2*ADC_BLOCK_SAMPLES];

volatile unsigned char isig = 0;

int main(void)
{
   ... clock setup

  /*
   * timer A setup
   */
  CCR0  = 60000-1;                      // CCR0 period
  CCTL0 = OUTMOD_4;                     // CCR0 toggle
  TACTL = TASSEL_1 | MC0;               // ACLK, up

  /*
   * ADC10 setup
   */
  ADC10CTL0 &= (~ENC | ADC10ON);
  while(ADC10CTL1 & BUSY)
   ;
ADC10CTL0 = SREF_2 | ADC10SHT_0 | MSC | ADC10ON | ADC10IE; // 64 x ADCCLK, multiple conversions, ADC core on, enable int ADC10CTL1 = INCH_0 | SHS_2 | CONSEQ_2; // A0, TA0 trigger, repeat single channel ADC10AE = P2_GYRO_SIG_IN | P2_GYRO_REF_IN; // ADC option select

  ADC10SA = &adc_block_mem[0];
ADC10DTC0 = ADC10TB | ADC10CT; // two block, continous transfer
#define WORKING
#ifdef WORKING
 // leave ADC10DTC1 to deactivte DTC
#else
ADC10DTC1 = ADC_BLOCK_SAMPLES; // ADC_SAMPLES conversions
#endif

  _EINT();                  // enable interrupts

  ADC10CTL0 |= ENC;

  while(1)
  {
    while(!isig)
     ;
    // do something
    isig = 0;
  }
}

// ADC10 interrupt service routine
interrupt (ADC10_VECTOR) ADC10_ISR(void)
{
  isig = 1;
}

Reply via email to