[Tutor] PLC communication with python?

Kent Johnson kent37 at tds.net
Wed Mar 8 11:49:00 CET 2006


Jeff Peery wrote:
> Hello, I would like to write a python script that communicates with a 
> PLC (programmable logic controller) as well as instruments like calipers 
> and things. I'm completely in the dark here and not sure where to start 
> reading and learning. could someone point me in the right direction for 
> learning this stuff? thanks!

How does the equipment connect to the computer? If it connects to the 
serial port then try pyserial:
http://pyserial.sourceforge.net/

If it connects to the parallel port there is
http://pyserial.sourceforge.net/pyparallel.html

or for Windows there is winioport:
http://www.geocities.com/dinceraydin/python/indexeng.html

So the first step is to find out what kind(s) of interface you are 
using, and collect software that allows Python to talk to that 
interface. Then try some really simple tests - reading a single value or 
setting a simple setting on the instrument. From there you can build a 
library of functions that do interesting things and build your programs 
on that.

Kent



More information about the Tutor mailing list