Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

ENIP.Get_Attribute_Single

Bastler83
2017-07-24
2017-08-09
  • Bastler83 - 2017-07-24

    Wiedermal brauch ich Hilfe.

    Im Projekt mit WinV3 funktioniert die Verbindung und ich erhalte Daten. Mit dem Raspi hingegen tut es nicht. Ist aber alles gleich. Wieso?
    Code:
    PROGRAM PLC_PRG
    VAR
    getAttributeSingle : ENIP.Get_Attribute_Single; ( fb to get a single attribute from a cip class )
    datareal : ARRAY [0..11] OF REAL;
    END_VAR

    ( this instance call requests the host name (= name of the device in the network) from the WAGO_750_352_FC_ETHERNET device as soon as xExecute gets TRUE )
    getAttributeSingle(
    xExecute:= ,
    itfEtherNetIPDevice:= Powermonitor_500, ( instance of the device (instance is found in the I/O Image of the device) )
    eClass:= ENIP.CIPClass.AssemblyObject, ( cip class which contains the desired attribute )
    dwInstance:= 101, ( value of 0 is class level, range from 1..x is instance level )
    pData:= ADR(datareal), ( data buffer )
    wAttribute:= 3, ( attribute no. 6 of the tcp/ip interface object is the Hostname (CIP Spec. Vol.2 Chapter 5-3.3.2.6))
    xDone=> ,
    xBusy=> ,
    xError=> ,
    eError=> ,);

    Problem.pdf [383.94 KiB]

     
  • eschwellinger

    eschwellinger - 2017-08-08

    Hi,
    ich denke es fehlt einfach beim Aufruf:

    udiDataSize:= SIZEOF(REAL) * 12

    also so:

    ( this instance call requests the host name (= name of the device in the network) from the WAGO_750_352_FC_ETHERNET device as soon as xExecute gets TRUE )
    getAttributeSingle(
    xExecute:= ,
    itfEtherNetIPDevice:= Powermonitor_500, ( instance of the device (instance is found in the I/O Image of the device) )
    eClass:= ENIP.CIPClass.AssemblyObject, ( cip class which contains the desired attribute )
    dwInstance:= 101, ( value of 0 is class level, range from 1..x is instance level )
    pData:= ADR(datareal), ( data buffer )
    wAttribute:= 3, ( attribute no. 6 of the tcp/ip interface object is the Hostname (CIP Spec. Vol.2 Chapter 5-3.3.2.6))
    udiDataSize:= SIZEOF(REAL) * 12, xDone=> ,
    xBusy=> ,
    xError=> ,
    eError=> ,);

    Grüße
    Edwin

     
  • Bastler83 - 2017-08-09

    Vielen Dank. Hat geklappt! Komisch das es in WinV3 ohne "SIZEOF(REAL)*12" funktioniert...

    Gibt es eine Möglichkeit mit Explicit Messaging Wert von einer anderen Steuerung aus dem Codesys zu lesen?

     

Log in to post a comment.