Other Parts Discussed in Thread: MSP430F2619
Hello!
How are you all doing? Hope everything's fine.
So, i'm trying to do the following:
Timer ---triggers--> ADC --samples--> DMA --moves to memmory--> end
Right now, i'm facing problems with the timmer and ADC interfacing.
The way i want it to works is that the timmer (not using its interruption) auto
triggers adc samples.
NOTE: I've already made timmer starts ADC sampling with timmer interruption and
an ADC start convertion manually set. But, that's not the way i want it to work!
As i said, timmer must counts and generate a trigger to ADC. ADC's interrupt is
handled by my DMA, moving results from ADC12MEM0 to a certain memory region.
Here goes some codes:
timmer.c
void timer_go_on(void)
{
TACCTL0 = CM_0 + CCIS_0 + OUTMOD_4;
// CM_0 -> Comparation mode
// CCIS_0 -> Comparation by CCIA input
// OUTMOD_0 -> Comparation mode: Toggles pin P2.3 when TAR reaches 159.
TACCR1 = 159;
// Sampling period
TACTL = TASSEL_2 + ID_0 + MC_1 + TACLR;
// TASSEL_2 -> SMCLK as source
// ID_0 -> Clock divided by 1
// MC_1 -> Up mode till TACCR0
// Timming: 1/(8M/1/(159+1)) = 50K Hz
}
1) Why when i add CCIE to TACCTL0 and enter in LPM0 my uC doesn't seens to work?
2) I could not understand completely CCIS... I've searched my msp430f2619
datasheet, but i could found nothing about it (same as user guide).
adc.c
void adc_go_on(void)
{
ADC12CTL0 &= ~ENC;
// Let's configure ADC
ADC12CTL0 |= ADC12ON + MSC;
// MSC -> Multiple start convertion.
// ADC12ON -> ADC on
ADC12CTL1 |= CSTARTADD_0 + SHS_1 + ADC12DIV_0 + ADC12SSEL_3 + CONSEQ_2;
// CSTARTADD_0 -> Adressing samples to ADC12MEM0
// SHS_1 -> Trigger source: Timer A0
// CONSEQ_2 -> Single channel, repetitive
// SHP -> Temporized mode
// ADC12SSEL_3 -> Clk source: SMCLK
// ADC12DIV_0 -> Clk divider = 1.
ADC12MCTL0 |= SREF_0 + INCH_0;
// INCH_0 -> Channel A0 as ADC sampling source
// SREF_0 -> Using Vss and Gnd refs.
ADC12IE = 0x1;
// Enable interrupt.
ADC12CTL0 |= ENC;
// ADC go working
}
#pragma vector=ADC12_VECTOR
__interrupt void adc_sampling(void)
{
// Do DMA transfer from ADC12MEM0.
}
3) Do you know guys what i'm getting wrong on this?
PS: a __bis_SR_register(GIE) is set during a part of my code (after those inits).
Cheers
Fávero