Perhaps I'd be better to ask some more specific questions...
I've had a look through the different items I can get from the comms driver:
- Com Error
- Connection Closed
- Connection Established
- Data Received
- Disposed
- Subscription Data Received
...and here's my guess as to when each of them trigger. Can anyone correct my mistakes, and fill in the blanks? Just trying to get an overall picture so I can describe how best to construct my code.
- Com Error: will execute once only when communications to the PLC are lost. Will not re-trigger until communications are restored, and then lost again (question - if I were to add a button linked to a tag that doesn't exist in the PLC, and click that button, would the Com Error code execute? What if one object on the display momentarily loses it's value, and then comes back? Or is it only if I lose the entire link?)
- Connection Closed: will execute once when AHMI closes the connection to the PLC (question: what causes this? Does a com error trigger the connection to close? Or is it only on application shutdown?)
- Connection Established: will execute once when a connection to the configured PLC is established. Will not execute again until the connection is lost (or closed???) and restored (question: does "connection established" mean data transfer has started, or just that the PLC has been contacted and is ready to exchange data?)
- Data Received: will execute every time any data is received from the PLC (or is it just once, after the connection is established, when the data exchange actually starts?)
- Disposed:
- Subscription Data Received: