Can I enable DHCP or change my HMI’s IP address with systems tags?

Can I enable DHCP or change my HMI’s IP address with systems tags?
none 0.0 0
  • HMI Model: cmt3072x

Is there a way to be able to set a fixed IP address or change it to acquire it automatically without the need to access the HMI’s internal settings.

The reason is a need a fixed IP to be able to access a web configurator and once the set up is finished to change the IP settings to dynamic or automatic so the HMI can connect to the Internet and be able to access the HMI using easy access and pull data out of it.
Is this something that can be done using a macro ?

Thanks

Hi @gary14,

You could use system tag LW-10812 to turn on DHCP for LAN1, which will obtain an IP address automatically when a value of “1” is entered, or you could do the same for LAN2 with LW-10813.

Cody.

This is great ! my last question is when DHCP is disabled is it possible to write a specific static IP ? or for this I do need to access the HMI settings ?

You can statically assign an IP address to LAN1 with the system tags below. Each tag represents an IP address octet.:

After entering the IP address, use the system tag below to update the address:

For LAN2:

Cody,

Thanks for the sharing the info I will work on my program to get it working like intended.

Thanks !!

No problem. Happy to help!

Cody I tried to write some short macros , one to set the fixed IP address and the other one to trigger the DHCP on. But i am unable to make it work , ive put screenshot of both macros.

Also, what is the best way to display and IP i was trying to use a numeric display but was unsuccessful

Thanks

Hi @gary14,

It looks like you are attempting to set the whole IP address into the system register reserved for only the first octet of the address.

You must enter the values of the four IP address octets into their respective registers.

LW-9129 (first octet) = 192
LW-9130 (second octet) = 168
LW-9131 (third octet) = 1
LW-9132 (fourth octet) = 25

Also, the subnet mask must already be configured for the LAN port. You can do this manually or with the system tags below.

Cody,

No wonder it wasn’t working, I fixed my macro for the Fixed IP and it works now !
It set the IP and the subnet and I am able to access the web configurator through the browser, the only issue I am having is the DCHP now I use another macro to set it to dynamic but no response. I am turning 12094( TO REFRESH IP) off after I set the fixed IP and turn it back on after I turn the DHCP on. Do i need to leave this bit on or should i be toggle it like i am doing to be able to change between both.

Also here is the DHCP macro

Let me know what you think.

System tag LB-12094 is not required after turning on DHCP with LW-10812. You could remove the delay and LB-12094 SetData function.

Cody,

That did it ! I just needed to add a command to set bit 10812 (dchp) to 0 on the static IP macro , otherwise it only worked the first time.

Thanks for all the help !!

Hi @gary14,

Thanks for the update! I’m glad everything is now working as intended.