Is it possible to control where the ADC samples within a period? MATLAB Simulink C2000 F28379D

5 views (last 30 days)
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!~
Joeny Zhen
Joeny Zhen on 24 Mar 2023
Edited: Joeny Zhen on 24 Mar 2023
I tried this attempt out. The problem with this solution is that the frequency going into the ADC, and the frequency at which this periodic trigger happens is NOT the same. This causes the location of the sample to essentially shift in time due to the time jitter between the two parts. This is exactly why I am looking for a interrupt done specifically by the c2000 hardware on the F28379D launchpad board. I made my attempts, but it did not work out which is why i'm attempting to ask an expert to how to do so. Do you have a possible solution that involves making an interrupt using the C2000 blocks instead of standard simulink blocks that occurs at what i've described at my first post? For instance, if the sampling period is 4e-6, can I send an interrupt out at 1e-6 to obtain what the value is at that sample? If so, how can I go along doing so with c2000 simulink blocks?

Sign in to comment.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 23 Mar 2023
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.
Joeny Zhen
Joeny Zhen on 24 Mar 2023
Sorry but no, we are NOT talking about the same topic. All your solutions involve an idealized simulink environment. It seems that you are not considering how the C2000 hardware works in real time. By hooking a scope block and attempting to monitor a signal in it on c2000 hardware, I lose information simply based on how the hardware is designed due to many factors such as baudrate, and so on.
I am specifically looking for a potential solution that involves using the C2000 Simulink blocks. Hopefully an expert that involves the C2000 Simulink hardware addons can answer this problem. Thanks.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!