How to change device setting by popup
(YouTube video link at the end)
This article includes a description how of motor setting parameters can be changed by using TwinCAT HMI. There might be many different types of settings depending on motor and manufacturer. We shall consider or show how to create a popup in TwinCAT HMI and how the data can be saved to PLC and read those back and display in the popup setting. Other settings may be added to the popup by following the same process.
If we click on the motor symbol (in the HMI) then it will popup a dialog from where we can set the parameters. The parameters are saved to the PLC (see the persistence data setting article in the PLC section at https://www.hemelix.com/automation/twincat-persistent-data/)
We shall discuss how the persistent data can be displayed in the popup, change it there and store it back to PLC. We are saving the data every 100 seconds interval. We need to save the data in a certain interval for avoiding losses of data.
Our settings are like the following:
VAR PERSISTENT motorStartTime : INT; //Seconds motorStopTime : INT; //Seconds
motorRPM : REAL; //rpm END_VAR
We shall create a sample that can be used to load the settings (persistent data) to the HMI, if we edit the data then we can save those to the PLC.
DESIGN STEPS :
=> Start Visual Studio and create an empty HMI project
=> Create two user controls (motor.usercontrol for displaying the motor and SettingsPopup.usercontrol for displaying the settings as popup)
Left side image is the motor user control and second side image is for the pop up where we can edit the settings and save it.
Add the following parameter name and datatype for motor user control
Add the following parameter name and datatype for popup settings user control