How to monitor an analog signal real-time in Simulink?

조회 수: 4 (최근 30일)
Canberk Suat Gurel
Canberk Suat Gurel 2018년 3월 24일
편집: Rahul Subrahmanian 2022년 3월 28일
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.

답변 (2개)

Mark McBroom
Mark McBroom 2018년 3월 24일
The F28379D device has input capture pins that can be used to measure the frequency of an input signal.
  댓글 수: 4
Canberk Suat Gurel
Canberk Suat Gurel 2018년 3월 25일
Thank you for your answer. This sounds like exactly what I need. I will use the dedicated pins for determining the frequency and I will run it in the External Mode to monitor some of the other signals, e.g. speaker, microphone. I will try this tomorrow and report back.
Canberk Suat Gurel
Canberk Suat Gurel 2018년 3월 27일

Mark, I am having a small problem with the sampling of the analog signal. The signal that is displayed on the scope is shown below:

It was supposed to be a sine wave and as it can only display it using Markers (not Line) it doesn't appear to be a sine wave. Is there a way to sample more frequently or are we limited with the baud rate of the serial communication?

댓글을 달려면 로그인하십시오.


Mark McBroom
Mark McBroom 2018년 4월 1일
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
Mark McBroom
Mark McBroom 2022년 3월 22일
Are you using an input capture pin?
Rahul Subrahmanian
Rahul Subrahmanian 2022년 3월 28일
편집: Rahul Subrahmanian 2022년 3월 28일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Code Generation and Deployment에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by