Author Topic: Launching Application via PLC Value  (Read 3017 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Launching Application via PLC Value
« on: October 07, 2014, 07:31:26 PM »
Sometimes you need to launch an application on a PC when a value changes in the PLC. This is fairly easy to do in AdvancedHMI.

1) Add your driver and set the properties
2) Add a DataSubscriber to the form and set PLCAddressValue to the register/tag that you want to use to launch an application
3) Double click the DataSubscriber to get back to the code
4) Add the following code, which assumes you are using a Boolean value from the PLC
Code: [Select]
    Private Sub DataSubscriber1_DataChanged(sender As System.Object, e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        If e.Values(0) = "True" Then
            System.Diagnostics.Process.Start("C:\Windows\Notepad.exe")
        End If
    End Sub

5) Run the application and toggle the bit in the PLC you specified in the DataSubscriber.

Each time the bit goes True, Notepad should start up

ban_pas

  • Guest
Re: Launching Application via PLC Value
« Reply #1 on: April 13, 2015, 07:25:24 AM »
Software engineering is the study and an application of engineering to the design, development, and maintenance of software







_______________________
FARASAT