I am currently working on calibrating multiple channels by passing a single variable upon loading a form but I'm stuck with how to make the PLC Addresses actually change and add into the data subscriber. Am I on the right track with this.
Public Class MainForm
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'* Copy this section of code to every new form created
'*******************************************************************************
Private NotFirstShow As Boolean
Public TagInfo(2) As String
Public PLCAddress As AdvancedHMIDrivers.PLCAddressItem
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
'* Do not start comms on first show in case it was set to disable in design mode
If NotFirstShow Then
AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
Else
NotFirstShow = True
End If
End Sub
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.Text = "Room Name Channel Name"
Me.Tag = "10.193.114.72,ANALOG_IN.chamberPressure" 'Will be passed from form opening. Both of these values are temporary
TagInfo = Split(Me.Tag, ",")
BasicLabel1.Text = "Current A/D Input ="
BasicLabel2.Text = "Current EU Output ="
BasicLabel3.Text = "Low"
BasicLabel4.Text = "Med"
BasicLabel5.Text = "High"
BasicLabel7.Text = TagInfo(0)
Label2.Text = "A/D"
Label3.Text = "Engineering Units"
EthernetIPforMicro800Com1.IPAddress = TagInfo(0)
BasicLabel6.Text = (TagInfo(1) + ".in1")
'Starts not passing
PLCAddress.PLCAddress = (TagInfo(1) + ".in1")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".in1")
'AddHandler DataSubscriber1.DataChanged, AddressOf DataSubscriber_DataChanged
PLCAddress.PLCAddress = (TagInfo(1) + ".in2")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".in2")
PLCAddress.PLCAddress = (TagInfo(1) + ".in3")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".in3")
PLCAddress.PLCAddress = (TagInfo(1) + ".out1")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".out1")
PLCAddress.PLCAddress = (TagInfo(1) + ".out2")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".out2")
PLCAddress.PLCAddress = (TagInfo(1) + ".out3")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".out3")
PLCAddress.PLCAddress = (TagInfo(1) + ".input")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".input")
PLCAddress.PLCAddress = (TagInfo(1) + ".output")
DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
DataSubscriber1.SynchronizingObject = Me
DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".output")
End Sub
Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs)
If e.PlcAddress = "ANALOG_IN.chamberPressure.input" Then
BasicLabel1.Text = e.Values(0)
BasicLabel1.Text = "Current A/D Input =" + "ANALOG_IN.chamberPressure.input"
End If
If e.PlcAddress = "ANALOG_IN.chamberPressure.output" Then
BasicLabel2.Text = e.Values(0)
BasicLabel2.Text = "Current EU Input =" + "ANALOG_IN.chamberPressure.output"
End If
If e.PlcAddress = "ANALOG_IN.chamberPressure.in1" Then
BasicLabel3.Text = e.Values(0)
BasicLabel3.Text = "low" + "ANALOG_IN.chamberPressure.in1"
End If
If e.PlcAddress = "ANALOG_IN.chamberPressure.in2" Then
BasicLabel4.Text = e.Values(0)
BasicLabel4.Text = "Med" + "ANALOG_IN.chamberPressure.in2"
End If
If e.PlcAddress = "ANALOG_IN.chamberPressure.in3" Then
BasicLabel5.Text = e.Values(0)
BasicLabel5.Text = "High" + "ANALOG_IN.chamberPressure.in3"
End If
If e.PlcAddress = " ThenANALOG_IN.chamberPressure.out1" Then
BasicLabel6.Text = e.Values(0)
BasicLabel6.Text = "ANALOG_IN.chamberPressure.out1"
End If
If e.PlcAddress = "ANALOG_IN.chamberPressure.out2" Then
BasicLabel7.Text = e.Values(0)
BasicLabel7.Text = +"ANALOG_IN.chamberPressure.out2"
End If
If e.PlcAddress = "ANALOG_IN.chamberPressure.out3" Then
BasicLabel8.Text = e.Values(0)
BasicLabel8.Text = "ANALOG_IN.chamberPressure.out3"
End If
End Sub
End Class