kinco plc training

Post on 05-Oct-2021

48 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Kinco PLC Training

Kinco Automation

Contents

• Kinco PLC ProfileⅠ

• Program-KincoBuilder Fast StartⅡ

• Program-KincoBuilder Basic FunctionⅢ

• CoDeSys for F1 ProgramⅣ

Kinco PLC Profile

Development of Kinco PLC

PLC Product Line

PLC Hardware Structure

Development of Kinco PLC

F1

K5

K3

K2/K7

(Phased out)

(Coming soon)

K504

K504EX

K506

K506EX

K508

Digital I/O modules:K521,K522,K523

Analog I/O modules:K531,K532,K533

K5 series PLCs are small type PLC. It can be used in most of common

Application such as logic control, analog control, stepper control and so on.

PLC Product Line-K5

CPUModule

Remote I/OModule

F122-D1608T

Digital remote I/O modules:

RP2D-1608C1,RP2D-0016C1

Analog remote I/O module:

RP2A-0402C1

CPUModule

Remote I/OModule

PLC Product Line-F1

F1 series PLCs integrate with 3S company’s software CoDeSys, which has

strong functions and stable performance.

Hardware Structure-K5

Parts Name:

1. I/O status LEDs

2. CPU status LEDs

3. Programming interface (RS232)

4. Wiring terminal

5. 35mm DIN rail Clip

6. M4 mounting hole

7. Cover plate for terminal

8. Expansion port

9. Cover plate for expansion port

Hardware Structure-F1

Parts Name:

1. Power supply terminal and LEDs

2. CPU status LEDs

3. Serial port (RS232/485)

4. I/O status LEDs

5. I/O terminals

6. DIP switches

7. CAN1 port

8. CAN2 port

9. Ethernet port

Program—KincoBuilder Fast Start

KincoBuilder Interface

Project Organization Structure

Tasks Execution in CPU

Steps to create new project

KincoBuilder Interface

Program Initial Data

(Optional)

CPU process the initial data upon power on

then starts scan cycle.

Main Program CPU executes main program once per scan cycle.

Only 1 main program in a project.

Interrupt

routines

(Optional)

For process specific interrupt events. CPU executes

interrupt routines upon occurrence of interrupt event.

At most 16 interrupt routines are allowable in a

project.

Subroutines

(Optional)

Invoked by main program or interrupt routines. At

most 16 interrupt routines are allowable in a project.

Configuration Hardware Configure CPU and expansion modules in the

projects, address, function parameters, etc.

Global variables

(Optional)

For declaring global variables required in the project.

Project Organization Structure

CPU executes a series of tasks continuously and cyclically. We take the cyclical

execution of tasks as scan.

Executing CPU Diagnostics: CPU executes self-diagnostics to check proper

operation of CPU, memory areas and status of expansion modules.

Read inputs: Read all the physical input channels and writes these values to

input image areas

Executing main program: CPU execute all the instructions in the main program

continuously and updates memory areas.

Writing outputs: CPU write the

values stored in output areas to the

physical output channels.

Processing Communication requests

Tasks Execution in CPU

If interrupt routines are attached in the program, CPU will interrupt scan

cycle temporarily when interrupt events occur and immediately execute

corresponding interrupt routines. Once interrupt routines is complete, it

will back to breakpoint.

Tasks Execution in CPU

Execution of Interrupt Routines

The following simple example just illustrates common steps for creating and

debugging a new project.

Assume that we shall create the following project:

project name: “Example”;

Hardware: a Kinco-K506-24AT CPU module;

Control logic” Toggle Q0.0---Q0.7 in turn and cyclically.

And for better structure, we use two POUs: a subroutine named “Demo” to

realize logic; the Main Program named “Main” in which “Demo” is involved.

Steps to create new project

Steps to create new project:

Step 1. Launch KincoBuilder;

Step 2. If necessary, user could modify default setting in KincoBuilder

[Configuring General Software Options].

Step 3. Create a new project by one of the following ways:

Select [Title]>[New project] menu command;

Click the icon in the toolbar;

After the above operation, the “New Project” dialog box will pop up. Users

need to enter project name and assign its directory, and then click [Sae], the

new project shall be created. In this example, let’s select “D:\temp” as the

project directory, and project name is “Example”.

Steps to create new project

Step 4. Modify hardware configuration in [Configuring Hardware]. In this

example, we configure Kinco-K506-24AT as CPU model.

Step 5. If necessary, users could configure [Initial Variable Table] and

[Global Variable Table]

Step 6. Entering instructions in main program and subroutine editor window

to realize logical control. Users could select [Project]>[IL] or [Project]>[LD]

menu command to change current POU’s language. In this program we take

LD as program language.

Main Program:

When creating a new project, KincoBuiler will automatically create an empty

main program named “MAIN” at the same time.

Steps to create new project

Add new Subroutine by one of the following ways:

Click the icon on the toolbar;

Right-click [PROGRAM] node in workplace window, and select [New

Subroutine] command on pop-up menu. Then new subroutine will be created

with the default name “SBR_0”.

Users could rename and subroutines by the following way: Close the

subroutine window; right-click on the subroutine node in workplace window,

then select [Rename] command to modify the name to “Demo”, or select

[Properties] command to make modification in the “Property” dialog box. Also

users could rename main program in the same way.

Steps to create new project

Subroutine: Demo Main program: Example

Steps to create new project

Step 7. Compile project. When compiling a project, KincoBuilder will save it

automatically at first to ensure it is the latest. Execute compilation by the

following ways:

Select [PLC]>Compile All] menu command;

Click the icon on the toolbar;

Use shortcut key F7.

The “Compile” tab in the output window keeps a list of the latest compiling

messages. Users could double-click on an error message in the “Compile”

Window to find the source code.

Step 8. Download program. Users need to make sure communication

parameters for [connecting PLC with PC] are correct. Download project by the

following ways:

Steps to create new project

Step 8. Download program. Users need to make sure communication

parameters for [connecting PLC with PC] are correct. Download project by the

following ways:

Select [PLC]>[Download] menu command;

Click on the icon on the toolbar;

Use shortcut key F8.

Steps to create new project

Steps to create new project

Step 8. Online Monitor. User could select [Debug]>[Monitor] menu command

or click the icon on the toolbar. Then KincoBuilder will show values of all the

variables used in the program. Users could use the force or unforce function for

debugging.

Program—KincoBuilder Basic Function

Data type

Memory address

Configuring General Software Options

Configuring Hardware

Initial Data Table

Global Variable Table

Cross Reference Tab

Instruction Set

Connecting PLC with PC

Status Chart

Program Edit

The elementary data types that K5 supports is shown as following table.

And data could be defined as constants or variables.

Data Type

Constant

Constants are characterized by having a fixed value and data type. Definition

of constants is as follows:

Data Type-Constant

Data Type-Constant

Variable must have a name and an address in the CPU.

Kinco K5 series PLCs provide two methods to access the memory units:

1.Direct addressing

2. Indirect addressing, i.e. pointer

Variables

Direct addressing

Directly represented variable

Direct address, a special symbolic composed by “%”+memory area identifier + data size + unsigned number

Symbolic variable

Declare symbolic variables within Global Variable Table or Variable Table of the respective POU.

Indirect addressing

Pointer “&” address operator; “*” pointer operator.

Data Type-Variables

Mapping between Direct Address and PLC Memory location:

Data Type-Variables

Data Type-Variables

Memory Address

Memory Address

When opening KincoBuilder, users could configure some general options, e.g.

default programming language, default CPU type for new project.

Select [Tools]>[Options]

menu command to open the

dialog box:

Configuring general software options

Configuring Hardware

In a project, users are recommended to configure hardware at first.

Users could configure CPU model and I/O expansion modules used in the

project, and set proper parameters for all the models.

Opening Hardware window:

1. Double-click the [Hardware] note in Workplace window;

2. Right-click [Hardware] node , and then select [Open] command on the

pop-up menu.

The Hardware Window is composed of two parts:

1. Configuration Table (Upper part)

2. Parameter Window (Lower part)

Configuration Table represents real configuration of a real control system. All

the models used in the project are listed here.

Parameter Window shows parameters of all the selected models.

Configuring Hardware

Add/remove modules in Configuration Table

Step 1. in the Configuration Table, click on a row and place focus on it;

Step 2. in the [HW Catalog] window, double-click on a module to add.

Right-click on the selected module, and select “[Remove Modules]” to delete.

Configuring Hardware

Set parameters in Parameter Window

Once users add modules in the Configuration Table, then users could assign

their parameters freely. Click on one module and place focus on it, all its

parameters will be displayed in Parameter Window.

Configuring Hardware

Parameter configuration of CPU

I/O Configuration

Communication Ports

Retentive Ranges

Others

Parameter configuration of Expansion Module

DI

DO

AI

AO

I/O Configuration

Input/Output addresses of CPU are fixed and start from 0;

Input filter: defines a delay time for DI channel to filter input noise, which

helps to enhance anti-interference capacity.

Output States while Stop: Set DO in a fixed state while CPU in STOP state.

Configuring Hardware

In this window, user could set communication parameters: Address, Baudrate,

Parity, DataBits, StopBits and so on.

Modbus Master: if check this option, Port1/2 will work as Modbus RTU master;

Timeout : Communication timeout value of Modbus master.

Retry: retry times when master receives wrong frame from slave.

Configuring Hardware

Communication ports Configuration

Here, users could select ranges of RAM for retaining on power loss. After CPU

loses power, values of retentive area will be maintained by the super capacitor

and restore upon power on.

User could set register type, start address and length of the retentive areas.

Configuring Hardware

Retentive Data Configuration

Permanent backup VB3648~4095: Check this option to backup VB3648~4095

permanently;

Backup the project files: Check this option to save the whole project to PLC

permanent registers.

Configuring Hardware

Others Configuration

The start address for DI/DO modules are settable; For DO modules, users also

could set Output States while STOP.

DI expansion module DO expansion module

Configuring Hardware

DI/DO Setting-- Expansion Module

The start address and signal type for AI/AO modules are settable;

For AI modules, user could set filter to reduce noise input;

For AO modules, freeze value output while CPU STOP could be set.

Configuring Hardware

AI/AO Setting-- Expansion Module

AI expansion module AO expansion module

In the Initial Data Table, users could assign initial numerical values for

BYTE, WORD, DWORD, INT, DINT, REAL variables in V area. CPU module

processes all variables in Initial Data Table once upon power on. Then

start scan cycle.

Opening Initial Data Table:

1. Double-click [Initial Data] node in Workplace window;

2. Right-click [Initial Data] node , and then select [Open] command on

the pop-up menu.

Initial Data Table

Global Variable Table is for declaring global variables which could be used in

any POUs in the project. And a direct address is equivalent to its symbolic

name in user program.

Opening Global Variable Table:

1. Select [Project]>[Global Variable] menu command;

2. Double-click [Global Variable] node in Workplace window;

3. Right-click [Global Variable] node , and then select [Open] command on

the pop-up menu.

Global Variable Table

Cross Reference Table shows all the variables used in the project. It is much

helpful for users checking whether a symbolic or an address is already used

and where it is used.

Information in Cross Reference Table is only generated after first compilation.

Opening Cross Reference Table:

1. Select [Project]>[Cross Reference]menu command;

2. Click the icon in the toolbar;

3. Use the Alt+C shortcut key.

Cross Reference Table

Instruction Set

Kinco-K5 PLCs instruction set accords with IEC 61131-3 standard for

programming. Basic instructions, standard functions/function blocks are

provided. Also some non-standard instructions are available to satisfy different

applications.

Users could check instruction set supported by the selected CPU in the

[Instruction] window.

Here we will introduce the most commonly used instructions:

Instruction Set

Bit Logic Instructions:

Name Symbolic Note

Normally open contact Read from image area.

Normally closed contact

Normally open immediate contact

Immediate contacts don’t rely on scan cycle and respond to physical input signal more quickly.

Normally closed immediate contact

Coil Write image registers

Negated Coil

Null Coil Null Coil indicates the end of a network.

Set Coil Set or reset coil when power flow is 1.

Reset Coil

Immediate Coil Immediate coils don’t rely on scan cycle and write both image registerand physical DO on CPU body immediately.

Immediate Set Coil

Immediate Reset Coil

Instruction Set

Move Instructions:

Name Symbolic Note

MOVE Move the value of IN to the address OUT.

BLKMOVE Move N number of variables from the successive range beginning with the address IN to the successive range beginning with address OUT.

FILL Set N number of successive variables, beginning with the address OUT, to the specified constant IN.

SWAP Exchange the high byte/word with the lower byte or word of the register.

Instruction Set

Compare Instructions:

Logical Operation Instructions:

Convert Instructions:

Compare Instructions: Compare the INPUT operands and output the result.

Logical Operation Instructions: Execute logical operations to the INPUT operands

and output the result.

Convert Instructions: Convert INPUT data type to other data type.

Note:

Instruction Set

Shift/Rotate Instructions:

Name Symbolic Note

SHL (Shift left) Rotate value of IN to the left by N bits, and original bits are filled with zero.

ROL (Rotate left)

Rotate value of IN to the left by N bits, and MSB is rotated to LSB.

SHL_BLK (Bit Strings Shift Left)

SHL_BLK is similar with SHL, which is to shift a strings of bit to the left.

.

.

.

Numeric Instructions are mainly for simple math operations: Addition, subtraction, multiplication, division and so on.

Instruction Set

Numeric Instructions:

Name Symbolic Note

INC OUT=IN + 1.

DEC OUT=IN – 1.

Numeric Instructions are mainly for simple math operations: Addition, subtraction, multiplication, division and so on.

Instruction Set

Program Control Instructions:

Additional Instructions:

Clock Instructions:

Note:

Program Control Instructions: To realize program

JUMP/CALL/RETURN/END/LOOP and so on functions.

Clock Instructions: For adjusting real-time clock in CPU.

Additional Instructions: Assist users to satisfy special application.

Instruction Set

Interrupt Instructions: Counter Instructions:

Communication Instructions: Timer

Position Control Instructions:

PID

The above instruction sets will be introduced in advanced chapter.

K5 series PLC Port0 is for connecting with PC to download and online

debugging. For downloading program form PC into PLC, users need to use

correct cable and set proper communication parameters. The steps are as

follows:

1. Communication cable

Note: After user connecting PLC with PC via the cable, then users could

check the used port number in [My pc]-[Manage]-[Device Manager]-

[Universal Serial Bus Controller]

Connecting PLC with PC

2. Configure communication parameters

Open Communication window:

1. Select [Tools]>[Communications] menu command;

2. Double-click [Communication] node in Workplace window;

3. Right-click [Communication] node and select [Open] command menu.

Connecting PLC with PC

In the Communication window, select a [Port] same port number shown in

[Device Manger] . And set proper parameters for Station number, Baudrate,

Parity, Data Bits, Stop Bits. Communication can’t be established unless

communication parameters of PC serial port are identical with CPU ports.

* If users do not know the parameters in PLC:

1. Select the proper [Port], and click the [Start] button to detect

communication parameters automatically;

2. Turn off power supply for CPU; Place its operation switch at STOP state;

when turn the power supply on, PLC will restore to its default serial

communication parameters: Station number: 1, Baudrate: 9600, Parity:

None, Data Bits: 8, Stop Bits: 1.

Connecting PLC with PC

Opening Status Chart:

1. Select [Project]>[Global Variable] menu command;

2. Double-click [Status Chart] node in Workplace window;

3. Right-click [Status Chart] node , and then select [Open]

menu command.

4. Click the icon in the toolbar;

After download project into PLC, then users could use the Status

Char to monitor and force any variables used in the projects. Also

users could monitor and force values for variables on the program.

Status Chart

When programming in LD, users could use standardized graphic symbols

(Contact, Coil, Function, Function block and so on) and arrange them into

network of logic. IN LD editor, some common operations are for

Common mouse operations:

Click an element, it shall be selected and focus moves on it.

Double-click an element, its property dialog box shall pop up, then users could

modify its property;

Right-click an element, its context menu shall pop up, then users could select

menu command to execute corresponding function.

Common keyboard operations:

Use UP, DOWN, LEFT and RIGHT arrow keys to move the focus;

Press ENTER key to select the element’s parameter area for entering;

Press Del key to delete the element where the focus is located;

What’s more there is a shortcut key corresponding to each menu command.

Program edit

CoDeSys for F1 Program

Install Target File

Steps to create new project

Downloading Parameter Setting

CANopen Parameter Setting

Install Target File

Step 1. Press "InstallTarget" in 3S Software package as following figure.

Install Target File

Step 2. Open the "InstallTarget" window, and click Open button. Then find

the directory of the target file of F1. Choose the file *.tnf in the directory

and press [Open] as the figure on the right side.

Install Target File

Step 3. After opening the *.tnf file, the window will show as following figure.

Install Target File

Step 4. Choose the file which is opened just now, then press “install” to install

the target of F1 to the right window.

Steps to create new project

Step 1. Open CoDeSys V2.3 as following figure:

Steps to create new project

CoDeSys interface is shown as following picture:

Steps to create new project

Step 2. Select [File]-[New], it will pop up the following window. Choose

F122-D1608T PLC and press OK to create a new project.

Steps to create new project

Step 3. In the following window. We can set all the parameters by default,

and press OK to finish the configuration.

Steps to create new project

Step 4. Choose a language of the POU. Here we choose “LD”, then press OK.

Downloading Parameter Setting

Before download program to F1 PLC, communication parameters should be set

in advance.

Step 1. In CoDesys interface, select [Online]-[Communication Parameters] to

pop up the following dialog box:

Step 2. Select communication port type.

Downloading Parameter Setting

Downloading Parameter Setting

Step 3. Input IP address and press [OK] to finish the setting.

Downloading Parameter Setting

Step 4. Click Online->Login to download program into F1 PLC, then click

Online->Create boot project to save program in PLC after power off.

CANopen Parameter Setting

Step 1. Firstly CANopen library should be added as following figure:

CANopen Parameter Setting

Step 2. After adding CANopen library, open the PLC Configuration in Resources.

CANopen Parameter Setting

Step 3. Choose one CAN port. Set the same baudrate as in CAN slave device.

CANopen Parameter Setting

Step 4. Right click this CAN port, and select the CAN device(slave).Here we

select JD Servo.

CANopen Parameter Setting

Step 5. Select JD driver, set node id (This id like a sequence number, it should

be set to different value from CAN port id.)

CANopen Parameter Setting

Step 6. Set [CAN parameters] as following figure:

CANopen Parameter Setting

Step 7. Open PDO mapping to add the address in Receive PDO and Send PDO,

which can be used for data transmission in program.

Thank you !

top related