Sign in to follow this  
Followers 0
sandeep424

Serial Communication

7 posts in this topic

Hello I am doing a project related to Allen Bradley PLC and SCadaPack LP PLC's. Our team has developed a device(i.e. written a code and implemented it on a FPGA Board) which does some work for PLC. Now we need to connect this board to the PLC and establish a Serial Communication using RS-232 port. I am very new to the concepts of PLC's and after a long study of many papers and manuals related to PLC's, I understood that ScadaPack PLC'c have two RS-232 ports COM2, COM3 which i can used to connect to the device and communicate with. And in Allen Bradley PLC's, there's a channel 0 RS-232 port which can be connected. Is this information right?. And from manuals I came to know that these ports follow ModBus RTU mode serial protocol for communication, is this also right information?. The ScadaPack PLC uses Telepace software to configure these ports and iFix software as an interface to the working of the PLC , my doubt with this when i connect my device to the PLC does the iFix software automotically detect my device or do i need to do soem changes or configuration part in Telepace software, Can anyone please help me with this or provide any documents which can clear my doubts? The Allen Bradley PLC uses RS logix 500 software for interface part. Does this software also directly detecs my device when i connect it to the PLC or do I need to do some changes in it. Can anyone Please help me with this. -Sandeep

Share this post


Link to post
Share on other sites
Allen Bradley serial port utliizes their DF1 serial protocol. Scadapack serial ports use modbus rtu serial protocol. Telepace is a ladder programming package for Scadapack units made by control microsystems. You do not state which Allen Bradley plc you are using. I assume one of the RSlogix (5,500 or 5000) packages will work to program it. If you have an ifix software package, it runs a driver to get data from the plc. If it is connected to a serial port on the Scadpack, I would assume the ifix MBR driver (serial modbus rtu) is being used. In order for you to connect any device to a serial connection on the Allen Bradley, Scadapack or ifix workstation, it will have to talk the specific protocol native to that device. And either you device or the plc will need to be programmed to transfer data.

Share this post


Link to post
Share on other sites
Thank you Rod for your reply.yes, we are using the RSlogix 5000 package series to work with Allen Bradley PLC. Thanks for conforming my questions. Do you or anyone have a ladder logic (for SCadaPack PLC) example of how to make changes in the plc so that it sends data to my FPGA device. (or) any of the RSlogic example(for Allen Bradley PLC) of how should i add some elements in the PLC ladder program so that it starts detecting my device and sends data. Our team is trying to use SCaDApack PLC, so we need to do some changes in Telepace i.e.know how does the ifix MBR driver works, sends data, handles data and do some changes. Actually my FPGA device should receive the data which the PLC sends to modem and then the output which my device gives to the PLC should then be sent to the modem. I hope you understand my question - simply saying the PLC should first send data to my device then my device should do some task and send back the data to the PLC and then the PLC should send that data to the modem. Could anyone please help me in this matter. Thanking You -Sandeep

Share this post


Link to post
Share on other sites
It is far easier to make the connection between embedded CPU's and PLC's or CPU's and FPGA's. Trying to go directly from FPGA to PLC is going to be tricky to do. Regardless of the PLC, there are essentially 3 ways to communicate with it: 1. Use one of the native protocols that the PLC supports (Modbus/RTU, DF-1, DeviceNet, etc.). 2. Use a discrete I/O card and communicate via single bits. 3. Use a serial port and use the ASCII commands that the PLC supports to talk via a serial port. Issues with #1: Most of the protocols are fairly complex. The exception is Modbus/RTU. Either way, you are probably best off searching for IP (intelluctual property) which supports the protocol you are interested in and using it as "canned" FPGA code, if it exists. There are also sometimes generic "boards" that you can mount your circuitry to. For instance, Allen Bradley sells 1799 series embedded I/O which is specifically intended to make it easy for you to interface to their PLC's via DeviceNet. Gridconnect.com sells the Ethernet/IP Intelligent RJ45/Chip which is a chip with an on board embedded microprocessor complete with the code necessary to run the Ethernet/IP protocol. Issues with #2: PLC's are designed to interface to industrial I/O standards. This means that they typically expect 24 VDC, 120 VAC, 230 VAC, or sometimes 5 VDC. FPGA's these days typically expect 3 VDC. So expect to do some sort of level shifting to be able to interface. Issues with #3: This is fairly easy to accomplish and often the simplest to be able to support. However again with an FPGA unless you have a "CPU in silicon" or a built-in auxiliary CPU on the chip, interfacing to an RS-232 port is often not exactly easy either. This tends to look like the issues with #1 above. In this case you use the "ASCII" commands in the PLC to read and write strings to a serial port.

Share this post


Link to post
Share on other sites
Thank You very much for your reply. The ScadaPack LP PLC to which i have to connect follows Modbus - RTU protocol for serial communication. It uses Telepace Ladder Logic Editor to configure the ports and communications, and also handles the program to talk with it slave PLC's with the help of ladder logic program written for slave devices which follows poll type of communication i.e. whenever the data stored in the registers of Master PLCs changes, the Master station acts according to the changes and polls the slave PLC's. But now, i am confused with (1) what changes should i do in the ladder logic program so that it communicates with my FPGA device (2) the Telepace software configuration settings should be changed to detect my FPGA and send it data. The default configuration of the serial port is the one which i require, so is that when i connect my FPGA device does the PLC automotically detect my device or should I configure the serial port again to the required parameters. (3) what are the ASCII commands which the PLC follows i.e. with which the PLC polls the slaves. These commands will tell me how to write the code to handle the data when it sends to my FPGA device. Can you please help me with any suggestions, examples or papers from i can understand more.Please Help me. -Sandeep Edited by sandeep424

Share this post


Link to post
Share on other sites
An FPGA doesn't even have a serial port per se unless you write code in it to receive and interpret serial data. And that's assuming you develop the appropriate glue logic (hardware) to achieve the required electrical specifications... http://www.fpga4fun.com/SerialInterface.html There are extra pins that can do other things but the salient point is that you can send and/or receive data based on a pattern of positive and negative pulses relative to a common ground. There is not a built in "recognition" or handshaking system for recognizing that a device is connected as such. RS-232 was originally developed decades ago for connecting a modem to a teletype terminal (sort of a printer). It was intended as a semi-permanent connection. The features that you see and take for granted today with interfaces like USB were not even thought of when RS-232 was developed. If you really want to do it and you've gotten this far, then the PLC side is not nearly as bad since it already has a serial port. On the PLC side of things it already has a serial port. At least with AB PLC's (you posted on an AB forum). All AB PLC's support 2 or more protocols via their serial ports. The Micrologix PLC's are somewhat unique in that they support Modbus (master or slave). Other PLC's can do it but only as a consequence of writing code using the raw ASCII port commands to do it. All of them support DF-1 which is a serial protocol used for inter-PLC communication using the MSG command. It's a little more complex than Modbus but not much. Here is the published manual: http://literature.rockwellautomation.com/i...rm516_-en-p.pdf There are some additional command codes that are unpublished. In addition, there are two additional published codes that are specific to the Logix platform for supporting the long tag names that it supports but I can't recall where to find this information. Suffice to say that it isn't much different from the basic protocol. Finally, they can handle a raw serial port. There are a number of commands that allow you to parse or produce ASCII strings such as ACI, ACN, AIC, etc. There are also commands for writing to the serial port (AWT, AWA) and commands to read data (ARD, ARL). Doing serial port programming on a PLC is nothing like doing it with a PC. They are not really optimized for doing string manipulation. Ladder logic is optimized for bit operations and more or less parallel operations, when what you need will be sequential code and string operations. It's not impossible to do it, just ugly and difficult. I suggest that you look through the sample code database on AB's site for examples. If you are looking at Logix 5000, a good example is the code in the database that implements Modbus/RTU. That alone should give you an idea of what serial port code looks like.

Share this post


Link to post
Share on other sites
If you want to use the Scadapack unit as a Modbus Master you will need to get a copy of telepace software from control microsystems. It uses standard ladder with master function block that you program to control the modbus communication. It is fairly simple and straight forward. Your device must support Modbus slave functions. The other alternative would be as pauleng states above.

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