Author Topic: Keypad min and max value "not a valid value" error  (Read 2139 times)

DBTechServ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Keypad min and max value "not a valid value" error
« on: September 16, 2014, 04:35:55 PM »
Hi all, hope someone can help point me in the right direction -

Using DigitalPanelMeterA to read and write value to CompactLogix tag. Everything works great until I try to use the keypad min and max entry limit tags from the plc. I can't even enter the tag without getting error :"....  not a valid value for Double".
I have tried referencing it from the code

  Private Sub DigitalPanelMeterA1_Click(sender As System.Object, e As System.EventArgs) Handles DigitalPanelMeterA1.Click
        Dim TO_HMI_Drop_Time_Max As Int16
        Dim TO_HMI_Drop_Time_Min As Int16

        Dim dblMin As Double = CDbl(TO_HMI_Drop_Time_Min)
        Dim dblMax As Double = CDbl(TO_HMI_Drop_Time_Max)
       
        DigitalPanelMeterA1.KeypadMinValue = dblMin
        DigitalPanelMeterA1.KeypadMaxValue = dblMax
    End Sub

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Keypad min and max value "not a valid value" error
« Reply #1 on: September 16, 2014, 05:06:05 PM »
I just did a quick test with your code and added 2 more lines to put in values. I was not connected to a PLC, but did put in an address in PLCAddressKeypad so it would pop up a keypad when I click the meter. I tried to enter a value outside of the limit and it worked as expected.  I was unable to reproduce the error you are getting.


Code: [Select]
    Private Sub DigitalPanelMeterA1_Click(sender As System.Object, e As System.EventArgs) Handles DigitalPanelMeterA1.Click
        Dim TO_HMI_Drop_Time_Max As Int16
        Dim TO_HMI_Drop_Time_Min As Int16

        TO_HMI_Drop_Time_Max = 32767
        TO_HMI_Drop_Time_Min = 0

        Dim dblMin As Double = CDbl(TO_HMI_Drop_Time_Min)
        Dim dblMax As Double = CDbl(TO_HMI_Drop_Time_Max)

        DigitalPanelMeterA1.KeypadMinValue = dblMin
        DigitalPanelMeterA1.KeypadMaxValue = dblMax
    End Sub

DBTechServ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Keypad min and max value "not a valid value" error
« Reply #2 on: September 17, 2014, 09:33:56 AM »
Thanks Archie but, the problem I have is when trying to use the min/max value tags read from the compactlogix plc.

I can limit the entry values via the properties of the meter and by using your example.

Am I pointing to the plc tag correctly?

        Dim dblMin As Double = CDbl(TO_HMI_Drop_Time_Min)
        Dim dblMax As Double = CDbl(TO_HMI_Drop_Time_Max)


DBTechServ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Keypad min and max value "not a valid value" error
« Reply #3 on: September 17, 2014, 09:36:52 AM »
Also, the error I mentioned is occurring if I try to use the plc tagname in the keypad min/max values section of the meter's properties page. I can only enter actual numbers there.
« Last Edit: September 17, 2014, 09:39:07 AM by DBTechServ »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Keypad min and max value "not a valid value" error
« Reply #4 on: September 17, 2014, 09:48:30 AM »
Only properties that start with PLCAddress will accept a tag name. If you need to get min and max values from the PLC, then you will either need to modify the DigitalPanelMeter code or use a DataSubscriber

DBTechServ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Keypad min and max value "not a valid value" error
« Reply #5 on: September 17, 2014, 10:01:44 AM »
Thanks Archie.

Already looking into the panelmeter code.

By the way - GREAT Software package.  8)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Keypad min and max value "not a valid value" error
« Reply #6 on: September 17, 2014, 09:21:25 PM »
The DigitalPanelMeterA is based on an experimental code model that makes this exact modification very easy. On a call to SubscribeToCommDriver it will check all properties starting with PLCAddress to see if what follows matches an existing property name, If it does, it will automatically create a subscription to the PLC variable. So by simply creating a property PLCAddressKeypadMinValue, it will take care of the rest. To do this, just add this code to DigitalPanelMeterA.vb:
Code: [Select]
    '*****************************************
    '* Property - Address in PLC to Link to
    '*****************************************
    Private m_PLCAddressKeypadMinValue As String = ""
    <System.ComponentModel.Category("PLC Properties")> _
    Public Property PLCAddressKeypadMinValue() As String
        Get
            Return m_PLCAddressKeypadMinValue
        End Get
        Set(ByVal value As String)
            If m_PLCAddressKeypadMinValue <> value Then
                m_PLCAddressKeypadMinValue = value

                '* When address is changed, re-subscribe to new address
                SubscribeToCommDriver()
            End If
        End Set
    End Property

DBTechServ

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Keypad min and max value "not a valid value" error
« Reply #7 on: September 18, 2014, 09:08:30 AM »
Thanks again Archie.
I have already created a work around -

    Private Sub DPM_FeederDropTime_Click(sender As System.Object, e As System.EventArgs) Handles DPM_FeederDropTime.Click
        ' FeederDropTime_Min and FeederDropTime_Max are seperate DPMs hidden behind the larger FeederDropTime DPM
        ' used to read the min and max values from the PLC
        DPM_FeederDropTime.KeypadMinValue = FeederDropTime_Min.Value
        DPM_FeederDropTime.KeypadMaxValue = FeederDropTime_Max.Value

    End Sub

but, I like your solution better and will implement immediately.