Can I periodically ping a PC then view in PLC?

Bookmarked. If there's an issue with an embedded PC alongside a PLC, this would be an interesting way to automate determining whether to reboot the PC, and possibly do so.
 
Ok, here's what you would do:

Install Python 2.7.13 https://www.python.org/
Download pylogix https://github.com/dmroeder/pylogix
Create a new python file(.py)(if you need help with that, let me know)
Save the following code in the file (save it in the same directory as pylogix):

Code:
from eip import PLC
import time

with PLC() as comm:
    comm.IPAddress = '192.168.1.20'
    while True:
        comm.Write('BaseDINT', 1)
        time.sleep(0.5)
        comm.Write('BaseDINT', 0)
        time.sleep(0.5)
You'll have to replace the IP address that I had with your PLC's address. Replace 'BaseDINT' with the tag name that you want to write to. If you want to adjust the interval to write, change the value in time.sleep(). It is in seconds, so the example above is 1/2 second.

Keep in mind, there is probably a lot that can be done to improve here, just starting off simple.

Brilliant, I'll give it a try. FYI python is as yet an unexplored world to me, so I'm going to have to do some reading up - any other tips you think might be useful for a total noob are much appreciated!

I'm assuming that the code you copied and pasted just calls a much more complex code (pylogix)?

How does it handle the difference between, say, a 5370 CompactLogix with onboard ethernet, vs a Control Logix via an EN2T, vs an old Compact Logix L35E which had an ethernet "daughtercard"?
 
Brilliant, I'll give it a try. FYI python is as yet an unexplored world to me, so I'm going to have to do some reading up - any other tips you think might be useful for a total noob are much appreciated!

I'm assuming that the code you copied and pasted just calls a much more complex code (pylogix)?

How does it handle the difference between, say, a 5370 CompactLogix with onboard ethernet, vs a Control Logix via an EN2T, vs an old Compact Logix L35E which had an ethernet "daughtercard"?

So yes, pylogix manages writing to the controller, which is called via "comm.Write()"

It doesn't really care what logix device is at the address with the exception of a control logix controller that is in a slot other than zero. If you had a controller in another slot, you can specify that with comm.ProcessorSlot = 2 (if for slot 2). Otherwise, it shouldn't care what logix controller you are talking to.

If you want to talk more python, PM me you email address, that is usually easier.
 

Similar Topics

I have an 1100 that I am using mainly as a protocol converter. It Talks Modbus RTU on channel 0 and is connected to a large management system on...
Replies
4
Views
8,263
Hi Any one know how i can clear this fault? Cpu run led turn on for a second then red fault led turn on for a second then cpu restart and all...
Replies
11
Views
4,458
I have a CLX messaging to both CLX's and SLC's. I have discovered that the Read messages originating in the CLX stop reading about every 60...
Replies
12
Views
5,213
Hi, I am new to ladder logic. I have completed a code in the Xinje PLC XC3-32RT-E for one of the machines I am developing. Currently the program...
Replies
14
Views
197
Hey guys, the scenario is: I have already completed the drawing package for my system utilizing an A-B 440R-N23126 (Minotaur) safety relay. SoS...
Replies
0
Views
104
Back
Top Bottom