Codesys

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

CATALOG

Introduction
Chapter 1 - How to set up a project
o I. System configuration
o II. Create a new project
o III. Cofigure communications
o IV. How to set up a fixed IP addressBack to homepage
INTRODUCTION
CHAPTER 1 - HOW TO SET UP A PROJECT
I. System configuration
O.S.: Windows 7 Enterprise Edition
Programming tool: ABB PS502 (Codesys 3.2)
PLC-CPU: PM590 v1.2
PLC-DI: DI524
PLC-DI/DO: DC523
PLC-AI/AO: AX561
II. Create a new project
As the same as other PLC devices, we begin our training with the creation of a new project. Trainees just
need to finish the following steps one by one.
Step 1: From Start menu, choose the CodeSys program and just run it. Then, click the NEW button as
shown in following figure.

Step 2: A Target Settings form pops up, which is used to configure CPU type number that you have. The
only thing you need do is just to choose the right one. In our training example, we choose AC500
PM590V1.2.
NOTE: One CPU type may have more than one version, and thus users should be noted to choose the right
one.

Step 3: The default program file needs to be specified in the following form. Users can name it arbitrarily.
Also, user needs to specify which type of programming language by referring to the following instruction.
IL: Instruction List
LD: Ladder Diagram
FBD: Function Block Diagram
SFC: Sequential Function Chart
ST: Structured Text
CFC: Continuous Function Chart

Step 4: Users can also append other programming files by right clicking the POUs and then choose Add
Object

Step 5: Next, we need set up the hardware configuration according to our PLC, by choosing PLC
Configuration in the Resources label. Then, by right clicking the I/O-BUS [FIX], we add the corresponding
I/O modules ORDERLY.

Step 6: In order to fulfill the Ethernet communication, we also need to add the PM5x1-ETH Internal-
Ethernet by right clicking the Internal-none [SLOT] under Couplers[FIX] item. Without this step, we
cannot fulfill the communication between the PLC and the PC. Hence, trainees should pay more attention
on this setup.

Step 7: After setting up the hardware configuration, we can define the variables on I/O modules which we
just configured in above screenshot. By double clicking the I/O address (like around AT), we can specify
the I/O port name, for the application in our program.

Step 8: If we can get this step successfully, its OK to write our codes in the programming files.

Step 9: When done with programming, we also need tell PLC how to run our programming files, such as
the order, the run type and so on. Hence, we need to set up the Task Configuration under the Resources
label. By right clicking the Task Configuration and choosing Append Task, we can define the task name
and the run type. The task name can be defined arbitrarily, and the type is chosen as freewheeling, which
means the program will run repeatedly and ceaselessly.
Additionally, we also need to append programming files under this task. By right clicking the task icon and
choose Append Program Call, we can add programming files which need to be carried out. The
programming files will run as order as we did.

Step 10: Congratulates what you have done, because you have already finished creating your first project
by using ABB PLC.
III. Cofigure communications
The communication issue is the toughest during our commissioning on site. When we get done it between
the PLC and our laptops, we almost finish our commissioning work by 50% - 60%. Normally, we may
meet different kinds of communication issues and even have no way to explain why this problem occurs,
but this is the job we have to work on. The only thing we should do is just to handle it. Therefore, we
expect that trainees can get more familiar with the communication issues by this document, and never have
an extravagant expectation that trainees can be an expert on this subject by this training course.
There are two communication types in ABB PLC, namely Serial (RS232) and TCP/IP.
Serial (RS232)
Step 11: By choosing Online menu and the communication parameters, we can set up the channel we use
for the communication between the PLC and our laptops.

Step 12: Click New button to create a new communication channel. Then, specify the channel name as
whatever you want and choose Serial (RS232) in the below list.

Step 13: In the following figure, the only compulsory thing is to set the Motorola Byteorder as YES.
Similarly, we can also define the Port Value and Baudrate arbitrarily. Meanwhile, we need to be noted that
the Port Value and Baudrate must be matched up with settings of our laptops. For example, if we define the
Port Value and Baudrate as COM1 and 19200 respectively, the corresponding settings in our laptop must
be COM1 and 19200.

Step 14: We also need to specify the Gateway protocol as LOCAL.
NOTE: LOCAL is used for Serial (RS232), and the TCP/IP is used for Ethernet communication.

Step 15: When we finish all settings in CodeSys, we also need to set up or confirm COM settings in our
laptops. By choosing the Device Manager (My Computer/Properties), we expand the Port (COM & LPT)
and choose TK503/TK504 Programming Cable (COMx).
NOTE: If no TK503/TK504 Programming Cable (COMx), it means the driver of the serial cable has not
been installed yet. We should install it from the installation disk.

Step 16: By double clicking TK503/TK504 Programming Cable (COMx), we can configure settings for the
selected port, such as Bits per second (Baudrate), which need be matched up with the PLC.

Step 17: We can also specify the port number by clicking Advanced button.

Step 18: When we confirm both settings in PLC and our laptops match up, all configurations for Serial
(RS232) have been done.
TCP/I P
Step 19: TCP/IP communication is another type, which is more often used in commissioning on site. By
choosing the Tools/IP Config under Resources label, we can search the destined PLC.

Step 20: By clicking Configure button and choosing Set IP Address, we can change the IP address of PLC
temporally. (As for the fixed IP, please refer to the Section VI How to set up a fixed IP address).

Step 21: In our training example, the IP address of PLC is 169.254.1.6. Then, we need to confirm that the
IP address of our laptops is also attributed to 169.254.1.xxx. Hence, we choose Start/Settings/Network
Connections/, and then we choose Properties option on the right-clicking menu. Double click the Internet
Protocol (TCP/IP).

Step 22: Choose Using following IP address, and set up as the following figure.

IV. How to set up a fixed IP address
Step 23: Run the SYCON.net under Resources label, and choose the PM5x1-ETH as shown in the following
figure. Then drag it on the green bus line.

Step 24: To configure the settings, double click the PM5x1-ETH module. The compulsory thing we need do
is to set Server Connections as 3 and Swap as True in the OMB_SETUP. No reason for doing so, otherwise
we will fail to download the configuration to our PLC.

Step 25: Choose IP_SETUP, and then specify the fixed IP address as the following figure.

Step 26: In the Driver/3S Gateway Driver, we need to configure the 3S channel by clicking Gateway
Configuration button.

Step 27: By clicking New button, we try to create a new channel for the 3S Gateway. Similarly, we specify
the channel name and choose TCP/IP item in the below list.

Step 28: A compulsory thing is to set Port Value as 1201 and Motorola byteorder as YES. In addition, the
IP address should be defined as a fixed one which we just set up.

Step 29: Double check the Channel Name and the Driver Name.

Step 30: If OK, choose Device Assignment. If a device can be scanned and listed in the table, we just check
it and click OK button. If nothing in the device table, it means that there is something wrong in our
configuration. Go back to check it carefully until the destined device can be found.

Step 31: Right click the device on the green bus line, and click the Connect option.

Step 32: If you can get it as same as the above figure, it means its connected successfully. Then, right
click the device on the green bus line, and choose the Download option.

Step 33: If you can get the following status, that means all configurations are successfully downloaded to
the destined PLC. Then, Disconnect the device.

Step 34: Congratulations again, because you have done with all configurations!

You might also like