Hi,
I have been troubled for how to implement the ADC funtion for few days and I hope for some suggestions. The function I need is like the picture above.
EPWM1 and EPWM2 are two pwm, the period is 100us, and the duty cycle is 20%. I need to start sampling at the point at CMPA event, and then I need to sample as much as possible between the CMPA and CMPB event, for both EPWM1 and EPWM2. And EPWM2's CMPA event is later than EPWM1's CMPB event. Finally I need to separate the ADC results according to whether they are sampled in EPWM1's interval or in EPWM2's interval.
Here are my questions:
(1) Which trigger source should I use to trigger the ADC? If I choose 16 bit resolution, then the total time for S+H and conversion will be about 1us according to the manual, and I want to sample as much as possible. However, if I use software trigger in CMPA's interrupt to force the first sample, and then use the continous sample method( ADCINT1 and ADCINT2 as trigger source), the problem is I can't control when to stop the ADC, but I need to stop after EPWM1's CMPB event (that's because samples after that time are invalid) , and restart ADC at EPWM2's CMPA's event.
(2) If I can stop ADC at EPWM1's CMPB event, and restart ADC at EPWM2's CMPA event, then the separation seems to be relatively easy. If not, any suggestions on how to separate the results according to the time they are sampled?
Thank you for your time and hope for reply.
Jack