Author Topic: Forcing an IP address  (Read 13617 times)

Lorne Van Dusen

  • Jr. Member
  • Posts: 93
  • I'm a old guy
    • View Profile
Forcing an IP address
« on: November 27, 2017, 01:54:08 PM »
I have a question about forcing an IP address into the PLC without having to re boot the PLC
I understand the concept of setting the IP address to 0.0.0.0 to allow the PLC to accept an IP address from the router.
This all works fine so the print #4 command actually places the IP address into H$ example 192.168.0.133 and also sets a relay IP_READY
 
However if the router is not present I want the PLC to accept the address as 192.168.1.15:9080
So inside the program I am using a timer that will turn on after 2 minutes if the IP address does not change from 0.0.0.0
it calls a function that first loads  checks to see if H$ is empty
Then I use DM[800] = 192 DM[801] = 168 DM[802] = 1 DM[803]= 15 AND DM[804] = 908
Then I load that into H$ so far everything works out OK
However even in the manual it says that you need to reboot the PLC
So my actual question is how is it that the router can change the IP address without having to reboot but the program can't. Is there any command I can use that would emulate the signal that the router would send to the PLC to change the IP address?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Forcing an IP address
« Reply #1 on: November 27, 2017, 08:54:08 PM »
Network routers have a different design purpose in that it is their job to look out for new connection and to assign IP address.

The PLC fimware initializes the Ethernet parameters during startup and most often the PLC is assigned a fixed IP address during the initialization so that will be the parameter it uses. If the fixed IP address has changed then it require a reboot in order to re-initialize the Ethernet port.

The PLC firmware does not want to spend precious CPU time to periodically check to see if it has if the IP address has changed in order to re-initialize the Ethernet port.

In many applications the PLC may not even be connecting the Ethernet port to the network, hence it is by design that the PLC only check for DHCP IP address (if IP address is set to 0.0.0.0 for Fx based PLC only) during boot up and if it doesn't find an address it assume that there is no network connection or no DHCP server and thus would ignore the Ethernet port.

Email: support@triplc.com
Tel: 1-877-TRI-PLCS