Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - andrew_pj

Pages: 1 2 3 [4] 5 6
46
Your timer may be firing before the form is fully loaded. I would add a DataSubscriber, set PLCAddressValue to 414940, double click the DataSubscriber to get to the DataChanged event handler.

Add your code there and use e.values(0) in place of ModbusTCPCom1.Read(414940)

I use DataSubscriber then it is okay.

In 3.97e release note, there is additional features:
DataSubscriber - Can subscribe to multiple values by putting comma separated values in PLCAddressValue

So, I have tried to put 2 address by using comma as separation.
Then, parse the PLCAddressValue to be stored in separate variable.

Code: [Select]
Private Sub DataSubscriber2_DataChanged_1(ByVal sender As System.Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber2.DataChanged
        ' temp = 414940
        Dim temp As Integer = Integer.Parse(ModbusTCPCom1.Read(Me.DataSubscriber2.PLCAddressValue.Substring(0, 6)))

        ' temp2 = 414942
        Dim temp2 As Integer = Integer.Parse(ModbusTCPCom1.Read(Me.DataSubscriber2.PLCAddressValue.Substring(7, 6)))

End Sub

This works really well.
However, besides manually parsing PLCAddressValue, do you have special function to get those address (by index maybe)?
Please advise the trick, Thank you.


Best regards,
Andrew


47
Support Questions / Re: Version 3.97e breaking changes
« on: January 28, 2015, 09:52:25 PM »
Attachment shows the highlighted codes to be removed.

48
Support Questions / Re: MessageListByValue and ModbusTCP
« on: January 28, 2015, 09:48:48 PM »
The MessageListByValue should be able to support 32767 messages using a 16 bit integer and millions with a 32 bit.

Am I misunderstanding something?

You're right.

But in my situation, the alarm mapping is described as below:
40001.0 = alarm 1
40001.1 = alarm 2
40001.2 = alarm 3
....
40001.15 = alarm 16

So, when I register the alarms in 'message' parameter of MessageListByValue, it would be like in the attachment.
Then I guess I need to map my alarms in one special address in PLC.


Best regards,
Andrew


49
Support Questions / Re: MessageListByValue and ModbusTCP
« on: January 28, 2015, 09:03:14 PM »
Version 3.97e is now available with this new feature. Also see the post on 3.97e breaking changes if upgrading a project

Thanks Archie, it works now.

Just a little expectation here:
It would be nice if the PLCAddressValue can be specified for each message.
Since I am using ModbusTCP, so currently my MessageListByValue can only contain 16 alarms.

Or do you have trick regarding this? perhaps mapping the address or something.
Thank you.


Best regards,
Andrew

50
Support Questions / MessageListByValue and ModbusTCP
« on: January 28, 2015, 01:57:08 AM »
Dear all,

I am using version 3.97d.
Got an issue with MessageListByValue + ModbusTCP comm.
I have setup some messages in the collection, and set the BackColor as RED.
However, when the particular message appears during runtime, the backcolor is transparent.

Then trying to use Highlight key character color as well.
So, in my message I put ! character, and by default the setting of highlight color is RED.
But still when the message occurs, the backcolor is transparent.

Please advise how to apply some background color to MessageListByValue.
I expect this component to be Alarm System, so it might require color.
Thank you.


Best regards,
Andrew




51
Support Questions / InvalidOperationException OnDataReceived ModbusBase
« on: January 27, 2015, 11:41:46 PM »
Dear all,

I am using version 3.97d.
Basically, I have BasicLabel which requires to be hide and shown in certain condition.
I dragged Timer object into the form and put the code inside so it will continuously detect this condition.

Code: [Select]
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Try
            Dim temp As Integer = Integer.Parse(ModbusTCPCom1.Read(414940))
            If temp < 0 Then
                Me.FWD_Indication.Show()
                Me.AFT_Indication.Hide()
            ElseIf temp >= 0 Then
                Me.AFT_Indication.Show()
                Me.FWD_Indication.Hide()
            End If
        Catch ex As Exception

        End Try
    End Sub

However, it always returns InvalidOperationException (pls refer to attachment for details).
Is there any other solution besides using BasicLabel and put the above code using Timer?
Please advise, Thank you.

Best regards,
Andrew

52
Feature Request / Re: Using Modbus Register Bits in Controls
« on: December 18, 2014, 04:57:02 AM »
Version 3.94 is posted now and has a couple more fixes to the Modbus drivers

Yes! Version 3.94 has no more "Com Error -999"
Thanks for updating.


Best regards,
Andrew

53
Looks nice and simple!
Still have room for improvement though.

54
Feature Request / Re: Using Modbus Register Bits in Controls
« on: December 14, 2014, 11:11:58 PM »
Tested version 3.93, result is OK for BasicIndicator with address bit (e.g 40001.0, 40001.1, 40001.2, ...)
However, address 40001, 40002, 40003, etc for DigitalPanelMeter still indicates "Com Error -999" in the beginning.
I try tested with other indicators: Tank, Gauge. Result is same.


Best regards,
Andrew

55
Support Questions / Re: IndexOutOfArrayException on Modbus Bit Address
« on: December 14, 2014, 11:07:23 PM »
Thanks Archie, version 3.93 fixed this problem.

56
Feature Request / Re: Using Modbus Register Bits in Controls
« on: December 11, 2014, 10:24:18 PM »
Archie, this problem still exists in version 3.91 and 3.92
Always during program starts, this error appears.


Best regards,
Andrew

57
Support Questions / Re: IndexOutOfArrayException on Modbus Bit Address
« on: December 11, 2014, 09:59:43 PM »
Download and tested this function in version 3.92, and different error comes out "InvalidOperationException"
Program stopped at Line 183 on ModbusTCPCom.vb
Please advise regarding this, version 3.91 doesn't have this issue though.
Thank you.


Best regards,
Andrew

58
Support Questions / Re: IndexOutOfArrayException on Modbus Bit Address
« on: December 11, 2014, 08:01:35 PM »
Sry for not mentioning, yes this is version 3.91.
With that code modification, now it works fine all the time.
Thanks Archie.


Best regards,
Andrew

59
Support Questions / IndexOutOfArrayException on Modbus Bit Address
« on: December 11, 2014, 04:32:38 AM »
I am basically using Modbus bit address feature to implement program for controlling valve open and close.
One case: To open using 40001.0 and To close using 40001.2, and the signal is "pulse".
So I created one function which simply reads the current value of addr (40001) and manipulate it with value of the bit.

Code: [Select]
Private Function Modify(ByVal addr As String, ByVal value As Integer)
        'Try
        Dim tempStr As String = MainForm.ModbusTcpCom1.Read(addr)
        Dim currValue As Integer = CInt(tempStr) + value
        tempStr = CStr(currValue)
        MainForm.ModbusTcpCom1.Write(addr, tempStr)
        'Catch ex As Exception
        'End Try
        Return 0
    End Function

Then, I create pop-up window that simply consists of 2 buttons, OPEN and CLOSE.
As mentioned, it is a pulse signal, so when user release/up the button, value will be reset.

Code: [Select]
Private Sub Button2_Down(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPEN_BTN.MouseDown
        If MainForm.ValveNo = 1 Then
            Modify(40001, 1)
        End If
    End Sub

    Private Sub Button2_Up(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPEN_BTN.MouseUp
        If MainForm.ValveNo = 1 Then
            Modify(40001, -1)
        End If
    End Sub

    Private Sub Button3_Down(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CLOSE_BTN.MouseDown
        If MainForm.ValveNo = 1 Then
            Modify(40001, 4)
        End If
    End Sub

    Private Sub Button3_Up(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CLOSE_BTN.MouseUp
        If MainForm.ValveNo = 1 Then
            Modify(40001, -4)
        End If
    End Sub

Functionally it works fine.
Then, after doing some arbitrary test, by pressing the button many times OPEN, CLOSE, OPEN, CLOSE, ...
At certain point, the program stops and indicates IndexOutOfArrayException.

Please help to advise solution regarding this matter.
Thank you.


Best regards,
Andrew

60
Feature Request / Re: Using Modbus Register Bits in Controls
« on: December 10, 2014, 08:44:27 PM »
Unfortunately the error still appears.
Trying to debug and identifying the location from the Call Stack, in SubscriptionHandler.vb Line 134.
It seems the IF condition doesn't meet so it will directly point to ELSE which is assigning e.ErrorId = -999
It should be correct that e.Values is Nothing and e.Values.Count is 0 when program just started.
So, perhaps need some additional handler here.


Best regards,
Andrew

Pages: 1 2 3 [4] 5 6