AsEthIp and change of IP using DHCP

Hi Community,

I have a customer that uses AsEthIp on a X20CP0484 together with a Rockwell PLC.
When the IP of the ETH port changes the Ethernet IP communication stops working and a reboot of the X20CP0484 needs to be done (no reboot of rockwell PLC needed).

Does anyone know if the AsEthIp library supports changing of IP in runtime?
My guess would be that it needs to call EIPExit() and EIPInit() again which as i understand can only be done in PROGRAM_EXIT and PROGRAM_INIT - but that is only a guess from my side :slight_smile:

Kind regards,
Mads Cornelius Andersen

Hi Mads,

this will not work as the AsEthIP library uses a dataobject where its information is stored. Part of this is the “ownip”:
“#OWNIP=192.168.180.1”

This means if the IP of the ETH interface changes you would need to modify this dataobject and then call the EIPinit fbk again but this needs to be done in the InitUp

Hi Mads,

I have been working on AsEthIP for some time and I would say with some extra programming, you can make it work.

You can use EIPExit() and EIPInit() to release the resource and re-assign new resource. Remember to transfer and log the EIPInit.handle which points to the resource that is used by the Ethernet/IP driver. Also, before running EIPExit(), turn off EIPCyclic(), otherwise the PLC will reboot to service mode because EIPCyclic() doesn’t have the resource anymore.

Regarding the Data Object that you need to do the initialization, you need to use DatObj library to create / modify the DO in runtime. Remember that the DO uses ASCII to store the characters so you need to do string to character conversion and encode it as ASCII.

I have done the DO part and I have a different task on the AsEthIP part. However using EIPExit() and EIPInit() seems to be not causing me trouble.

1 Like

Thank you @c583869 !

I did manipulate the data object a long time ago but I was not aware that EIPExit and EIPInit can be used in the cyclic program :slight_smile: . I will give this a try and thank you for the help !

Well… the EIPInit and Exit should only be used in the Init up or Exit up (mentioned in the help) as otherwise you can easily run into cycle time violations. Please keep this in mind

Maybe you are right but it is worth a try - theoretically it sounds ok i think

If you run the FBs in a task with a lot of Tolerance you should avoid cycle time violations :slight_smile:

1 Like