Thursday, March 28, 2013

Connecting PLC to PC


Hi all,Since I'm new to PLC  world I will not explain about how PLC work in this article.But I'll publish new articles when I get to know about them more and more.

In this article I will show you how to connect PLC to your computer to read its register values.This tutorial will only work for Xinje XC-6TCA .PLC is mainly use in automation industry due to its reliability and good performances in harsh environments.Ladder logic is use to program PLC.It is easy to understand than any other programming language.


I recommend you to read the manual of the PLC before working with any PLC,because it gives us all the information about functions of it.

There are two ways to communicate with PLC and PC.They are Free communication and MODBUS communication.In this article I will only show you how to communicate with Free communication.

Step -1
Connect PLC to the PC through data cable provided.
If your cable is PS2 to serial DB9 cable,it is unable to connect it directly to    the   your laptop.You have to connect it to the laptop using serial DB9 to USB  cable.

Step -2
There are two ports in PLC. Configurations of port 1 cannot be changed.COM 1 (Port1) is the program port, it can be used to download the program and connect with the other devices. The parameters (baud rate, data bit etc.) of this COM port are fixed, can’t be re-set.


COM 2 (Port2) is communication port, it can be used to download program and connect with the other devices. The parameters (baud rate, data bit etc.) of this COM port can be re-set via software.

I'am going to use port1 to download the program and port2 to read the data from PLC.

Open software,go to Configurations select serial port 2.Note that not to change settings of port1.




Step -3
Change serial port2 settings as following image

set communication mode to User Protocol
Baud rate to 9600
and the others as in the image
Then click Write To Plc

Step -4
Download your program to PLC and run it.

Step -5
Disconnect power and remove the cable from port1,connect it to port2 to read data from PLC according to your program.
Re power PLC to read data from PLC.If you don't have any serial port moniter. microc will help you to show the data comming from PLC.


Step -6
Open microc software ,then open USART monitor,set the values as you set into the PLC.Then click connect.you are done!