Author Topic: ON/OFF button for communications with PLC  (Read 1427 times)

DanieLoche

  • Guest
ON/OFF button for communications with PLC
« on: August 22, 2016, 11:30:07 AM »
Hello,

I'm add a button to my main form to control if the application communicates or not with the PLC.

The Selector Switch seems like a perfect control -visually speaking- for that.

But there I noticed that I can't have a form with AHMI controls but without at least 1 AHMI Driver...
Not very important, till the moment I noticed that when there's a Driver on a form, it is not possible to just disable it (only stop polling if I understood well).
Digging a little, I noticed that for the Datasubscribers, you can't even stop polling.

So what could be the best solution for me to start/stop the communication ? More precisely, how could I solve the 3 issues above ? ^^

For now I have in the drivers side a property binding between the DisableSubscription properties and a boolean that I change with the Switch.
Might works well and with no programming at all, but the 3 points above creates some unwanted conveniences. :/

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5268
    • View Profile
    • AdvancedHMI
Re: ON/OFF button for communications with PLC
« Reply #1 on: August 22, 2016, 04:56:52 PM »
The driver instance on the form does not mean it will try to establish communications. If it is not specified as a ComComponent on any controls or if a control has ComComponent set to it, but none of the PLCAddress* properties have any addresses, then the driver will never start.

Polling is how the data for all controls and components receive their data, If the property DisableSubscriptions is set to True, then updating of any subscriptions are paused. If you are using code to read/write, DisableSubscriptions will not stop this, it will be up to your code to determine when coms are to be stopped.

Digging a little, I noticed that for the Datasubscribers, you can't even stop polling.
If DisableSubscriptions is set to True, then DataSubscribers with ComComponent set to that driver will also stop receiving data

DanieLoche

  • Guest
Re: ON/OFF button for communications with PLC
« Reply #2 on: August 23, 2016, 03:47:59 AM »
Thanks a lot for the answer, it's more clear now. :)

Quote
If it is not specified as a ComComponent on any controls
It's not the same thing, but talking about that it feels strange that if I put PLC controls, with no ComComponent at all (and no driver in the form), then an Ethernet Drivers is automatically added to the form. I should try some tests here, to see the exact behavior. But if you say that in such configuration it will never start, good. :)
I know that logically in such case the PLC control is not needed (as I won't use it for its first purpose), but the design of the buttons for example fit just so perfectly... ^^