# AB PLC to PC (serial) communication

S

RSlater
RSmike

D

#### Dan Baker

You can use DF1 protocol to send data to a PLC5 without user mode. Just send a Typed Write to a string element (i.e. ST21:0), and let your ladder logic program take some action based on the string
that it receives. If you have Linux and Perl, you can use my PLC.pm perl module available here or at ftp://
metalab.unc.edu/pub/Linux/libs/PLC-0.1.0.tar.gz
See the example programs, but it's pretty easy.

Dan

S

#### Sam

Dan,
Thanks for you reply. I am not sure what do u mean by type write? U mean use a MSG write instruction instead of ASCII write? but I thought MSG write/read is for to exchange data between PLC's and not between a PLC and a PC. Correct me on this if I am wrong. Oh...by the way I got ascii write working yesterday. I can able sent data from PLC to the PC. Now PC to the PLC is the problem. for ascii write ch0 doesn't have to be in user mode, it can be in point to point...but for ascii read ch0 must be in user mode. That's why I am having problem with ascii read. I don't quite understand about the perl example part of ur mail. If you don't mind explaining that to me in detail. Thank You.

-Ram

D

#### Dan Baker

Well, I'm not sure this is what you're looking for, but a Typed Write command is sent from the computer to the PLC via port 0 or one of the other ports (DH+,Ethernet,etc) in order to write data directly into a PLC data element. No ladder logic (MSG,etc) is required, and the port doesn't need to be in user mode. If you are using Windows, my program probably wouldn't help (without modification and testing) because I have only used it with Linux. But if you have Linux and perl, your perl program would use my PLC.pm module to send data directly to a PLC data element (N7:0, ST11:2, etc) and your PLC ladder logic would take the data and do something with it. So for example, your program could use:
PLC:LCcommand('PLCNAME',0x0F,0x67,'ST11:0',1,'This String goes to the PLC');
to send the above string to ST11:0.
the 0x0F and 0x67 above specify the Allen-Bradley PLC5 Typed Write Command, which is command F-67.
The serial port, baud rate, etc that you are using would be specified in the configuration file entry for 'PLCNAME'.
If you are using windows, you would need similar PLC communication software, such as the 'Full' version of RSLINX, to do it this way.
Unfortunately, I don't think RSLINX LITE can be used with Visual Basic or other user programs.
There might be a free PLC communications program for windows. You could do a search for DF1 and windows (DF1 is the name of the data protocol).
http://www.ab.com/manuals/cn/17706516.pdf

N

#### nasir

Well, I'm not sure this is what you're looking for, but a Typed Write command is sent from the computer to the PLC via port 0 or one of the other ports (DH+,Ethernet,etc) in order to write data directly into a PLC data element. No ladder logic (MSG,etc) is required, and the port doesn't need to be in user mode. If you are using Windows, my program probably wouldn't help (without modification and testing) because I have only used it with Linux. But if you have Linux and perl, your perl program would use my PLC.pm module to send data directly to a PLC data element (N7:0, ST11:2, etc) and your PLC ladder logic would take the data and do something with it. So for example, your program could use:
PLC:LCcommand('PLCNAME',0x0F,0x67,'ST11:0',1,'This String goes to the PLC');
to send the above string to ST11:0.
the 0x0F and 0x67 above specify the Allen-Bradley PLC5 Typed Write Command, which is command F-67.
The serial port, baud rate, etc that you are using would be specified in the configuration file entry for 'PLCNAME'.
If you are using windows, you would need similar PLC communication software, such as the 'Full' version of RSLINX, to do it this way.
Unfortunately, I don't think RSLINX LITE can be used with Visual Basic or other user programs.
There might be a free PLC communications program for windows. You could do a search for DF1 and windows (DF1 is the name of the data protocol).
http://www.ab.com/manuals/cn/17706516.pdf

J

#### Jeff Groves

Check Ebay, sometimes you can find KT cards on there for a reasonable price.

Jeff

A

#### Anonymous

An easier solution may be to download a trial version of an opc server such as KepServer or
RSLinx. I suggest the KepServer "http://www.kepserver.com":http://www.kepserver.com . The download also includes VB examples on how to communicate with a PLC. Since you have vb and can download the examples you should be able to set up communications with the PLC 5. This would also represent a more real world example of how to communicate with a PLC. Most people don't write their own serial comm based driver applications to read and write data to a plc. Also check out
"http://www.opcfoundation.com":http://www.opcfoundation.com for some useful info. Good Luck.