Difference between revisions of "Subscribing to PLC data via code"
(Created page with "The AdvancedHMI drivers support a subscription that will automatically poll data and return the values. The DataSubscriber provides a non-code method of using this service. Ho...") |
m |
||
Line 17: | Line 17: | ||
− | The rate at which | + | The rate at which data is polled is determined by the value of the PollRateOverride property. |
Each driver is highly optimized for communications using subscriptions. All of the visual controls (e.g. Gauge) use the subscription mechanism to receive their data. | Each driver is highly optimized for communications using subscriptions. All of the visual controls (e.g. Gauge) use the subscription mechanism to receive their data. |
Revision as of 12:51, 25 March 2017
The AdvancedHMI drivers support a subscription that will automatically poll data and return the values. The DataSubscriber provides a non-code method of using this service. However, there are times when it is desired or more efficient to subscribe using code. This is an example on how to do this:
Private SubscriptionID1 As Integer Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click SubscriptionID1 = EthernetIPforCLXCom1.Subscribe("MyTag", 1, 500, AddressOf Subscription_DataReceived) End Sub
Private Sub Subscription_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Label1.Text = e.Values(0) End Sub
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing EthernetIPforCLXCom1.UnSubscribe(SubscriptionID1) End Sub
The rate at which data is polled is determined by the value of the PollRateOverride property.
Each driver is highly optimized for communications using subscriptions. All of the visual controls (e.g. Gauge) use the subscription mechanism to receive their data.