How to monitor an analog signal real-time in Simulink?
Show older comments
I am using Simulink (Embedded Coder) to program my LAUNCHXL-F28379D TI C2000 microcontroller.
I have created a model to detect the frequency of a signal and I want to use this model to detect the frequency of the encoder signal (in order to estimate the angular velocity of the motor). The model seems to be successfully identifying frequencies of different signals in the simulation environment.
Now, I want to test this model with the actual encoder signal. I have digital output GPIO pins (that can only output 0V and 3.3V.) Is there a way to monitor this signal real-time?
Note: I am using MATLAB 2017b and I have an oscilloscope.
Answers (2)
Mark McBroom
on 24 Mar 2018
0 votes
The F28379D device has input capture pins that can be used to measure the frequency of an input signal.
4 Comments
Canberk Suat Gurel
on 25 Mar 2018
Mark McBroom
on 25 Mar 2018
I am assuming what you want to do is run code from your Simulink model on the F28379D device, but monintor signals in scope/display blocks in Simulink? You can accomplish this with External Mode. In External Mode, Simulink will generate code from your Simulink model and download the code to the device. If you have scopes or displays in your Simulink model, then when you hit the run button, Simulink will read the values for those signals from your F28379D device and display them on the scope or display in the Simulink model. The F28379D device will be running in real-time. The data displayed in the scopes/displays in the Simulink diagram will be psuedo real-time.
Canberk Suat Gurel
on 25 Mar 2018
Canberk Suat Gurel
on 27 Mar 2018
Mark McBroom
on 1 Apr 2018
0 votes
You are limited by the speed of the communication channel. What is the frequency of the signal you are measuring? Why are you using an analog channel? If you only need to measure frequency, you should use an input capture pin. This is a better use of CPU resources than trying to sample a high frequency signal using an A/D.
4 Comments
Canberk Suat Gurel
on 2 Apr 2018
Edited: Canberk Suat Gurel
on 2 Apr 2018
Rahul Subrahmanian
on 22 Mar 2022
Hi I hope you are doing good,
I am facing somewhat similar issue. Did you find any way to read high frequency signals using F2379D ?
Mark McBroom
on 22 Mar 2022
Are you using an input capture pin?
Rahul Subrahmanian
on 28 Mar 2022
Edited: Rahul Subrahmanian
on 28 Mar 2022
Hi Mark,
I am not using input capture pin. I need to read a 25kHz sine wave and generate SPWM with respect to that sine wave.
I have created a thread for the issue I am facing.
No one has replied to it yet.
Categories
Find more on C2000 Microcontroller Blockset in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!