Hello Guys I would like to use the ADC12 to sample a sensor signal at 200 samples per second, the MCU runs from DCO configured at 2Mhz. Whis is the ideal way to achieve this? Configure TimerA to fire the ADC? if this is the case, then just configure the Timer for a 5ms intreval and perform ADC conversion? Do I make use of both Timer's and the ADC's interrupt mechanism? I did look at the TI supplied example it leaves me more confused. Any help is appriciated. Thanks Jay
Timer triggered sampling
Started by ●September 11, 2005
Reply by ●September 11, 20052005-09-11
Hi Jay. You need to configure the ADC in repeat sequential mode (MSC
bit). If you use Timer_A1 you will normally need to access both ISR's,
the ADC12 to move the capatured data (unless you are using DMA) and the
Timers to reload the CCRA1 register for the next sample. However on
larger parts you could use timer B set to UP mode and sample on CCR0
compares, which auto reload as the TBR rolls over..
Cheers
Al
hc08jb8 wrote:
>Hello Guys
>
>I would like to use the ADC12 to sample a sensor signal at 200 samples
>per second, the MCU runs from DCO configured at 2Mhz. Whis is the
>ideal way to achieve this? Configure TimerA to fire the ADC? if this is
>the case, then just configure the Timer for a 5ms intreval and perform
>ADC conversion? Do I make use of both Timer's and the ADC's
interrupt
>mechanism? I did look at the TI supplied example it leaves me more
>confused. Any help is appriciated.
>
>Thanks
>Jay
>
>
>
>
>
>.
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
Reply by ●September 11, 20052005-09-11
sorry , I meant to sat repeat single or sequential mode.
Al
hc08jb8 wrote:
>Hello Guys
>
>I would like to use the ADC12 to sample a sensor signal at 200 samples
>per second, the MCU runs from DCO configured at 2Mhz. Whis is the
>ideal way to achieve this? Configure TimerA to fire the ADC? if this is
>the case, then just configure the Timer for a 5ms intreval and perform
>ADC conversion? Do I make use of both Timer's and the ADC's
interrupt
>mechanism? I did look at the TI supplied example it leaves me more
>confused. Any help is appriciated.
>
>Thanks
>Jay
>
>
>
>
>
>.
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
Reply by ●September 12, 20052005-09-12
Hi Al >If you use Timer_A1 you will normally need to > access both ISR's, > the ADC12 to move the capatured data Here's where I am confused, my objective is to get sequential read of 3 channels at 200Hz. Right now I have got it working alright for repeated sequence of conversion. But I would like to use the Timer or other means so that I collect approximately around 200 sample per second. If its to be done with timer then where do I start the ADC conversion sequence? As soon as the timer counter is loaded? Handling the ADC12's ISR to move sampled data, but whats there to handle for the Timer's ISR? I am clear about how these 2 blocks (Timer,ADC) operate independantly, but when combined togather, I am unclear of the sequence of events. Thanks. Jay --- Onestone <onestone@ones...> wrote: > Hi Jay. You need to configure the ADC in repeat > sequential mode (MSC > bit). If you use Timer_A1 you will normally need to > access both ISR's, > the ADC12 to move the capatured data (unless you are > using DMA) and the > Timers to reload the CCRA1 register for the next > sample. However on > larger parts you could use timer B set to UP mode > and sample on CCR0 > compares, which auto reload as the TBR rolls over.. > > Cheers > > Al > > hc08jb8 wrote: > > >Hello Guys > > > >I would like to use the ADC12 to sample a sensor > signal at 200 samples > >per second, the MCU runs from DCO configured at > 2Mhz. Whis is the > >ideal way to achieve this? Configure TimerA to fire > the ADC? if this is > >the case, then just configure the Timer for a 5ms > intreval and perform > >ADC conversion? Do I make use of both Timer's and > the ADC's interrupt > >mechanism? I did look at the TI supplied example it > leaves me more > >confused. Any help is appriciated. > > > >Thanks > >Jay > > > > > > > > > > > >. > > > > > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > __________________________________________________
Reply by ●September 12, 20052005-09-12
In my opinion, the simplest way to get what you need is schematically depicted in the following pseudo-code sequence: 1. @ Power-On-Reset: MCU initialization 2. Set up ADC converter for the acquisition of a single sequence of the required channels, no ADC interrupt enabled 3. Set up the Timer for a repetitive interrupt every 5 msec 4. Start ADC conversion. 5. Enable Timer interrupt 6. Global interrupt enable 7. While (1) {Do cyclical actions} @ Timer interrupt [interrupt handler]: - reload timer end count - if ADC end-of -conversion flag is set (at 200 Hz 3-channels acquisition, it certainly will be set), get and store acquired values, and restart ADC single sequence conversion - Return-from-interrupt Hope it helps. Andrea ----- Original Message ----- From: "68HC 08" <hc08jb8@hc08...> To: <msp430@msp4...> Sent: Monday, September 12, 2005 9:16 AM Subject: Re: [msp430] Timer triggered sampling > Hi Al > >If you use Timer_A1 you will normally need to > > access both ISR's, > > the ADC12 to move the captured data > Here's where I am confused, my objective is to get > sequential read of 3 channels at 200Hz. Right now I > have got it working alright for repeated sequence of > conversion. But I would like to use the Timer or other > means so that I collect approximately around 200 > sample per second. > > If its to be done with timer then where do I start the > ADC conversion sequence? As soon as the timer counter > is loaded? Handling the ADC12's ISR to move sampled > data, but whats there to handle for the Timer's ISR? I > am clear about how these 2 blocks (Timer,ADC) operate > independantly, but when combined togather, I am > unclear of the sequence of events. > > Thanks. > Jay > > --- Onestone <onestone@ones...> wrote: > > > Hi Jay. You need to configure the ADC in repeat > > sequential mode (MSC > > bit). If you use Timer_A1 you will normally need to > > access both ISR's, > > the ADC12 to move the capatured data (unless you are > > using DMA) and the > > Timers to reload the CCRA1 register for the next > > sample. However on > > larger parts you could use timer B set to UP mode > > and sample on CCR0 > > compares, which auto reload as the TBR rolls over.. > > > > Cheers > > > > Al > > > > hc08jb8 wrote: > > > > >Hello Guys > > > > > >I would like to use the ADC12 to sample a sensor > > signal at 200 samples > > >per second, the MCU runs from DCO configured at > > 2Mhz. Whis is the > > >ideal way to achieve this? Configure TimerA to fire > > the ADC? if this is > > >the case, then just configure the Timer for a 5ms > > intreval and perform > > >ADC conversion? Do I make use of both Timer's and > > the ADC's interrupt > > >mechanism? I did look at the TI supplied example it > > leaves me more > > >confused. Any help is appriciated. > > > > > >Thanks > > >Jay > > > > > > > > > > > > > > > > > >. > > > > > > > > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > __________________________________________________ > > > > > . > > > Yahoo! Groups Links > > > > > > >
Reply by ●September 12, 20052005-09-12
68HC 08 wrote: >Hi Al > > > >>If you use Timer_A1 you will normally need to >>access both ISR's, >>the ADC12 to move the capatured data >> >> > >Here's where I am confused, my objective is to get >sequential read of 3 channels at 200Hz. Right now I >have got it working alright for repeated sequence of >conversion. But I would like to use the Timer or other >means so that I collect approximately around 200 >sample per second. > > Set the ADC12 for repeat sequence of channels. with 3 channels defined and the third with EOS set. Select the ADC12 sample source (SHSx) in ADC12CTL1 to the timer you want to use. That is it. When everything else is ready, and the timer has been initialised just set ENC and you're away. The Timer ISR will fire first, and automatically trigger the ADC12 sampling to start. You can use the timer ISR to reload the CCRx register if not using UP mode on timer B. Simply do CCRx+=5msecs, whatever the cycle count is for that. The ADC12 will sample then convert and interrupt. It will then stay pending waiting for the next timer trigger from the timer. You can take the ADC12 ISR read the data , do what you want with it, then clear the flag before exit. This allows the next conversion to take place on the next timer event. Cheers Al >If its to be done with timer then where do I start the >ADC conversion sequence? As soon as the timer counter >is loaded? Handling the ADC12's ISR to move sampled >data, but whats there to handle for the Timer's ISR? I >am clear about how these 2 blocks (Timer,ADC) operate >independantly, but when combined togather, I am >unclear of the sequence of events. > >Thanks. >Jay > >--- Onestone <onestone@ones...> wrote: > > > >>Hi Jay. You need to configure the ADC in repeat >>sequential mode (MSC >>bit). If you use Timer_A1 you will normally need to >>access both ISR's, >>the ADC12 to move the capatured data (unless you are >>using DMA) and the >>Timers to reload the CCRA1 register for the next >>sample. However on >>larger parts you could use timer B set to UP mode >>and sample on CCR0 >>compares, which auto reload as the TBR rolls over.. >> >>Cheers >> >>Al >> >>hc08jb8 wrote: >> >> >> >>>Hello Guys >>> >>>I would like to use the ADC12 to sample a sensor >>> >>> >>signal at 200 samples >> >> >>>per second, the MCU runs from DCO configured at >>> >>> >>2Mhz. Whis is the >> >> >>>ideal way to achieve this? Configure TimerA to fire >>> >>> >>the ADC? if this is >> >> >>>the case, then just configure the Timer for a 5ms >>> >>> >>intreval and perform >> >> >>>ADC conversion? Do I make use of both Timer's and >>> >>> >>the ADC's interrupt >> >> >>>mechanism? I did look at the TI supplied example it >>> >>> >>leaves me more >> >> >>>confused. Any help is appriciated. >>> >>>Thanks >>>Jay >>> >>> >>> >>> >>> >>>. >>> >>> >>>Yahoo! Groups Links >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >> > > >__________________________________________________ > > > > >. > > >Yahoo! Groups Links > > > > > > > > > > >