Monitoring the Live Data on Appdesigner GUI
조회 수: 15 (최근 30일)
이전 댓글 표시
Hi,
I am designing a GUI which consists of diffrent stages for industrial application. Now, I am trying to control temperature controller via serial communication. My script is working well. I can monitor the instantaneous temperature value when I press the button. However, I need to monitor the temperature during the process. Is there a way to monitor it live (via editfield or grap)?
Thank you for your help
% Button pushed function: Button
function ButtonPushed(app, event)
% Create a Modbus Object.
m = modbus('serialrtu', 'COM1');
m.StopBits = 2;
m.Timeout = 3;
% Save the Server ID specified.
serverId = 247;
% Holding Registers
% Read 1 'int16', and 1 'uint16' Holding Registers starting from address 1.
app.data = read(m, 'holdingregs', 1, [1, 1], serverId, {'int16', 'uint16'});
modbusData.Display_Temperature = app.data(1);
modbusData.Temperature_Limit = app.data(2);
t = num2str(app.data(1));
app.EditField.Value=t;
% Read 1 Holding Register of type 'uint16' starting from address 81.
modbusData.Output_Action = read(m, 'holdingregs', 81, 1, serverId, 'uint16');
Holding Registers
Write a value 300 of type 'uint16' to a Holding Register at address 2.
write(m, 'holdingregs', 2, 300, serverId, 'uint16');
Clean Up
Clear the Modbus Explorer session variables.
% Clear the Modbus Object created.
clear m
% Clear the Server ID.
clear serverId
% Clear the temporary variable - 'data'.
clear data
댓글 수: 0
답변 (1개)
Meet
2023년 6월 1일
Hi,
You can implement a timer function in MATLAB AppDesiner. When the timer executes it will read the temperature data from modbus.
Please refer to the below MATLAB Answers where the user was able to solve a similar problem:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Modbus Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!