1 post in this topic

NJ/NX Get IP Address


A Library containing a function Block that can be run on any Omron NJ or NX PLC. The Function Block will retrieve the host PLC's IP address, Subnet Mask, Gateway, and MAC Address. The Port Details are displayed through 2 structures , 1 per-port. In the event you only have 1 Ethernet port then the structure for the 2nd port will contain all 0s. Data Format:

IP Address - USINT[4]

Subnet - USINT[4]

Gateway - USINT[4]

MAC - BYTE[6]  (hex value)

Access the retrieved details by the typical parent-child tag structure. ex. Port_1_Detals.IP_Address[0] will get the first octet of Port 1's IP.

Tested on: NX1P2, NX102, NX502, NX7, and NJ301

IMPORTANT: This Function Block should not be run immediately after startup. Allow the PLC a few seconds to establish a connection with the Ethernet network.


Edited by photovoltaic

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0