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.

Using Timer Out as ADC10 Input to Sample Hold. How??? [MSP430g2553]

Other Parts Discussed in Thread: MSP430G2553

When configuring the ADC10 is this:

bis.w #ADC10SHT_2+ADC10ON+ADC10IE,&ADC10CTL0

bit.w #INCH_2, &ADC10CTL1                                                    

And use it to make a conversion:

bis.w   #ENC+ADC10SC,&ADC10CTL0

My adc10 works as expected.

OK.

When configuring the ADC10 is this:

bis.w    #SHS_1+ADC10SHT_2+ADC10ON+ADC10IE,&ADC10CTL0

bit.w   #INCH_2, &ADC10CTL1

And the output of Timer0_A1 is this:

And use it to make a conversion:

 bis.w   #ENC,&ADC10CTL0

My adc10 not work. Not even enters ADC10_ISR.

........................

Am I doing something wrong?

Device: MSP430g2553

  • SHS selects the Sample&Hold Signal source. It is not an input to the ADC but triggers the ADC conversion.
    You don't need an ISR for this. You need to configure the proper CCR unit to generate an output signal and the signal directly starts the conversion periodically (if the ADC is configured for multiple conversions - if not, then only once)

    For using SHS_1, you need to configure TA0CCR1 to an output mode that toggles or sets/resets its output signal (it is not necessary to enable the physical output to a port pin).
    You can control the sampling interval by adjustign the timer clock, or by running the timer in up mode and limiting the cycle length through TA0CCR0.
    Note that it is not the interrupt that triggers the conversion, but the state change of the OUT signal of the TA0CCR0 unit (and the default output mode doesn't change it)

  • I modified, I did it:

    bis.w #SHS_1+ADC10SHT_2+ADC10ON+ADC10IE,&ADC10CTL0       ; Selecting TimerA0_A1 instead of ADC10OSC

    bit.w   #CONSEQ_2+INCH_2, &ADC10CTL1                                                ; Selecting Repeat Single Channel Mode, in A1       

    bis.w    #ENC ,&ADC10CTL0                                                                            ; Enabling ENC

    The Timer is Working (i have tested):

    But is not entering the ADC10_ISR =(

    Do not know why is not working!!!!

  • Where does this nice green square wave come from?

    Signal TA1 means TimerA0 CCR1 OUTput signal (also see device datasheet). Not the timer overflow or the timer capture interrupt or Timer external clock input. By default, the OUT signals of all CCR units are in OUTMODE_0 which means: no output change at capture interrupt.
    Teh signal needs to be generated by a timer CCR unit and cannot be sourced from outside. It is not possible to trigger the ADC directly by an external signal. It is possible to do it by abusing the timer. However, IMHO the closest thing you can get is an ADC trigger on every second timer clock input pulse. And it still requires programming of the CCR0 unit, so it toggles output on every tiemr tick. The tiemr is useless for anything else then.

  • AHAHAHAAH the error that was happening was quite simple.

    I was often using bit instead of bis. =D

**Attention** This is a public forum