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

Generic Device Parameter

kunz
2018-07-03
2018-07-11
  • kunz - 2018-07-03

    Hello, everybody,

    I have a problem with an Ethernet/IP Master. In this case I would like to make the Target IP address of the Ethernet/IP Slave dynamically changeable. So save the IP address in a persistent variable and enter it as the Target IP address at program start.

    I have seen that there is the variable as shown in the picture under the Generic Device Parameters of the Ethernet/IP Master. However, I don't know how to specify a variable under the value. Is it possible here don't have to enter the value manually instead of using a variable that can also be changed in the visualization?

    Thank you very much for your help in advance.

    Greeting Kunz

    IMG: target_ip2.JPG

     
  • kunz - 2018-07-05

    Has nobody an idea? or is there a different solution in general? I would be really grateful for help

    Greetings Kunz

     
  • Thomas - 2018-07-06

    Dear Kunz,

    the basis is this example: https://store.codesys.com/caa-device-di ... ample.html

    In the method DeviceController\Reset I pass the desired IP address.

    Var
    itfAdapter : IoDrvEthernetIP.IRemoteAdapter2;
    abyIp : ARRAY [0..3] OF BYTE := [192,168,99,140];
    end_var

    IF itfDevice <> 0 THEN

    (* with CheckSupportedCommunicationState() it is possible to check whether the requested state can be performed in general. *)
    IF itfDevice.CheckSupportedCommunicationState(DED.DEVICE_TRANSITION_STATE.RESET) THEN
    
        (* with CheckCurrentSupportedCommunicationState() it is possible to check whether the device can be reset right now. *)
        IF itfDevice.CheckCurrentSupportedCommunicationState(DED.DEVICE_TRANSITION_STATE.RESET) THEN
            IF __QUERYINTERFACE(itfDevice, itfAdapter) THEN
                itfAdapter.IPAddress := abyIp;
            END_IF
            (* reset the device*)
            itfDevice.SetCommunicationState(DED.DEVICE_TRANSITION_STATE.RESET);
    

    Good luck

    IMG: EthernetIP.png

     
  • kunz - 2018-07-10

    Hello,

    thank you very much that helped me a lot. However, I cannot apply the solution to another problem. I would also like to dynamically adjust the station name of a PROFINET device. However, here the library looks different and I don't know the procedure. Is there a solution to this problem?

    Greeting Kunz

     
  • eschwellinger

    eschwellinger - 2018-07-10

    Hi,
    your plc is profinet device?
    The PN Controller should give the IP and device name.. so I think this should not be needed to do.
    BR
    Edwin

     
  • kunz - 2018-07-11

    Hello, yes, normally. But in this case the controller cannot configure the device because no development environment such as Codesys is available. In other words, the controller is always looking for the same device. Thus it comes to this problem to adjust the station name of the device dynamically. Is there a possibility here? Greetings Kunz

     

Log in to post a comment.