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

Pages: [1]
1
Open Discussion / Re: Micrologix 1400: Read multiples tags
« on: May 17, 2019, 12:49:31 PM »
Great contribution bachphi, regards!

2
Open Discussion / Re: Micrologix 1400: Read multiples tags
« on: May 16, 2019, 07:22:18 AM »
is weird, if i use:

MyEthernetIPforSLCMicroCom.Read("N150:10")

that works fine, return the value... but i cant do the Subscription

3
Open Discussion / Re: Micrologix 1400: Read multiples tags
« on: May 15, 2019, 10:31:15 AM »
like i said i am a beginner and may be my question is silly, but: the tag that i am setting on the first parameter of the Subscription method is the next:



i dont know if "data file" and "tag" is the same.

4
Open Discussion / Re: Micrologix 1400: Read multiples tags
« on: May 15, 2019, 09:01:10 AM »
i tried this, as the link suggest:

Code: [Select]

  Private MyEthernetIPforSLCMicroCom As AdvancedHMIDrivers.EthernetIPforSLCMicroCom = New AdvancedHMIDrivers.EthernetIPforSLCMicroCom
    Private SubscriptionID As Integer
    Private LastValue As String

    Public Sub New()
        InitializeComponent()
        MyEthernetIPforSLCMicroCom.IPAddress = "10.0.0.39"
    End Sub

    Private Sub fm_sis_opc_test_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MyEthernetIPforSLCMicroCom.Subscribe("N150:10", 1, 500, AddressOf DataReturned)
    End Sub

    Private Sub DataReturned(ByVal sender As Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs)
        Dim PlcIp As String
        Dim PlcTag As String
        Dim PlcValue As String
        Try
            Dim DriverComm As AdvancedHMIDrivers.EthernetIPforSLCMicroCom = CType(sender, AdvancedHMIDrivers.EthernetIPforSLCMicroCom)
            PlcIp = DriverComm.IPAddress
            PlcTag = e.PlcAddress
            PlcValue = e.Values(0).ToString()
            lb_estado.Text = PlcValue.ToString
        Catch ex As Exception
            lb_estado.Text = ex.Message
        End Try

    End Sub
    Private Sub MainFormX_FormClosing(sender As Object, e As Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        MyEthernetIPforSLCMicroCom.UnSubscribe(SubscriptionID)
    End Sub


but i don't receive nothing (DataReturned is never called).
Somethink strange is that if i use the EthernetIPforCLXCom driver, DataReturned is called but returns the error 5.

5
Open Discussion / Re: Micrologix 1400: Read multiples tags
« on: May 14, 2019, 05:57:19 PM »
Thanks Godra. I will try it.
I am beginner on Advanced HMI and my project dont use controls from it. But anywhere i will try it.
I work actually on runtime.
Attach the code that i am using for now:


Code: [Select]

Private MicroGuardian As AdvancedHMIDrivers.EthernetIPforSLCMicroCom = New AdvancedHMIDrivers.EthernetIPforSLCMicroCom
    Private MicroTags As AdvancedHMIDrivers.EthernetIPforSLCMicroCom = New AdvancedHMIDrivers.EthernetIPforSLCMicroCom

Sub CapturarDatos()

        Dim conexion As New CConexion
        Dim datos As New CDatos

        Dim ComandoSQL As String = ""
        Dim Valores As String = ""
        For Each row As DataRow In tb_det.Rows
            If row.Item("habilitado") = True Then
                Dim Valortag As String = MicroTags.Read(row.Item("tag"))
                If Valores = "" Then
                    Valores = "'" & Valortag & "'"
                Else
                    Valores = Valores & ", '" & Valortag & "'"
                End If
            End If
        Next

        ComandoSQL = "INSERT INTO " & ObjetoDB & " (" & Columnas & ") values (" & Valores & ")"
        datos.ComandoSQL_opc = ComandoSQL
        datos.cadena_siscon = CadenaDB
        Dim resultado As Boolean = conexion.sis_opc_RegistroSQL(datos)

    End Sub



6
Open Discussion / Micrologix 1400: Read multiples tags
« on: May 14, 2019, 11:03:12 AM »
Hi. Firstly thanks for your time. I am working on a proyect of vb.net 2015 that needs to read 10 tags from my PLC Micrologix 1400  every 500ms. I tryed make it using a recursive structure on vb with the method ".read"  of EthernetIPforSLCMicroCom, but that is so slow and has lost records.



I would gratifully that someone showme an example to read multiples tags from the plc, or another suggest.

Best regards.

Pages: [1]