Hi,
There is no automatic timing on given period implemented.
There is an ATDCTL3 register which contains bits providing number of conversions in one sequence. However, it does not considers period between conversions. You are able to set up to 12 conversions in a one sequence.
What you have to do is set an interrupt after each conversion and store data to some data buffer/array.
The question is whether it is not more simpler to perform 10 single conversions and process them individually. The conversion time is 3us.
The best solution I see is to run ATD in continuous mode when it converts channel in an automatic never-ending loop and set a timer for interrupt in which data are read and stored.
Simple example (immediate idea, not tested).
Unsigned char cnt, data, sequence_in_progress=false;
Void interrupt Timer_interrupt(void)
{
Data[cnt] = ATDDRxL;
cnt--;
if(!cnt) Stop_sequence(); // stop interupt from timer
}
Start_sequence(void)
{
cnt=10;
sequence_in_progress = true;
enable_interrupt_from_timer()
}
Void main(void)
{
For(;;)
{
Start_new_sequence();
While(sequence_in_progress=true) ;
Process_data()
}
}
Another solution could be to start manually each conversion with given period. The question is data processing time.
The S12G is very simple and low cost MCU assigned for specific simple tasks. It does not contain special features. For such a task would be better to use some more complexs MCU (more expensive). For example S12XE, S12XD provide parallel XGATE interrupt oriented core, big set of timers, higher BUSCLK.
Finally, data storage, manipulation and processing will be main limitation factor in your application. I am no table to say how much time you will need for that (Max BUSCLK = 25MHz...40ns....approximately 150cycles for data manipulation and control)
Best regards,
Ladislav