Get Ethernet/IP slave generic parameters

asivakov
2021-09-15
2021-09-20
  • asivakov - 2021-09-15

    I have several EDS files and use'em in project.
    Now I want to recognize node using their Generic Parameters to assign correspond IP-addresses.
    For example:

    Node := Scanner.FirstChildNode;
    FOR node_index := 0 TO Scanner.ChildNodeCount-1 DO
        Node := Node.NextSiblingNode;
        RemoteAdapter_diag := Node;
    
        vendor_code := get_vendor_code(RemoteAdapter_diag);
    
        if vendor_code = eds1_vendor_code then
            RemoteAdapter_diag.IPAddress := eds1_IP;
        elsif vendor_code = eds2_vendor_code then
            RemoteAdapter_diag.IPAddress := eds2_IP;
        end_if
    end_for
    

    So the question: anybody know how to get this "Device Generic Parameters" in program?

     

    Last edit: asivakov 2021-09-15
  • i-campbell

    i-campbell - 2021-09-15
    VAR
        pParam: POINTER TO IoConfigParameter;
        pVendor: POINTER TO DWORD;
        Vendor: DWORD;
    END_VAR
    pParam := ConfigGetParameter(RemoteAdapter_diag.Connector,512);
    IF pParam <> 0 AND pParam <> RTS_INVALID_HANDLE THEN
        pVendor := pParam^.dwValue;
        IF pVendor <> 0 AND pVendor <> RTS_INVALID_HANDLE THEN
            Vendor := pVendor^;
        END_IF
    END_IF
    

    You can get the parameter ID 512, by exporting the adapter to PLCopenXML

     
    πŸ‘
    1

    Last edit: i-campbell 2021-09-15
    • asivakov - 2021-09-20

      Thanks,
      It works, and I got other parameters ID within XML =)

       
      πŸ‘
      1

      Last edit: asivakov 2021-09-20

Log in to post a comment.