This is the code for my start screen which is the first screen to load when the program is started. Occasionally I get and error that shuts down the program. I have the error information paste bellow as well. You can see in my code that I am looking for my heartbeat that is being generated by the PLC so that I can confirm communication. Are there other ways to do that? What is the best way to confirm that I have comms with the PLC before my code begins to execute, such as waiting until I have communications until the timer starts. I know that there is a CommunicationEstablished event for the ethernet driver but I had no success with that. Thanks in advance for the help.
Public Class StartScreen
Private Sub StartScreen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Threading.Thread.Sleep(1000)
Timer1.Start()
End Sub
Private Sub BevelButtonDisplay1_Click(sender As Object, e As EventArgs) Handles BevelButtonDisplay1.Click
ShuttleScreen.Show()
End Sub
Private Sub BevelButtonDisplay3_Click(sender As Object, e As EventArgs) Handles BevelButtonDisplay3.Click
InkDelivery.Show()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim A As Integer = EthernetIPforCLXCom1.Read("HeartBeatTimer1.ACC")
If A >= 500 Then
HeartBeatIndicator.Show()
Else
HeartBeatIndicator.Hide()
End If
End Sub
End Class
This is the error that I get occassionaly when my form loads:
An unhandled exception of type 'MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException' occurred in MfgControl.AdvancedHMI.Drivers.dll
'This line of code is highlighted in the Ethernet driver code:
DLL(MyDLLInstance).ReadTagValue(PLCAddressByTNS(SequenceNumbershort), numberOfElements, CUShort(SequenceNumber))