Get IP address of compactlogix programmatically

Paul_Pereira

Member
Join Date
Jan 2023
Location
Amsterdam
Posts
51
Hi Guys,

I'm trying to get the IP address of my L33ER Compactlogix to show up on my PV+ 600. I know about answer 26779 and have tried it but I think this solution does not work with the L33ER. Is there another way of getting the IP address from the controller, perhaps similar to how we use GSV to get the ProductRev or wallclock time of the controller?
 
Hi Guys,

I'm trying to get the IP address of my L33ER Compactlogix to show up on my PV+ 600. I know about answer 26779 and have tried it but I think this solution does not work with the L33ER. Is there another way of getting the IP address from the controller, perhaps similar to how we use GSV to get the ProductRev or wallclock time of the controller?

You will need to set up a message to GetAttributeSingle from CIP class 0xF5, instance 1, attribute 5. The first DWORD (DINT) returned is the IP address and each byte within represents an octet of the address.

You could COP the returned value into an array of SINT[4] and then extract and condition each into a DINT, then use the DTOS and CONCAT functions to build the textual form.

Because the L33 doesn’t work with USINT, you’ll need to test each SINT in the array for being negative and add an offset when assigning to the DINT.

Here’s an example of the straightforward USINT conversion:
https://github.com/JeremyMedders/LogixLibraries/blob/main/src/Numeric/Num_IPv4toStr_AOI.L5X
 
Last edited:
You will need to set up a message to GetAttributeSingle from CIP class 0xF5, instance 1, attribute 5. The first DWORD (DINT) returned is the IP address and each byte within represents an octet of the address.

You could COP the returned value into an array of SINT[4] and then extract and condition each into a DINT, then use the DTOS and CONCAT functions to build the textual form.

Because the L33 doesn’t work with USINT, you’ll need to test each SINT in the array for being negative and add an offset when assigning to the DINT.

Here’s an example of the straightforward USINT conversion:
https://github.com/JeremyMedders/LogixLibraries/blob/main/src/Numeric/Num_IPv4toStr_AOI.L5X
Perhaps I wasn't clear. I already know about and have tried answer 26779 which is exactly what you are also trying to say. It does not work for the compactlogix L33ER. It will just return 16#00 for each octet. Is there another way?
 
Paul, what is "Answer 26779"? is this another post? Can you post the link for the post?
Can you also show a screenshot of your program?
 
Last edited:
The message indicates an error status, so you won't be seeing anything else but zeros where there should be payload data.

Can you screenshot the Message config?
 
A screenshot of your MSG configuration might be more helpful than one of the logic calling it.

Based on your screenshot the MSG is not 'returning' 16#00 -- it is erroring out rather than completing. Check what the error message is.

EDIT: 'Connection failure' suggests that your communication path is not set correctly.
 
Thanks guys it finally worked. It was not hitting the right slot. My problem now is this. I managed to DTOS to 4 separate strings, namely "192" "168" "10" and "2". However I am not sure how to concat them with a dot in between the 4 strings. If I concat directly I get 192168102. But I need to see the dots in between.
 
I've used a MSG instruction in an L33ER before and it worked. The screenshot in post 7 matches what I have. On the communication tab of the MSG configuration, click "Browse..." and drill down to the 1769-L33ER below the Ethernet node and click OK. When you "Apply" the change in the communication tab, it will change the path to "THIS". You should get a result that you can then parse out.

GSV_IPAddress.JPG
 
Last edited:

Similar Topics

I have my PLC and HMI connected to my local network over DHCP just like my laptop. I can upload and download including VNC to the HMI over wifi...
Replies
2
Views
1,137
I'm trying to configure the IP address of my compactlogix l16er-bb1b in Studio 5000. I need to set it to a certain address as I'm planning on...
Replies
5
Views
3,208
Hi, I have a compactlogix 5069-L330ERM processor, which has 2 built in ethernet ports. Both are currently configured and was completed using...
Replies
20
Views
8,899
We have some vendor supplied machinery that runs on a CompactLogix 5370 (1769-L24ER-EBFC1B, FW rev. 28.011) that wasn't communicating with the...
Replies
6
Views
2,918
Hello everyone, we want to change IP address for used compactlogix L23E-QB1B controller ,it assigned a IP address before, but this IP address is...
Replies
14
Views
2,792
Back
Top Bottom