AdvancedHMI Software

General Category => Support Questions => Topic started by: Darrell on May 01, 2015, 01:00:23 PM

Title: 3 position sw.
Post by: Darrell on May 01, 2015, 01:00:23 PM
When I start my HMI , the switch always shows Center position , if the bit for right or left is true it still shows the Center position ,   Micrologix 1400 ,  I have to click it to show the correct position

Darrell
Title: Re: 3 position sw.
Post by: Archie on May 01, 2015, 01:37:50 PM
Do you have anything in the properties PLCAddressValueLeft and PLCAddressValueRight? If there is nothing in those properties, it will not sync up with the PLC.
Title: Re: 3 position sw.
Post by: Darrell on May 01, 2015, 05:05:39 PM
Yes I do , the bit is true , and it doesn't sync up
Darrell
Title: Re: 3 position sw.
Post by: Archie on May 01, 2015, 06:31:30 PM
Open SelectorSwitch3Pos.vb and add this code to the PLC Related Properties region:

    Private m_ValueLeft As Boolean
    Public Property ValueLeft As Boolean
        Get
            Return (Value = 0)
        End Get
        Set(value As Boolean)
            If m_ValueLeft <> value Then
                If value Then
                    Me.Value = 0
                ElseIf Not m_ValueRight Then
                    Me.Value = 1
                End If
                m_ValueLeft = value
            End If
        End Set
    End Property

    Private m_ValueRight As Boolean
    Public Property ValueRight As Boolean
        Get
            Return (Value = 2)
        End Get
        Set(value As Boolean)
            If m_ValueRight <> value Then
                If value Then
                    Me.Value = 2
                ElseIf Not m_ValueLeft Then
                    Me.Value = 1
                End If
                m_ValueRight = value
            End If
        End Set
    End Property
Title: Re: 3 position sw.
Post by: Darrell on May 02, 2015, 10:59:57 AM
Now works , thanks Archie
Title: Re: 3 position sw.
Post by: Darrell on May 03, 2015, 10:04:16 PM
What I noticed today was when I load my HMI the switch will sync , but if I happen to click the switch to another position it will not re-sync

I'm using this one as an indicator , to tell me which one is on , Hand/Off/Auto switch for example

Darrell