Matthias, I'm using that part pretty much like like you want to. I'm using the DCO from a watch crystal with a 8 divider so I get an interrupt 4096 times a second. At the end of the timer/DCO interrupt I start the ADC to take one round of readings, and when that is completed the ADC interrupts and I flag the event using a variable I call ticks.
Once setup, there is virtually no code to keep it running and I'm getting 4096 readings per second per channel. I found that initializing the hardware is VERY dependent on the order of writes to device registers - and not just the ADC. The code is in assembly language but here it is: ta2_isr: push.w r15 .....code to calibrate DCO exit_dco_ta2_isr: pop.w r15 bis.w #START_READING,&ADC10CTL0 ;do one sequence of ADC reti .global init_adc ;called exactly once init_adc: bis.b #ADC_CHANNELS,&ADC10AE ;enable analog inputs bis.w #ADC_CTL0,&ADC10CTL0 bis.w #ADC_CTL1,&ADC10CTL1 bis.b #ADC_DTC0,&ADC10DTC0 ; ; CAVEAT below !!!!!! ; you have to write the number of transfers before giving the ; buffer address or it won't start transfers ; mov.b #ADC_XFERS,&ADC10DTC1 ;number of transfers per block mov.w #adc_readings,&ADC10SA ;start of buffer ret .global adc_isr ;one sequence is complete adc_isr: inc.b ticks ;ADC buffer ready to use reti Hope this helps. Sincerely, David Smead www.amplepower.com www.amplepower.net On Sat, 12 Aug 2006, matthias fend wrote:
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; } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users