AdvancedHMI Software
General Category => Support Questions => Topic started by: bachphi on September 09, 2015, 05:32:14 PM
-
I have a DataSubscriber1 and I set a boolean triggerbit in its PLCAddressvalue. Then in DataChanged i set BeginRead of a DINTArray[10], but it only show the first value is being read. Nothing show up on label4 and 5. TIA.
Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
EthernetIPforCLXCom1.BeginRead("TempDINTArray[0]", 3)
End Sub
Private MyValue As String
Private Sub EthernetIPforCLXCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom1.DataReceived
If e.PlcAddress = "TempDINTArray[0]" Then
MyValue = e.Values(0)
Label3.Text = e.Values(0)
End If
If e.PlcAddress = "TempDINTArray[1]" Then
Label4.Text = e.Values(0)
End If
If e.PlcAddress = "TempDINTArray[2]" Then
Label5.Text = e.Values(0)
End If
End Sub
-
Since all 3 values are read with a single read, they should all return on the same call. Your code will need to be like this:
Private Sub EthernetIPforCLXCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom1.DataReceived
If e.PlcAddress = "TempDINTArray[0]" Then
MyValue = e.Values(0)
Label3.Text = e.Values(0)
Label4.Text = e.Values(1)
Label5.Text = e.Values(2)
End If
End Sub
-
Make logical sense. Thank You again!
-
Need help again, Archie.
I have everything working normal, that is a trigger bit to trigger my DataSubscriber, then in DataSubscriber1_DataChanged I do a BeginRead and received values in EthernetIPforCLXCom1_DataReceived. Then I sent data SQL server. Everything is working up to that point.
Then I changed the PollrateOveride to 250ms. Save and Rebuild it. Then run my app again, did not see data send to SQL server.
I look around and saw that Datasubscriber1 icon no longer there, it dissappeared.
I repeat the process with my backup copy. Again Datasubscriber1 icon dissappeared.
-
Then I changed the PollrateOveride to 250ms. Save and Rebuild it. Then run my app again, did not see data send to SQL server.
I look around and saw that Datasubscriber1 icon no longer there, it dissappeared.
I repeat the process with my backup copy. Again Datasubscriber1 icon dissappeared.
This sounds like it might be one of the quirks of the Visual Studio designer. After the DataSubscriber disappears, try this:
- In Solution Explorer, select the AdvancedHMI project
- At the top of Solution Explorer click the Show All Files icon
- Expand down the form with the DataSubscriber
- You should now see a file with designer.vb on the end of the name
- Right click that file and select View Code
- Scroll down through that code and see if you still see the DataSubscriber referenced that disappeared from the form
-
In the MainForm.Designer.vb , I still seeing references for DataSubscriber. If using Build Solution from the menu then it's OK, only when Rebuild , then DataSubscriber will disappear.
-
Visual Studio doesn't like a Rebuild All if you have any forms open in design view. During a rebuild, since it is a source code project, all of the controls are deleted therefore they do not exist for a short period of time. During that time the designer doesn't know how to handle things since the form is populated with controls that don't exist.