Author Topic: Best way to display message when you are connected and not connected to PLC  (Read 2696 times)

thug_

  • Newbie
  • *
  • Posts: 30
    • View Profile
I would like to know what is the best way to get accurate information about plc connection.

Right now I am working with MicroLogix 1200 Allen- Bradley plc, and I am using SerialDF1forSLCMicroCom driver. Everything works fine, I am reading and writing to PLC registry, but I want to display when I am really connected to PLC and when I am not. What I am currently using is DataRecived event, so when that event is raised I am displaying message that I am connected. But I have stop button in my application which is stopping to read from PLC, when I click it is still displaying that I am connected.

How I can change that message, when user press button "Stop".

Thanks.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5311
    • View Profile
    • AdvancedHMI
One way is to add a BasicLabel to the form and set PLCAddressValue to N7:0. Then handle the TextChanged event and look for "Could Not Connect" in the Text property

thug_

  • Newbie
  • *
  • Posts: 30
    • View Profile
Thanks Archie for your answer, but I didn't give enough details in my question, sorry about that.

I am doing project as WPF application, I am using AdvancedHMI dlls. Is there any way to it in WPF app ?

Cheers

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5311
    • View Profile
    • AdvancedHMI
What does your Stop button do, close the connection?

thug_

  • Newbie
  • *
  • Posts: 30
    • View Profile
Yes when stop button is pressed, connection to PLC should be closed ? In same time message about connection should be changed from Connect to Disconnect. Right now the way how it working application is started message is Disconnected, user give some parameters select port and press Start button, that check trigger DataRecived event, and if data is received from PLC, message about connection changes to Connect. But when I press stop and when I am not receiving data from plc anymore, message still showing connected, and I would like to change that message to Disconnected ?
« Last Edit: January 06, 2017, 06:44:05 AM by thug_ »

bachphi

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Thanks Archie for your answer, but I didn't give enough details in my question, sorry about that.

I am doing project as WPF application, I am using AdvancedHMI dlls. Is there any way to it in WPF app ?

Cheers

Any chance that you are running it with the Pi and IOT core ?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

thug_

  • Newbie
  • *
  • Posts: 30
    • View Profile
Thanks Archie for your answer, but I didn't give enough details in my question, sorry about that.

I am doing project as WPF application, I am using AdvancedHMI dlls. Is there any way to it in WPF app ?

Cheers
Any chance that you are running it with the Pi and IOT core ?

No

bachphi

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
 Archie was talking about moving to WPF in the future, but do you mind if you can tell us in a few steps how you did.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

thug_

  • Newbie
  • *
  • Posts: 30
    • View Profile
Archie was talking about moving to WPF in the future, but do you mind if you can tell us in a few steps how you did.
I am doing simple WPF application for PLC, so app should read some variables from PLC, compare them to the variables given by user, and depending from the results change them and write back to PLC. I started WPF project in Visual Studio added Advanced HMI references and that is it. I am not using UI from Advanced HMI, I am just using driver to communicate with PLC.