Filter löschen
Filter löschen

Monitoring the Live Data on Appdesigner GUI

5 Ansichten (letzte 30 Tage)
AHMED
AHMED am 12 Mai 2023
Beantwortet: Meet am 1 Jun. 2023
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

Antworten (1)

Meet
Meet am 1 Jun. 2023
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:

Kategorien

Mehr zu Manage Products finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by