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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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. *)IFitfDevice.CheckSupportedCommunicationState(DED.DEVICE_TRANSITION_STATE.RESET)THEN(* with CheckCurrentSupportedCommunicationState() it is possible to check whether the device can be reset right now. *)IFitfDevice.CheckCurrentSupportedCommunicationState(DED.DEVICE_TRANSITION_STATE.RESET)THENIF__QUERYINTERFACE(itfDevice,itfAdapter)THENitfAdapter.IPAddress:=abyIp;END_IF(* reset the device*)itfDevice.SetCommunicationState(DED.DEVICE_TRANSITION_STATE.RESET);
Good luck
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
Has nobody an idea? or is there a different solution in general? I would be really grateful for help
Greetings Kunz
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
Good luck
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
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
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