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.
There are a couple of things I wasn't able to figure from the datasheet and on the web.Right now, I would like to sample data from 4 channels (let's say, A3 - A0) when a timerA.1 event occours and send them through the UART. And I would like the entire system to use interrupts instead polling.
char send=0;
char pos=0;
void main(){
//clock config
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 = CALBC1_1MHZ; // Set DCO, clock @1MHz
DCOCTL = CALDCO_1MHZ;//ADC
ADC10CTL1 = INCH_0 + SHS_1 +CONSEQ_2 + ADC10SSEL_0;// timer_A.out1, continuous mode, inpout channel 0 , ACLK (tot 1KHZ)
ADC10CTL0 = ADC10SHT_0 + SREF_1 + REFON + REF2_5V + ADC10ON + ADC10IE;// 4xADC_10CLK Use reference,
TACCR0=30;
//timer A config
P2DIR|=BIT0;
P2SEL|=BIT0;
TACCTL0 &= ~CCIE; // Disable timer Interrupt
TA1CCTL0=OUTMOD_4;// toggle mode for TA.0
TA1CCR0 = 999;// @1MhzCLK it should be 500HZ
TA1CCTL1=OUTMOD_3; //set/reset mode
TA1CCR1=500; //1KHz
TA1CTL=TASSEL_2 + MC_1; //start timer, up mode.
__bis_SR_register(GIE); // interrupt enabled
ADC10AE0 |= 0x01; // P1.1 ADC10 option select
ADC10CTL0 |= ENC;
while(1){
if(send){
send=0;
pos=0;
ADC10CTL0 |=ENC;
}
}
}
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR(void)
{
//increase pos counter. if pos > treshold, stop adc and enter main loop.
pos++;
if(pos>5) {
ADC10CTL0 &=~ENC;
send=1;
}
}
Any hint would be VERY appreciated.
Best regards,
Luca.
no. The ADC10AEx bits simply disable the digital input and output gates on this pin. So you do not disturb your analog signal by input leakage or such. They don't have any other side-effect.luca toso said:if I DON'T set bit 0x02 on ADC10AE0, data on channel A1 is going to be sampled or the channel, being "unabled" is skipped?
partly. You can still sample individual channels. Only sequence mode will produce glitches on the output (which might be covered by line capacitance in UART or SPI mode, wher ethere is no permanently active pullup) and generate a temporary 'deafness' on the input - resulting in a slightly delayed edge detection.luca toso said:ADC operations and UART in g2553 are mutually exclusive?
On other MSPs, this is different. On some, the ADC doesn't deactivate the drivers automatically during sampling stage.
From users guide:luca toso said:So, I set timerA registers in order to trigger acquisition on TA1CCR1 EQ1
"SHSx 01 Timer_A.OUT1(1)"
"1) Timer triggers are from Timer0_Ax if more than one timer module exists on the device."
The trigger is from TA0, but you programmed TA1.
Apparently you mixed up some things: TACCRx is CCRx of TA0 (it is equal to TA0CCRx). TA1CCRx is from TA1. Yes, the timer naming is more than a bit confusing. It has historical reasons from when there was only one timer at all.
First of all, thank you very much for your reply.
"1) Timer triggers are from Timer0_Ax if more than one timer module exists on the device."
Thanks a lot,
Luca.
Apparently this has been added in revision i from January 2012. Rev. h didn't have them.luca toso said:In which version of the user guide you found the quote?
Some time ago I worked in a simple project on a 430f26xxx. Right now, since I am having fun usng Launchpad, concernin the g-series I am working only on 2553.
right now I am building a lokc-in system (well, a sort of..), and I need to have a pwm output (and to sample the pwm output acquired by a photoamplifier in multiple channels). BUT timerA0 shares pin with ADC (as every peripheral on port1), and furthermore ONLY pin 1.0/1.5 can be timerA0 outputs.
and last but not least, want to send data to pc using the uart - additional pins shared on P1.
So, I was wondering if was possibile to use OTHER timers.
Yep, I know there are many workarounds to use timer1 instead timer0, I didn't think that the 2553 is the only g-series with 2 timers.
Actually, the 2x03/2x33 are too stuffed with two timers. (well these chips are actually variants of the 2553, just without the comparator). Only the 2xx3 chips have two timers. All that came before, didn't.luca toso said:I didn't think that the 2553 is the only g-series with 2 timers.
On the PW20 package, yes. On the PW28 package, the 2553 has TA0 outputs on P3.0, P3.4, P3.5 and P3.6 too.luca toso said:furthermore ONLY pin 1.0/1.5 can be timerA0 outputs
Well the lack of a way to define which timer is used could have told you that there is no choice :) (unconditionally triggering on both timers woudln't be a good idea I think)luca toso said:So, I was wondering if was possibile to use OTHER timers.
**Attention** This is a public forum