I believe I may be able to do this with an interrupt, but I would like to see what others think and the execution of it.
Is it possible to control where the ADC samples within a period? MATLAB Simulink C2000 F28379D
9 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a waveform running at 25 kHz. I am currently running this waveform to the ADC on board which is the LAUNCHXL-F28379D. The programming of this is done with MATLAB Simulink using the C2000 addons.
The sampling period of the ADC in this case is set to 4e-6s, or exactly 25 kHz. The idea is to get a single sample within the period. But, I would like to change the location of this single sample and pass the result to the onboard DAC. For instance, given the sample period is 4e-6s, is it possible to get a single sample at 1e-6, 2e-6, 3e-6, and so on to my choosing? I attempted to change the SoC with ePWM3A as the trigger source and timer for the ADC and visually, the waveform going into the ADC seems to be relatively identical to the waveform the DAC outputs, besides the obvious quantization effects.
Is it possible to take a sample at a specific count and hold that value? What settings can I change to achieve that?
What is my best approach to this problem? Any individuals with experience and knowledge with C2000 Matlab Simulink would be greatly preferred and appreciated! Thanks!~
3 个评论
Fangjun Jiang
2023-3-24
The interrupt should certainly work, although function-call generator is the same. All you need is a periodic trigger with a time offset.
Make sure your simulation step size is small enough to hit the time offset. For example, if your sample time is 4s, then your simulation step size could be as large as 4s. But if you want a time offset of 1s or 3s, then the step size needs to be 1s or smaller. If the time offset is 2s, then the step size could be 2s or smaller.
回答(1 个)
Fangjun Jiang
2023-3-23
Not too many people noticed this.
In the case of a discrete sample time, the vector is [Ts, To] where Ts is the sampling period and To is the initial time offset.
6 个评论
Fangjun Jiang
2023-3-24
编辑:Fangjun Jiang
2023-3-24
Not sure if we are still talking about the same topic. Open this example model, hook a Scope block to the output of the Rate Transition block.
ex_specify_sample_time
Specify the sample time of the Rate Transition block as [0.4] and later [0.4 0.1], observe the timing of the first sample, it is 0.4 and later 0.5.
I think the latter is what you want, right? Everything else in your model is executed at time 0, 0.4, 0.8, 1.2, ... but you want the ADC to happen at 0.1, 0.5, 0.9, 1.3,...
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!