Author Topic: Logix & ReadUDT latest AHMI -V3.99y  (Read 1050 times)

micksta

  • Newbie
  • *
  • Posts: 2
    • View Profile
Logix & ReadUDT latest AHMI -V3.99y
« on: June 29, 2018, 01:38:39 AM »
Hi all, as always great work Archie (legend),

Good chance this is a noob issue (bit rusty) apologies in advance. PLC has UDT tag DateTime02 structure/WallClock (all good)

I have the below - WriteUDT (writes no probs.) / ReadUDT I get the following error

'System.IndexOutOfRangeException' on the ReadUDT line. Any help would be appreciated.

Cheers

' -------------------------

Public Class MainForm

'some default .net here
'

    Private Sub btnReadDT_Click(sender As Object, e As EventArgs) Handles btnReadDT.Click

        '*******************************************************************************
        '* Read from UDT Tag in PLC
        '* 29/06/2018
        '*******************************************************************************
        Dim MyUDT01 As DateTimeUDT
        MyUDT01 = EthernetIPforCLXCom1.ReadUDT("DateTime02", GetType(DateTimeUDT))

        'Dim ret As String = EthernetIPforCLXCom1.Read("DateTime02") <--- this works no probs
        'MessageBox.Show(ret)

    End Sub

    Private Sub btnWriteDT_Click(sender As Object, e As EventArgs) Handles btnWriteDT.Click

        '*******************************************************************************
        '* Write to UDT Tag in PLC
        '* 29/06/2018
        '*******************************************************************************
        Dim MyUDT02 As New DateTimeUDT
        MyUDT02.Year = 1111
        MyUDT02.Month = 2
        MyUDT02.Day = 3
        MyUDT02.Hour = 4
        MyUDT02.Minute = 5
        MyUDT02.Second = 6
        MyUDT02.Microseconds = 789

        Dim MyValue As Integer
        MyValue = EthernetIPforCLXCom1.WriteUDT("DateTime02", MyUDT02)

    End Sub
End Class

Public Class DateTimeUDT

    '*******************************************************************************
    '* Testing UDT in PLC
    '* 29/06/2018
    '*******************************************************************************
    Public Year As Integer
    Public Month As Integer
    Public Day As Integer
    Public Hour As Integer
    Public Minute As Integer
    Public Second As Integer
    Public Microseconds As Integer

End Class


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Logix & ReadUDT latest AHMI -V3.99y
« Reply #1 on: July 01, 2018, 07:02:28 PM »
You must have been the first person to try the ReadUDT because there was some left over debugging code that was causing a crash. There is an updated beta version with a fix:

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