Author Topic: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties  (Read 1465 times)

ckmccardle

  • Newbie
  • *
  • Posts: 3
    • View Profile
I am attempting to process a boolean array from a Rockwell PLC to change the ForeColor of a BasicLabel. I have 58 parameters to modify so the goal is:
If AdvHMI_RejHighlight[0]=1, Then BasicLabel37.ForeColor="red"
If AdvHMI_RejHighlight[1]=1, Then BasicLabel38.ForeColor="red"
......
If AdvHMI_RejHighlight[57]=1, Then BasicLabel94.ForeColor="red"

How can I accomplish this efficiently and also, what is the difference between the DataSubscriber and DataSubscriber2? Thanks in advance for your assistance!

ckmccardle

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties
« Reply #1 on: March 24, 2020, 11:34:38 AM »
I tried to just use the BasicIndicator with the PLCAddressText=AdvHMI_RejPartData and the PLCAddressSelectColor3=AdvHMI_RejHighlight, which seems like it would have been very simple and straightforward, but the indicator did not reflect the value in the plc, instead it showed the connection, ie)"EthernetIPforCLXCom1\192.168.0.1\etc.."

bachphi

  • Hero Member
  • *****
  • Posts: 653
    • View Profile
Re: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties
« Reply #2 on: March 24, 2020, 03:58:07 PM »
Have you tried the 6 standard steps?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Godra

  • Hero Member
  • *****
  • Posts: 1446
    • View Profile
Re: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties
« Reply #3 on: March 24, 2020, 04:05:54 PM »
instead it showed the connection, ie)"EthernetIPforCLXCom1\192.168.0.1\etc.."

You need to specify the exact messages.

DataSubscriber2 should always be chosen over DataSubscriber since it is its extended version.

« Last Edit: March 24, 2020, 04:10:23 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1446
    • View Profile
Re: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties
« Reply #4 on: March 24, 2020, 04:19:23 PM »
I am attempting to process a boolean array from a Rockwell PLC to change the ForeColor of a BasicLabel. I have 58 parameters to modify so the goal is:
If AdvHMI_RejHighlight[0]=1, Then BasicLabel37.ForeColor="red"
If AdvHMI_RejHighlight[1]=1, Then BasicLabel38.ForeColor="red"
......
If AdvHMI_RejHighlight[57]=1, Then BasicLabel94.ForeColor="red"

How can I accomplish this efficiently and also, what is the difference between the DataSubscriber and DataSubscriber2? Thanks in advance for your assistance!


Since you are using BasicLabels then you should resort to using their Highlight property to change the back color instead of changing the fore color.

« Last Edit: March 24, 2020, 04:21:16 PM by Godra »

ckmccardle

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties
« Reply #5 on: March 24, 2020, 05:56:57 PM »
Since you are using BasicLabels then you should resort to using their Highlight property to change the back color instead of changing the fore color.

I would be content to use the Highlight Property, but how do I link that to an alternative PLC Tag (boolean)?

Have you tried the 6 standard steps?

What are the 6 standard steps?

You need to specify the exact messages.

DataSubscriber2 should always be chosen over DataSubscriber since it is its extended version.

So, looking at the properties for each, the only "extension" seems to be the pollrate, sychobject, and value under the 'misc' tab as well as how it handles the PLCAddressValue(Items). So, does this mean that the regular DataSubscriber has a standard poll rate but the DataSubscriber2 allows for a modified poll rate and an array of plc tags instead of a single tag?

While I appreciate the input of information, I don't feel like this feedback helps resolve my issue.. The code I've come up with so far, but have not tested online is below:

    Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        Dim Aindex As Integer = 0
        Dim BL As String
        BL = "BasicLabel" & (Aindex + 37).ToString

        For Aindex = 0 To 57
            If CBool(e.Values(Aindex)) = True Then
                Me.BL.ForeColor = Color.DarkRed
            Else
                Me.BL.ForeColor = Color.Black
            End If
        Next Aindex
    End Sub

I'm hoping to test it first thing in the morning to see if it performs as expected on the fore color. Thanks!

Godra

  • Hero Member
  • *****
  • Posts: 1446
    • View Profile
Re: DataSubscriber for PLC Boolean Array to Modify Basiclabel properties
« Reply #6 on: March 24, 2020, 07:10:42 PM »
The Highlight property is normally accessed/controlled through the PLCAddressHighlight or PLCAddressHighlightX property, that's where you input your PLC Tag.

« Last Edit: March 24, 2020, 08:47:49 PM by Godra »