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 - Godra

Pages: 1 [2] 3 4 ... 95
16
Open Discussion / Re: ReadUDT Size
« on: December 02, 2023, 03:15:31 PM »
If your SINT[4] is 4 elements then your declaration should be Public STR4(3) As SByte.

See this link: https://kcwebprogrammers.blogspot.com/2011/01/vb-arrays-vs-c-arrays-in-aspnet.html

17
Support Questions / Re: Modbus read to Double
« on: October 30, 2023, 02:01:24 PM »
Maybe add

Code: [Select]
(0)
at the end and also check the following link:

  https://stackoverflow.com/questions/1172306/convert-string-to-double-vb

18
Support Questions / Re: List of tags...
« on: September 30, 2023, 03:47:01 AM »
ScottyP, just so you are aware, there are also AHMI controls that get tag list and could be added to the project:

  https://www.advancedhmi.com/forum/index.php?topic=2850.0


19
Maybe use a separate AHMI control, like a BasicLabel, and point it to that integer tag to get the error code.

20
Also check Reply #15 for suggestions related to AB drivers.

21
This modified control was originally intended for Modbus communication.

If it does not work properly with AB then look at Reply #16 for alternative.

22
Support Questions / Re: Rotational Indicator Counter
« on: August 30, 2023, 06:55:38 PM »
That code looks like somebody was testing certain values.

Maybe try the following code, it has not been tested by me and might need some corrections:

Code: [Select]
    Dim Delta As Integer
    Dim Last_Angle As Integer = 360
    Dim Total_Turns As Single

    Private Sub RotationalIndicator1_ValueChanged(sender As Object, e As EventArgs) Handles RotationalIndicator1.ValueChanged
        Dim Current_Angle As Integer = RotationalIndicator1.Value

        '* Determine Delta (CW or CCW)
        If Current_Angle > 180 AndAlso Last_Angle = 360 Then
            Delta = Last_Angle - Current_Angle
        ElseIf Current_Angle <= 180 AndAlso Last_Angle = 360 Then
            Delta = Current_Angle
        Else
            Delta = Current_Angle - Last_Angle
        End If

        Total_Turns = Total_Turns + ( Delta / 360 )

        RotationalIndicator1.Text = Total_Turns.ToString("0.0")

        If Current_Angle = 0 Then
            Last_Angle = 360
        Else
            Last_Angle = Current_Angle
        End If
    End Sub


23
There is another thing that you could possibly do which is to filter out options by comparing the string "typ" to "MomentarySet" and "SetFalse" in this part of code:

Code: [Select]
        ElseIf e.Button = Windows.Forms.MouseButtons.Right AndAlso Me._itemsPLCAddressClick.Count > 0 Then
            Me.ContextMenuStrip = Me.context

            If Not Me.flagContextSet Then
                If m_QuickAccessOutputType Then
                    Dim names() As String = [Enum].GetNames(GetType(MfgControl.AdvancedHMI.Controls.OutputType))
                    For Each typ As String In names
                        contextSubMenu.DropDownItems.Add(typ, Nothing, AddressOf Me.contextSubMenu_ItemClicked)
                    Next
                    context.Items.Add(contextSubMenu)
                End If

                For Each str As String In Me._itemsPLCAddressClick
                    Dim menuItem = Me.context.Items.Add(str)
                Next
                Me.flagContextSet = True
            End If

It should be something like this:
Code: [Select]
                If m_QuickAccessOutputType Then
                    Dim names() As String = [Enum].GetNames(GetType(MfgControl.AdvancedHMI.Controls.OutputType))
                    For Each typ As String In names
                        If typ = "MomentarySet" OrElse typ = "SetFalse" Then
                            contextSubMenu.DropDownItems.Add(typ, Nothing, AddressOf Me.contextSubMenu_ItemClicked)
                        End If
                    Next
                    context.Items.Add(contextSubMenu)
                End If

If this doesn't work then check the following link for "String.Equals" examples:

   https://stackoverflow.com/questions/900927/comparing-strings-in-vb-net

24
You cannot really remove these options since they are all a part of the built-in "OutputType".

There is only one thing that I can think of - remove or comment out the actions of the options you don't want found here:

Code: [Select]
#Region "Events"

    '****************************
    '* Event - Mouse Down
    '****************************
    Private Sub MomentaryButton_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        MouseIsDown = True
        HoldTimeMet = False

        If e.Button = Windows.Forms.MouseButtons.Left Then
            If (Not String.IsNullOrEmpty(Me.m_PLCAddressClick)) AndAlso m_ComComponent IsNot Nothing Then
                Try
                    Select Case m_OutputType
                        Case MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet
                            m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {"1"})
                            If m_MinimumHoldTime > 0 Then MinHoldTimer.Enabled = True
                            If m_MaximumHoldTime > 0 Then MaxHoldTimer.Enabled = True
                        Case MfgControl.AdvancedHMI.Controls.OutputType.MomentaryReset
                            m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {"0"})
                            If m_MinimumHoldTime > 0 Then MinHoldTimer.Enabled = True
                            If m_MaximumHoldTime > 0 Then MaxHoldTimer.Enabled = True
                        Case MfgControl.AdvancedHMI.Controls.OutputType.SetTrue : m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {"1"})
                        Case MfgControl.AdvancedHMI.Controls.OutputType.SetFalse : m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {"0"})
                        Case MfgControl.AdvancedHMI.Controls.OutputType.Toggle
                            Dim CurrentValue As Boolean
                            CurrentValue = m_ComComponent.Read(m_PLCAddressClick, 1)(0)
                            If CurrentValue Then
                                m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {"0"})
                            Else
                                m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {"1"})
                            End If
                        Case MfgControl.AdvancedHMI.Controls.OutputType.WriteValue
                            m_ComComponent.BeginWrite(m_PLCAddressClick, 1, New String() {m_ValueToWrite})
                    End Select

25
You should download and use the latest beta version of AdvancedHMI to avoid seeing those errors.

Otherwise, look at this post: https://www.advancedhmi.com/forum/index.php?topic=2491.msg15019#msg15019

26
Open Discussion / Re: ModbusTCP display value of partial register.
« on: April 24, 2023, 09:49:57 AM »
Both of you should search the forum to see what info is available on reading bits with Modbus and also what controls can / should be used.

Here are some links:

   https://www.advancedhmi.com/forum/index.php?topic=765.0
   https://www.advancedhmi.com/forum/index.php?topic=2452.0

27
To me, that seems like a correct behavior.

You are really disabling subscriptions and not the connection.
That's why your buttons are still sending the Write requests out while your pilot lamps are not receiving the data.

Maybe you could add some more code to disable/enable those buttons when you disable/enable subscriptions.

28
Besides for Archie's suggestion, there are Modbus Master and Modbus Slave apps that you could use for live testing if you are using Windows based computer:

   https://www.advancedhmi.com/forum/index.php?topic=2567.0

This way you can eliminate either your AdvancedHMI project or your PLC as the cause of your issue.

29
Support Questions / Re: Koyo directlogic 05 addressing
« on: December 17, 2022, 07:19:45 PM »
I would suggest you share the code regardless of whether someone might troubleshoot it now or later.

30
A little bit of self-promotion but relevant to this topic - currently most of my online 3D Model viewers have Animated GIF export.
Since the exported file could get large then you would use https://ezgif.com to manipulate the file to reduce the size and apply other modifications:

   https://githubdragonfly.github.io/

You can see example GIFs in the repository itself:

   https://github.com/GitHubDragonFly/GitHubDragonFly.github.io/tree/main/images

Pages: 1 [2] 3 4 ... 95