0% found this document useful (0 votes)
20 views68 pages

PLC Components Introduction

The document provides an introduction to PLC components used in ladder diagrams, detailing eight types of components including input/output points, auxiliary contacts, timers, and counters. It also explains the functionality of various PLC editor components such as contacts, coils, arithmetic operations, comparisons, and logic operations. Additionally, the document includes instructions on using these components effectively within the programming environment, highlighting their specifications and limitations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views68 pages

PLC Components Introduction

The document provides an introduction to PLC components used in ladder diagrams, detailing eight types of components including input/output points, auxiliary contacts, timers, and counters. It also explains the functionality of various PLC editor components such as contacts, coils, arithmetic operations, comparisons, and logic operations. Additionally, the document includes instructions on using these components effectively within the programming environment, highlighting their specifications and limitations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PLC Components Introduction.

匯出日期:2022-09-29
修改日期:2022-08-04
机床产品/Machine Tool Products

PLC Components Introduction.

–2
机床产品/Machine Tool Products

PLC Components Introduction.

1 Introduction of Components in Ladder Diagram


Syntec controller mainly provides I, O, A, C, S, R, CT, TM 8 kinds of components in ladder diagram for program
editors, the details are listed in table below:

N Definition Specification Total Amount Note


a
m
e

I Entity input point The specifications and number are related to the
chosen I/O card.
O Entity output point Only On/Off.

A Virtual auxiliary contact Only On/Off A0~A511, total


point 512 points

C Command sent from ladder Only On/Off C0~C511, total


diagram to kernel 512 points

S System state sent from Only On/Off S0~S511, total


kernel to ladder diagram 512 points

R Registers for 32 bits register, can store values R0~R65535, It only


communication between or used as binary bits total 65536 supports
ladder diagram and kernel points R0~R7999 for
DOS system.

C Virtual auxiliary counter upward /downward/ring counter CT0~CT255,


T total 256 points

T Virtual auxiliary timer 4 units:1 second/0.1 second/ TM0~TM255,


M 0.01 second/0.001 second total 256 points

Introduction of Components in Ladder Diagram – 3


机床产品/Machine Tool Products

PLC Components Introduction.

Introduction of Components in Ladder Diagram – 4


机床产品/Machine Tool Products

PLC Components Introduction.

2 Instruction of PLC Editor Components

2.1 Contact

Normal Open Contact


1. Figure:

General contact Timer contact Counter contact


2. Description: So called "A contact". Normal Open Contact is usually open, and become close when
triggered.
3. Amount: 512 points for each I/ O/ C/ S/ A; 256 points for both timer and counter; and only R0~R639 are
allowed to use contact component because the registers in this range can do 32 bit access in ladder
diagram, for example: R50.0 ~ R50.31.

Normal Close Contact


1. Figure:

General contact Timer contact Counter contact


2. Description: So called "B contact". Normal Close Contact is usually close, and become open when
triggered.
3. Amount: 512 points for each I/ O/ C/ S/ A; 256 points for both timer and counter; and only R0~R639 are
allowed to use contact component because the registers in this range can do 32 bit access in ladder
diagram, for example: R50.0 ~ R50.31.

Connector
1. Figure:

Horizontal connector Vertical connector


2. Description:Used to connect with other components or fill in the blank part of ladder diagram.

Instruction of PLC Editor Components – 5


机床产品/Machine Tool Products

PLC Components Introduction.

2.2 Coil

Normal Open Coil


1. Figure

Normal open coil


2. Description: When input signal is ON, output ON; when input signal is OFF, output OFF.
3. Amount: 512 points for each O/ C/ A; and only R0~R639 are allowed to use coil component because the
registers in this range can do 32 bit access in ladder diagram, for example: R50.0 ~ R50.31.

Normal Close Coil


1. Figure

Normal close coil


2. Description: When input signal is ON, output OFF; when input signal is OFF, output ON.
3. Amount: 512 points for each O/ C/ A; and only R0~R639 are allowed to use coil component because the
registers in this range can do 32 bit access in ladder diagram, for example: R50.0 ~ R50.31.

Positive Edge Triggered Coil


1. Figure

Positive edge triggered coil


2. Description:
a. Outputs a pulse signal when the input signal changes from OFF to ON.
b. The duration of the pulse signal in fast PLC scan area equals to Pr3203 (interpolation time).
c. The duration of the pulse signal in normal PLC scan area equals to Pr3204 (PLC scanning time).
d. The positive edge triggered coil in fast PLC scan area can not trigger the components in normal
PLC scan area.
3. Amount: 512 points for each O/ C/ A; and only R0~R639 are allowed to use coil component because the
registers in this range can do 32 bit access in ladder diagram, for example: R50.0 ~ R50.31.

Negative Edge Triggered Coil


1. Figure

Instruction of PLC Editor Components – 6


机床产品/Machine Tool Products

PLC Components Introduction.

Negative edge triggered coil


2. Description:
a. Outputs a pulse signal when the input signal changes from ON to OFF.
b. The duration of the pulse signal in fast PLC scan area equals to Pr3203 (interpolation time).
c. The duration of the pulse signal in normal PLC scan area equals to Pr3204 (PLC scanning time).
d. The negative edge triggered coil in fast PLC scan area can not trigger the components in normal
PLC scan area.
3. Amount: 512 points for each O/ C/ A; and only R0~R639 are allowed to use coil component because the
registers in this range can do 32 bit access in ladder diagram, for example: R50.0 ~ R50.31.

Latch Coil
1. Figure

Latch Coil
2. Description: When the input signal is ON, the output is ON ans stays ON.
3. Amount: 512 points for each O/ C/ A; and only R0~R639 are allowed to use coil component because the
registers in this range can do 32 bit access in ladder diagram, for example: R50.0 ~ R50.31.

Unlatch Coil
1. Coil

Unlatch coil
2. Description: When the input signal is ON, the output is OFF and stays OFF.
3. Amount: 512 points for each O/ C/ A; and only R0~R639 are allowed to use coil component because the
registers in this range can do 32 bit access in ladder diagram, for example: R50.0 ~ R50.31.

2.3 Arithmetic

1. Figure

R2 = R2 + R1 R2 = R2 + #

Instruction of PLC Editor Components – 7


机床产品/Machine Tool Products

PLC Components Introduction.

R2 = R2 – R1 R2 = R2 - #

R2 = R2 × R1 R2 = R2 × #

R2 = R2 ÷ R1 R2 = R2 ÷ #
PS: Left side of the figure: R1; right side of the figure: R2
2. Description:
a. Run the arithmetic operations when the input signal is ON.
b. # represents constant, range: -32768 ~ 32767.
c. The component supports R bit register indirect addressing function.

2.4 Compare

1. Figure

Is R1 bigger than R2 Is # bigger than R2

Is R1 smaller than R2 Is # smaller than R2

Is R1 equal to R2 Is # equal to R2
PS: Left side of the figure: R1; right side of the figure: R2
2. Description:
a. When the comparing result is true, output signal is ON; when the comparing result is false,
output signal is OFF.
b. # represents constant, range: -32768 ~ 32767.
c. The component supports R bit register indirect addressing function.

Instruction of PLC Editor Components – 8


机床产品/Machine Tool Products

PLC Components Introduction.

2.5 Move

1. Figure

Move # to R2 Move R1 to R2
PS:Left side of the figure: R1; right side of the figure: R2
2. Description:
a. When the input signal is ON, start the moving action.
b. # represents constant, range: -32768 ~ 32767.
c. The component supports R bit register indirect addressing function.
d. If the value you want to move exceeds the range, please refer to the solution shown below:

2.6 Logic

1. Figure

R2 = R2 AND R1 R2 = R2 AND #

R2 = R2 OR R1 R2 = R2 OR #

R2 = R2 XOR R1 R2 = R2 XOR #
PS: Left side of the figure :R1; right side of the figure: R2

Instruction of PLC Editor Components – 9


机床产品/Machine Tool Products

PLC Components Introduction.

2. Description: When the input signal is ON, run the logic operation. Every R bit register is in 32 bit form, so
each bit runs logic operation separately.

AND Truth Table OR Truth Table XOR Truth Table

R1 R2 Result R1 R2 Result R1 R2 Result

Off Off Off Off Off Off Off Off Off

Off On Off Off On On Off On On

On Off Off On Off On On Off On

On On On On On On On On Off

2.7 Timer

1. Figure
constant type register type

Unit: 0.001 second Unit: 0.001 second

Unit: 0.01 second Unit: 0.01 second

Unit: 0.1 second Unit: 0.1 second

Unit: 1 second Unit: 1 second


2. Description:
a. When the input signal changes from OFF to ON, the timer returns to 0. When the input signal
stays ON, the timer starts counting.

Instruction of PLC Editor Components – 10


机床产品/Machine Tool Products

PLC Components Introduction.

b. When the timer counts to the target time, the output signal is ON and the corresponding timer
contact is also ON. When the input signal is OFF, the timer stops counting, the output signal is
OFF and the corresponding timer contact is OFF.
c. When using the register type timers, if the register value changes, the target time will be
updated only when the input signal turns from OFF to ON and restart the counting.
3. Amount: Total 256 timers for use(TM0~TM255)

2.8 Counter

One Way Counter


1. Figure

Upward counter of constant type Upward counter of register type

Downward counter of constant type Downward counter of register type


2. Description:
a. When the input signal changes from OFF to ON, the counter will add (or subtract) 1 time till
reaching the target value.
b. When the counter reaches the target value, the output signal is ON and its corresponding
counter contact is also ON.
c. The initial value of upward counters is 0, the target value is the value of the constant or register;
the initial value of downward counters is the value of the constant or register, the target value is
0.
d. When using the register type counters, if the register value changes, the target value will be
updated only when the input signal turns from OFF to ON and continue the counting. Changing
target value won't make the counter restart from its initial value.
e. If the target value happens to be smaller than current value after modifying the register value,
the counter will take it as reaching the target value when the input signal turns to ON. The
output signal is ON and the corresponding counter contact will also be ON.
f. One way counter means it won't return to the initial value after reaching the target value, the
counter reset component is needed to reset the value.
3. Amount: Total 256 counters for use (CT0~CT255)

Ring Counter
1. Figure

Instruction of PLC Editor Components – 11


机床产品/Machine Tool Products

PLC Components Introduction.

Upward ring counter of constant type Upward ring counter of register type

Downward ring counter of constant type Downward ring counter of register type
2. Description:
a. When the input signal changes from OFF to ON, the counter will add (or subtract) 1 time till
reaching the target value.
b. When the counter reaches the target value, the output signal is ON and its corresponding
counter contact is also ON.
c. When the ring counter reaches the target value, it'll return to initial value +1(or -1) after next
trigger then keep on counting.
d. The initial value of upward counters is 0, the target value is the value of the constant or register;
the initial value of downward counters is the value of the constant or register, the target value is
0.
e. When using the register type counters, if the register value changes, the target value will be
updated only when the input signal turns from OFF to ON and continue the counting. Changing
target value won't make the counter restart from its initial value.
f. The ring counter will restart from the initial value automatically after reaching the target value.
So if the counter counts to 7 and then modify the register value to 5, the counter will "reach the
target value" and "being triggered" at the same time when the input signal turns to ON. Thus
the counter will return to initial value+1 (or -1) and the output signal won't be ON.
3. Amount: Total 256 counters for use (CT0~CT255)

Counter Reset
1. Figure

Counter Reset
2. Description:When the input signal changes from OFF to ON, the counter resets to the initial value. The
value of '#' causes no effect to the execution.

2.9 Flow

Jump Subroutine
1. Figure

Instruction of PLC Editor Components – 12


机床产品/Machine Tool Products

PLC Components Introduction.

Jump to subroutine
2. Description: When the input signal is ON, executes the command of jump subroutine. The subroutine
assigned by the label of JSR component will be executed; after the subroutine finish, it'll return to the
main program and proceed the next command.
3. Notifications:
a. Please organize the content and control the number of subroutines before applying. For
example, use indirect addressing to reduce the subroutines with same content.
b. Too many subroutines may lead to ladder diagram error and make JSR components not able to
find the corresponding subroutines, it's the limitation of the software structure. Please reduce
the number of subroutines to avoid the syntax error caused by system overload.
c. The content of subroutine won't be updated if corresponding JSR component is not triggered.
4. Example:
a. There are 2 subroutines in the ladder diagram. The number of times that subroutine JSR1 being
executed is recorded in R50; the number of times that subroutine R13 being executed equals to
the number of scans of the main program.
b. When switching controller mode in subroutine R13, the value of R13 register will be updated
after next scan.
c. Main program

Subroutine JSR1, label title "1"

Instruction of PLC Editor Components – 13


机床产品/Machine Tool Products

PLC Components Introduction.

Subroutine R13, label title "13"

5. Special Examples
Continue the former example, modify the content of subroutine JSR1 as picture below:
a. A11 is valid only at the first execution of the subroutine JSR1, so R50 will keep adding up since
JSR1 is still executed, but R51 remains 1 after the first execution.
b. A12 will remain ON after the first execution since there is nothing can be done on A11.
c. A13 can do the one-button switch action when the subroutine JSR1 is executed.

6. Special Examples-2
This example demonstrates the point c of [[Link]]
a. The content of the subroutine is only updated when it is triggered ( i.e. when A101 is turned ON
in the following example ). When the subroutine is not executed (A101 OFF), A4 and A14 will be
out of sync (both are turned on by A2).
b. Demonstration
Main program

Instruction of PLC Editor Components – 14


机床产品/Machine Tool Products

PLC Components Introduction.

Subroutine TEST, label title "TEST"

Since A101 is OFF, the content of the subroutine will not be updated. Therefore, the status of A4
and A14 will be different.

End
1. Figure

End of the program


2. Description:It's the ending command of ladder diagram and the final statement in the ladder
diagram. Unable to edit under this component.

FastPLC
1. Figure

Instruction of PLC Editor Components – 15


机床产品/Machine Tool Products

PLC Components Introduction.

FastPLC
2. Description
a. Please put the content of FastPLC at the beginning of ladder diagram and end with -]FEND[-
component.
b. When executing the ladder diagram, the content before -]FEND[- will be loaded into the fast
scan area.
c. The content between -]FEND[- and -]END[- will be loaded into the normal scan area.
d. The scanning time of fast scan area equals to Pr3203 (interpolation time).
e. The scanning time of normal scan area equals to Pr3204 (PLC scanning time).
f. Note:Do not put JSR component in the fast scan area.
3. Example

Instruction of PLC Editor Components – 16


机床产品/Machine Tool Products

PLC Components Introduction.

Instruction of PLC Editor Components – 17


机床产品/Machine Tool Products

PLC Components Introduction.

2.10 CNC

ROT
1. Figure

Tool Magazine Rotation


2. Description
a. When the input signal is ON, starts to calculate the rotation direction of tool magazine, then
output 1 (CW) or 0 (CCW) signal according to the calculation result. The register used are
explained below:
i. Ra - current tool number 1~n
ii. R[a+1] - target tool number 1~n
iii. Rb - total tool number n
b. When this command is executed, if the current tool number exceeds the total tool number, it'll
be automatically modified to the corresponding number in the reasonable range.
c. The component decides the CW/CCW signal in the way of shortest distance. For example, the
total tool number is 8, current tool number is 4 and the target tool number is 6, it'll output 0
(CCW) signal; if the target tool number is 2, it'll output 1 (CW) signal.
3. Example:If set R50 as the current tool number and R89 as the total tool number, the system will
automatically set R51 as the target tool number (R[50+1]). Following is the instruction of tool changing
by T code in PLC.
Contact Description Contact Description

A0 Rising edge-trigger after A293 Tool change direction signal


booting

A16 Tool magazine CW rotating I21 Counting sensor


state

A17 Tool magazine CCW rotating R101 Spindle tool number


state

A290 Tool changing state R102 Tool magazine tool number

A291 Tool change waiting state


After booting, the rising edge trigger writes the spindle tool number (R101) into current tool number
(R50) and target tool number (R51) for initialization.

Instruction of PLC Editor Components – 18


机床产品/Machine Tool Products

PLC Components Introduction.

When the user applies T code (S69) to change tool, it goes into tool changing state (A290) and writes
the T code tool number (R3) into target tool number (R51).

Now the ROT component decides the CW/CCW rotation. Output "1" for CW rotation, A293 ON; "0" for
CCW rotation, A293 OFF.

A293 decides next step:tool magazine CW rotation (A16) or CCW rotation (A17).

Instruction of PLC Editor Components – 19


机床产品/Machine Tool Products

PLC Components Introduction.

When receive the signal from counting sensor (I21), it means the tool magazine rotated.
The current tool number should +1 or -1, and both spindle tool number (R101) and tool magazine tool
number (R102) should be updated.

The actions above repeat continuously till the current tool number (R50) equals to target tool number
(R3) then goes into A291 and finish the tool changing process.

PLC Axis
1. Figure

Drive PLC axis in the way of running NC Drive PLC axis in the way of running NC
programs and the filename will be assigned by a programs and the filename will be assigned by a
constant. register.

Instruction of PLC Editor Components – 20


机床产品/Machine Tool Products

PLC Components Introduction.

Drive PLC axis by setting in ladder diagram Stop PLC axis


2. Description
a. Rn subroutine component, file number range: O0001~O9999
• The filename is assigned by a constant. The example below assigns the 3rd axis as PLC
axis and executes a file named as O1234.

• The filename is assigned by a register. The example below assigns the 3rd axis as PLC
axis and executes a file named as O1234.

• Subroutine of PLC axis (Onnnn)


• The filename must start with "O", but no need to write "O" in the ladder diagram.
The "nnnn" must be 4 digit natural number.
• DOS system path: \CNC\MACRO
• CE system path: DiskC\OpenCnc\MACRO
• The program needs to be in MACRO form, so the content should start
with %@MACRO.
• Can only execute single axis movements and the axis name in the program
content is always X.
• All system variables about axis are invalid except X axis.
• For example, #1301 represents the terminal coordinate of the block of PLC
axis, #1302 is not defined, please do not apply in the program.
• All G code for single axis are applicable (G00、G01、G04、G90、G91、G94、
G95…).
• The override of G00/G01 in PLC axis subroutine is decided by R661~R676, not R18/
R16.
• All the velocity/acceleration/jerk of G code are refer to controller parameter
setups.
• For example: G00 speed is referred to Pr461~; G00 acceleration is referred
to Pr441~; G01 speed is referred to Pr621~; G01 acceleration is referred to
Pr541~.
• Do not end the program with M02, M30 or M99.
• When executing M code in the program, please use R629/ R630/ R681 for M code
read/ M code finish/ M code content, which is equivalent for S29/ C38/ R1.
• Tool setup functions such as G10 L10/L11/L12/L13/L14 are not supported.
b. MoveAx component, moving in the assigned speed, distance and G90/G91 mode
• MoveAx component needs 4 continuous register to set up the action content, below are
the definitions:
R(base address+0):moving distance, unit: BLU
R(base address+1):moving speed, unit: mm/min
R base address+2):absolute/increment mode selection, 0: increment mode; 1: absolute

Instruction of PLC Editor Components – 21


机床产品/Machine Tool Products

PLC Components Introduction.

mode
R(base address+3):no function for now, saved for further expansion
• MoveAx component should be located under these registers.
• Example: The 2nd axis moving 10mm in the speed of 100 mm/min in absolute mode,
base address is 1024.

• The acceleration of MoveAx is referred to Pr441~, and the override is decided by R18.
3. StpAx component: Stop all actions of PLC axis. Example: Stop the moving 2nd axis. The value of "#"
causes no effect to the execution.

4. The executing PLC axis actions can also be stopped by Reset button, but it affects other actions such as
machining process.
5. During the machining, if PLC axis action is executed while the axis is still moving, it'll cause command
overlapping and lead to wrong moving path.
6. When executing PLC axis, please apply rising edge-trigger to avoid the same action being triggered
multiple times.
7. PLC axis supports MPG simulation function, please refer to R601 for further details.
8. Don't execute PLC axis function in JOG/ INJOG/ MPG/ HOME mode. If necessary, Please take enough
safeguard because It may cause command overlapping and lead to wrong moving path.
9. If the axis group or PLC Rn subprogram component has not successfully borrowed the roaming axis,
issue a movement command to the axis and an alarm COR-365 Issue a movement command to the
unborrowed roaming axis will be issued.
10. If the PLC MoveAx component is triggered and the axis is being borrowed by another axis group or PLC
Rn subprogram component, an alarm MOT-085 Trigger PLC MoveAx components for the roaming axis in
borrowing will be issued.

Keyboard Scan
1. Figure

Instruction of PLC Editor Components – 22


机床产品/Machine Tool Products

PLC Components Introduction.

Keyboard Scan
2. Description
a. Activate PLC keyboard scan when the component is triggered, the input data is read by
DB-25PIN of PIO5 (I/O board) on the controller; the input data is stored from Low Bit to High Bit.
b. From the PIN definition of DB-25PIN of PIO5 can know that one O point is able to scan in 8 I
points. If there are five O points, then it'll be able to input utmost 40 I points. Below is the data
input order:
i. Bit 0~31 of Rin(base address+0) corresponds to I point 0~31(Rin means register for
input data)
ii. Bit 0~7 of Rin(base address+1) corresponds to I point 32~39
c. At least 2 continuous registers will be used in PLC keyboard scan, R(base address+0) content is
organized as below, the way of using R(base address+1) is different according to the addressing
method.
R(base address+0):
Bit 0~3: Defined the number of required O points, the value should be bigger than
"number of required I points/8".
Bit 8: Addressing method of Rin, 0 for direct addressing; 1 for indirect addressing.
Bit 16: Scan completed flag, the bit switches to 1 immediately after the content of
Rin is updated.
Function definition of R(base address+0):

Rin is the input data register, which is the register assigned to store the data, below is the
definition:
For direct addressing, the scanning content is saved in R(base address+1)~R (base
address+4);
For indirect addressing, Rin is assigned by R(base address+1).

The table below is the schematic diagram of Rin saving I point input:
3 3 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8
1 0 9 8 7 6 5 4 3 9 8 7 6 5 4 3 2

3 3 2 2 2 2 2 2 2 O O O 1 1 1 1 1 1 1 1 O O O 8
1 0 9 8 7 6 5 4 3 n n n 9 8 7 6 5 4 3 2 n n n

Instruction of PLC Editor Components – 23


机床产品/Machine Tool Products

PLC Components Introduction.

3. Only supports 1 set of KS component and is only valid when applying PIO5 hardware.
4. Example
a. Direct Addressing: Using five O points as control signal, able to scan in 40 I points. The content
will be saved in R1025 & R1026.
R(base address+0)= R1024,Rin=R(base address+1)=R1025 is the first input data register, R(base
address+2)=R1026 is the second input data register.

b. Indirect Addressing: Using five O points as control signal, able to scan in 40 I points. The content
will be saved in R2000 & R2001.
R(base address+0)= R1028, R1028=261 means bit 8=1 is indirect addressing; bit 2=bit 0=1 means
using 5 O points.
R(base address+1)=R1029=2000 means Rin=R2000 is the first input data register; R2001 is the
second.

PLC Coordinate Teaching System


1. Figure

PLC Coordinate Teaching


2. Description
a. Activates PLC coordinate teaching system when the input signal switches form OFF to On, the
system will stay effective after activated till machine power off.

Instruction of PLC Editor Components – 24


机床产品/Machine Tool Products

PLC Components Introduction.

b. Users can build file system based on registers through ladder diagram.
The PLC coordinate teaching system can execute action teaching such as G00 and G01, then
save the teaching result for users to do file managements through ladder diagram.
c. PLC coordinate teaching system component requires 8 continuous registers, the functions are
defined below:
R(base address+0): [In], address of the initial register of data showing area
R(base address+1): [In], number of bits occupied by each row in data showing area
R(base address+2): [In], number of rows showing at once in data showing area
R(base address+3): [In], address of the register for control command (teaching, delete, up, down
etc.)
Bit 0: G00 teaching, takes the current machine coordinate as terminal point when switches to
On.
Bit 1: G01 teaching, takes the current machine coordinate as terminal point when switches to
On.
Bit 2: G02/G03 teaching, reserved function for now, no function.
Bit 3~5: Reserved
Bit 6: Delete line, delete the line where the cursor at when switches to On.
Bit 7: Save file, save the current editing file into the disk when switches to On.
Bit 8: Move cursor to the last line when switches to On.
Bit 9: Move cursor to the next line when switches to On.
Bit 10: Move cursor to the previous page when switches to On.
Bit 11: Move cursor to the next page when switches to On.
Bit 12~31: Reserved
R(base address+4): [In], the register used to assign the filename of teaching file (NC file), the
filename should start with "O", range: 1 ~ 8999.
R(base address+5): [Out], the filename of current teaching file (NC file) of coordinate teaching
system
R(base address+6): Reserved
R(base address+7): Reserved
[In] means the value filled in by users, [Out] means responding from the ladder diagram
3. Currently only supports 1 PLC coordinate teaching system.
4. Remarks:Format of data showing area
In the line length set by users, the first register (4 bytes) is used to save the line data, the second
register then starts being used to save the string data (4 bytes per register).
Format of the first register (Line Header) is mentioned below:
Bit 0~15: Save the line number of the line, which is the line number in the document (count from line 0).
Bit 16: On means it's the cursor line; Off means it's not.
Bit 17~31: Reserved

5. Example
a. Setting PLC coordinate teaching component
The assigned data showing area starts from R1100 (base address=300), 40 bytes each line with
total 5 lines.
Set O0002 to be the loaded NC file during initialization, the process only needs to be executed

Instruction of PLC Editor Components – 25


机床产品/Machine Tool Products

PLC Components Introduction.

once.

b. Choose the teaching file (NC file)


Put the filename of the file you want to teach into R(base address+4), it's R304 in this example.
As shown below, the NC file loaded is O0003.

c. Teaching control action


Set up R(base address+3) according to the required actions and let the corresponding bit be On,
it's R303 in this example.
As shown in the picture below, it's able to do G00 teaching, G01 teaching , delete line, save file,
cursor moving actions in order.

Instruction of PLC Editor Components – 26


机床产品/Machine Tool Products

PLC Components Introduction.

2.11 RS232

RS232 Command
1. Figure

Data transmit and receive


2. Description

Instruction of PLC Editor Components – 27


机床产品/Machine Tool Products

PLC Components Introduction.

a. Activate RS232 transmission command when the input signal switches from OFF to ON. Starting
from the initial register, the data in several registers which are assigned will be sent through
RS232.
If there's any return value, RS232 component will start filling in the assigned register with the
received data in order and record the number of bytes received, then return to waiting state.
b. This component needs 8 continuous registers to set up the action content, below are the
definitions:
R(base address+0): [Transmit/Receive], RS232 control register.
Bit 0: Transmission waiting control bit. If the bit is On, it means the component requires return
value after transmitted the data to proceed the next transmission; if the bit is Off, it means the
component can proceed the next data transmission without waiting for return value.
Bit 1 ~ 7: Reserved
Bit 8: Data receiving bit, should be On under normal situation. When the input signal switches to
On, this bit switches to Off first then transmit the data, then changes back to On when return
value is not required or after the return value is received.
Bit 9: If the bit is On, it means there's an error during RS232 transmission; if the bit is off then
means there's no error during the transmission.
Bit 10: If the bit is On, it means there's a Time Out error during RS232 reception; if the bit is off
then means there's no error during the reception.
Bit 11: If the bit is On, it means the register value of RS232 transmission is wrong; if the bit is off
then means the value is correct.
Bit 12: If the bit is On, it means there's I/O error during RS232 transmission/reception.
Bit 13 ~ 31: Reserved
R( base address+1): [User fill-in], the address of the initial register for transmitting
R( base address+2): [User fill-in], the number of bytes to transmit (unit: R)
R( base address+3): [User fill-in], the address of the initial register for saving return value
R( base address+4): [Transmit/Receive fill-in], assign the largest number of receiving bytes,
RS232 will fill in the number of received bytes in real.
R( base address+5): [User fill-in], receive the ending bit (terminator)
R( base address+6): Reserved
R( base address+7): Reserved
c. Hardware Com Port and the corresponding parameter:
SUPER/10/20/200 eHMC/3/6/11/21

RS232(Pr3921~Pr3930) COM1 -

RS422(Pr3941~Pr3950) COM2 -

RS485(Pr3961~Pr3970) COM3 COM2


3. RS232 component only supports single Com Port. For example: 200 series controller, if already using
RS232 component to transmit data through COM1, you can't transmit data through other Com Port
with RS232 component.
4. Example
a. Control the transmission/reception of RS232 with 4 states A500~A503, below are introduction to
actions of the 4 states. Button 1 (S402) can lead the process into A500.
A500:
Prepare for RS232 data transmit. Triggers a positive edge signal A510 to prepare for data
transmission than goes into A501 immediately.
A501:
The Request state of RS232, will first set the bit 8 of the control register Off. Then goes into state
A502.

Instruction of PLC Editor Components – 28


机床产品/Machine Tool Products

PLC Components Introduction.

A502:
The Request state of RS232, if bit 0 of the control register is On, the data will be transmitted
through RS232 and await for the return value; if bit 0 is Off then won't wait.
A503:
Dealing with return value. Triggers a positive edge signal A509 to deal with the return value.
Enters A500 again after received the signal of Button 1 (S402).

b. Prepare for data transmit


For data transmitting from RS232, input 84, 65, 49, 13 into 4 registers starting from R1210, the 4
numbers are ASCII code for "TA1\n".
Set the address of the initial register for the transmission as R1210, so fill in R301 with 1210.
Set transmission length to 4 and fill in R302.
Set the address of the initial register for the return value as R1410, so fill in R303 with 1410.
Set maximum reception length as 30 and fill in R304, then assign "13" as the terminator.

c. Dealing with return value


Assume the return value to be "EV 301 0 1 23.827 159.447\n" and start filling in from R1410. So
fill in R1400 with 1410, which is the initial address of the register.
Set the number of decimal places to 0 ( means integer) and fill in R1401.
Set the value splitter into blank, the ASCII code is 32, and fill in R1402.
Execute the "character to number" conversion for the first time, it'll transform "EV" into
numbers and fill in R1380. The conversion result is 0 since they're English alphabets.
The second execution will convert "301" into 301 and fill in R1381; "0" into 0 and fill in R1382;
"1" into 1 and fill in R1383.
After, set the number of decimal places to 3 then convert "23.827" into 23827 and fill in R1384;
"159.447" into 159447 and fill in R1385.

Instruction of PLC Editor Components – 29


机床产品/Machine Tool Products

PLC Components Introduction.

Instruction of PLC Editor Components – 30


机床产品/Machine Tool Products

PLC Components Introduction.

Instruction of PLC Editor Components – 31


机床产品/Machine Tool Products

PLC Components Introduction.

ASCII Code to Numbers


1. Figure

ASCII Code to Numbers


2. Description
a. When the input signal is ON, it'll convert the register values of an continuous assigned area into
numbers with the ASCII code table, then fill in to target registers after shifting the numbers
according to the assigned number of decimal places. For example, if the conversion result is
12.345 with number of decimal places set to be 3, the target register will be filled in with 12345.
(1000 times larger)
b. The registers for this component are defined below:
Source Register R1(base address+0): Saves the initial register address of the converting ASCII
code.
Source Register R1(base address+1): Set the number of decimal places and shift according to
the set value. (amplification ratio).
Source Register R1(base address+2): Splitter used to separate the values in the continuous
registers.
Source Register R1(base address+3): Reserved
Target Register R2(base address+0): The initial register address to be filled in after conversion.
c. Example
The values stored in registers from R1410 is 49 (ASCII code for "1"), 50 (ASCII code for "2"), 51
(ASCII code for "3"), 46 (ASCII code for "."), 52 (ASCII code for "4"), 53 (ASCII code for "5"). The
register address for storage is 1410 set by the source register R1(base address 1400) and R1401
is used to save the number of decimal places, 2. The value after conversion is 123.45 and
becomes 12345 after x100, then saves into the target register R1399. The register address set by

Instruction of PLC Editor Components – 32


机床产品/Machine Tool Products

PLC Components Introduction.

source register R1 will change to 1416, which is the address available for next conversion.

Numbers to ASCII Code


1. Figure

Numbers to ASCII code


2. Description
a. When the input signal is ON, it'll read the value stored in the source register and converts the
value shifted according to the assigned number of decimal places into ASCII code digit by digit.
Then fill in from the initial target register address.
For example, the value from source register is 12345 with number of decimal places set to be 3,
it'll be converted into 12.345. From the initial address of the assigned target register, ASCII '1',

Instruction of PLC Editor Components – 33


机床产品/Machine Tool Products

PLC Components Introduction.

ASCII '2', ASCII '.', ASCII '3', ASCII '4', ASCII '5' will be filled in.
Please note that this component is not a positive edge-trigger component.
b. The registers this component requires are defined below:
Source Register R1: Saves the register address which stores the converting numbers.
Target Register R2: The initial register address to be filled in after converted to ASCII code.
Target Register R2(base address+1): Set the number of decimal places and shift according to the
set value. (minification ratio).
Target Register R2(base address+2): Reserved
Target Register R2(base address+3): Reserved
c. Example
Set the source register (R1399) to be 12345; set R1400 as 1410 to be the initial register address
for saving ASCII code; set the number of decimal places to be 1 with R1401.
After the execution, 12345 will be reduced by 10 times to 1234.5 and starts filling in from R1410
in the order of 49 (ASCII code of "1"), 50 (ASCII ode of "2"), 51 (ASCII code of "3"), 52 (的ASCII
code of "4"), 46 (ASCII code of "."), 53 (ASCII code of "5"). Then changes the initial register
address set by R1400 from 1410 to 1416, which is the address available for next conversion.

Input Value to Register


1. Figure

Input Value to Assigned Register


2. Description
a. When the input signal is ON, it'll write the input value into target register, after the value is
wrote in, the target register address will move to the next.
b. The component is not a positive edge-trigger component.

Instruction of PLC Editor Components – 34


机床产品/Machine Tool Products

PLC Components Introduction.

c. The registers this component requires are defined below:


Source Register R1: Saves the register address which stores the inputting value.
Target Register R2: Saves the register address which will be written in.
3. Example
Source register R1400, target register R1410.
After pressing button 8, write "the register address 1410 which will be written in" to R1400 first, then
write in 1, 2, 13 in order. The 3 numbers will be fill in R1410, R1411, R1412 respectively.
After the writing action, value of R1400 will be changed to 1413, which is the next register address able
to write in.

Read Value from Register


1. Figure

Read Value from Assigned Register


2. Description
a. When the input signal is ON, it'll read the value stored in the register address pointed by source
register and write in to the target register, then the register address pointed by source register
will move to the next.
b. This component is not a positive edge-trigger component
c. The registers this component requires are defined below:
Source Register R1: Saves the register address which stores the value be read.
Target Register R2: Saves the register address which stores the read value.
3. Example
Read the value stored in the register address pointed by R1400 and write in to R1420.
After pressing button 7, the register address 1410 will be written in to R1400 first. Then fill in R1410 with
value 123, after 123 is read, it'll be fill in R1420.
After reading, the value of R1400 will point to R1411, which is the next register address available to be

Instruction of PLC Editor Components – 35


机床产品/Machine Tool Products

PLC Components Introduction.

read.

Modbus Reading Command


1. Figure

Read multiple data from specific address of the assigned device


2. Description
a. Available station ID for the assigned device:0~255.
b. MODR is the MODBUS RTU16 reading component, it's able to read consecutive 1~15 data.
c. MODBUS RTU uses the 8-bit format, corresponding to the number of bits of the COM Port setup
(Pr3942 or Pr3962).
d. The system will show the transmission state of Modbus with R608.0/.10/.31 (ref: Appendix 4-a),
the error will be shown at R5039 if occurred during the transmission (ref: Appendix 4-c).
e. Modbus COM Port is the COM Port used to set up the physical wiring, if the hardware is SUPER/
10/20/200, the COM Port would be 3 (R5040=3); if it's eHMC/3/6/11/21, the COM Port would be 2
(R5040=2).
f. Enable Modbus TCP if set R5040 to be 9, it'll be able to transmit the data through Internet (LAN),
the regulations are mostly the same as Modbus RS485, below are the differences:
i. The controller as Client (Master) and the device as Server(Slave) must be in the same
domain.
ii. The station ID of Server (Slave) should be the same as the 4th code of IP. For example, if
the IP is [Link], the station ID should set to be 5.
iii. Able to connect with at most 2 devices as Server (Slave).
iv. The communication timeout can be set with Pr3971.
g. If need to change the communication protocol immediately, please apply R5030 (ref: Appendix
4-b). If R5030 is not assigned or R5030.0 not activated, please set up the standard
communication protocol parameter according to the COM Port number.
For example: If using COM2, Pr3941~Pr3950 should be set up; if using COM3, Pr3961~Pr3970
should be set up.

Instruction of PLC Editor Components – 36


机床产品/Machine Tool Products

PLC Components Introduction.

h. The component contents need to be set up:


Initial Reading Address:Set up the data address of external devices (Slave) to be read
For example:Set the initial reading address to be 2020 means the data address of external
device should be written in R2020. Assume the data address is 0801(16), then make R2020=2049
(usually the address of external devices will be shown in hexadecimal form, please convert to
decimal form by yourself, 0801(16)=2049(10)).
Initial Returning Address:The register address to store the data read from external devices
to the controller (Master).
For example:If the initial returning address is set as 2021 and the data read from external
devices should be filled in R60, it makes R2021=60.
Device Address:The station ID of external devices (Slave)
For example:If set the device address to be 1, it means the station ID of the external device is 1
(the station ID of external devices can be set by its own parameters).
Length of reading data :The number of data read from external devices (Slave)
For example:Set the length of reading data as 2 means the number of data returning is 2. It'll
return the data of the address assigned by initial returning address (0801) + the data of the next
address (0802).
i. All the address are filled in with decimal form in the ladder diagram.
j. Please refer to the Appendix for all the other details.
3. Example:
a. Required Specifications
Applying eHMC controller (using COM2) for Modbus data reading communication (station
ID=001, data address=0801H) with address 0801 of external device. The initial reading address
of MODR component is R2020 (R2020=2049); the initial returning address is R2021=60, which
means the initial address for data storage is R60. Reading value from address 0801 of external
device when I0 is activated, if the signal is received properly, then it's able to receive the correct
value at the assigned register address; if transmission error occurred, the transmission
communication will be paused immediately and alarms will be sent, it'll return to
communication ready state after pressing the Reset button.
b. State Organize
i. A400 Communication Ready State:
• Enter A400 state after rising edge-triggered after booting, Reset, or after the
previous data transmission is confirmed to be completed.
• A400 should keep activating R608.0
• The data transmission completion can be confirmed with R608, when R608.0 Off
and R608.10 On means the previous data is successfully transmitted (ref:
Appendix 4-a).
ii. A402 Modbus Reading State:
• In A400 state, it'll enter A402 state when I0 is activated.
• A402 will activate A412 with rising edge-trigger, trigger the MODR component
once to run the Modbus reading action.
iii. A403 Transmission Error State:
• In A402 state, if unable to complete the Modbus action successfully, the
controller will activate R608.31 automatically, which means there's a
transmission handshake error. Then enters A403 transmission error state and
trigger alarm R44.0 to announce the transmission error (the error code will be
shown at R5039, ref: Appendix 4-c).
• If triggers Reset in A403 state, it'll return to A400 state.

Instruction of PLC Editor Components – 37


机床产品/Machine Tool Products

PLC Components Introduction.

c. MSD

d. Ladder Diagram Example

Instruction of PLC Editor Components – 38


机床产品/Machine Tool Products

PLC Components Introduction.

Instruction of PLC Editor Components – 39


机床产品/Machine Tool Products

PLC Components Introduction.

e. IOCSAR
No. Description Note

I0 The I point triggering reading actions

C37 Reset Button Kernel Definition

S429 Keyboard Button: Ctrl

S430 Keyboard Button: A

A0 Rising edge-triggered after booting

A400 Communication Ready State

A402 Modbus Reading State

A403 Transmission Error State

A412 Reading action triggering flag

R44.0 Modbus transmission error alarm

R608.0 Data transmission start Kernel Definition

R608.10 Transmission completed with correct data Kernel Definition

R608.31 Transmission Error Kernel Definition

R2020 Data address to be read of external devices

Instruction of PLC Editor Components – 40


机床产品/Machine Tool Products

PLC Components Introduction.

No. Description Note

R2021 Storage address of data read from external devices to


controller

R5040 Assigned COM Port for Modbus communication


4. Appendix
a. Register about Modbus communication
Fla Function Reading/
g Writing Rule

R60 Ready State, ready for data transmission. W


8.0 When R608.0 is On, R608.10, R608.31 and R5039
will be cleared automatically.

R60 Transmitting R
8.1

R60 Waiting for reception R


8.2

R60 Receiving R
8.3

R60 Reception Complete R


8.1
0

R60 Handshake Error R


8.3
1

R50 Communication Protocol Setup W


30

R50 Error Code R


39

R50 Set up COM Port number for Modbus W


40 communication
b. R5030 Communication Protocol Setup
i. When bit 0 of R5030 is set to be 0 as non-activated, the Modbus component will refer to
Pr39xx during communication.
For example: When using COM2 for Modbus communication, it'll use Pr3941~Pr3950; if
using COM3, then it'll be Pr3961~Pr3970.

Instruction of PLC Editor Components – 41


机床产品/Machine Tool Products

PLC Components Introduction.

Bit Number Function 0(Off) 1(On)

b0 To activate Not Activated Activated


communication protocol
setup

b1 Data Length 7 bit 8 ibt

b2 Parity Bit None:00


b3 Odd:01
Even:11

b4 Stop Bit 1 bit 2 bit

b8b7b6b5 Baud Rate 2400 bps:0000


4800 bps:0001
9600 bps:0010
19200 bps:0011
38400 bps:0100
57600 bps:0101
115200 bps:0110
230400 bps:0111
460800 bps:1000
912600 bps:1001

b9~b31 Reserved

R5030 setup example:


Baud Rate"9600"/ Stop Bit "2 bit"/ Parity Bit "None"/ Data Length "8"/
Activation "1"
b8b7b6b5 = 0010 / b4 = 1 / b3b2 = 00 / b1 = 1 / b0 = 1
R5030=0010 1 00 1 1(2)
After converted from binary to decimal, R5030=83(10)
Ladder Diagram Example:

c. R5039 Error Code Explanation


ID R5039 Explanation

0x00 0 Communication Success

0x01 1 Function Code error

0x02 2 Address error

0x03 3 Data Value error

Instruction of PLC Editor Components – 42


机床产品/Machine Tool Products

PLC Components Introduction.

0x04 4 Slave Device error

0x05 5 Answer Confirmed (ACK)


When the salve device judges the command
will take a long time to process, it'll return
ACK to avoid TimeOut

0x06 6 Slave Device Busy

0x08 8 Memory Parity error

0x0A 10 Gateway Path Unavailable

0x0B 11 Gateway target Device failed to Respond

0xF5 245 Non-supporting function code

0xF6 246 Modbus Packet Format error

0xF7 247 COM Port assigned by R5040 is incorrect

0xF8 248 Device Busy, all communication commands


paused

0xF9 249 CRC error

0xFA 250 TimeOut error

0xFB 251 Read COM Port error

0xFC 252 Write COM Port error

0xFD 253 Open COM Port error

0xFE 254 Unknown error

Modbus Writing Command


1. Figure

Write in single data to specific address of assigned device

Instruction of PLC Editor Components – 43


机床产品/Machine Tool Products

PLC Components Introduction.

2. Description
a. Available station ID for the assigned device:0~255。
b. MODW is MODBUS RTU16 writing component, can only write in 1 data.
c. MODBUS RTU uses the 8-bit format, corresponding to the number of bits of the COM Port setup
(Pr3942或Pr3962).
d. The system will show the transmission state of Modbus with R608.0/.10/.31 (ref: Appendix 4-a of
Modbus Reading Command), the error will be shown at R5039 if occurred during the
transmission (ref: Appendix 4-c of Modbus Reading Command).
e. Modbus COM Port is the COM Port used to set up the physical wiring, if the hardware is SUPER/
10/20/200, the COM Port would be 3 (R5040=3); if it's eHMC/3/6/11/21, the COM Port would be 2
(R5040=2).
f. Enable Modbus TCP if set R5040 to be 9, it'll be able to transmit the data through Internet (LAN),
the regulations are mostly the same as Modbus RS485, below are the differences:
i. The controller as Client (Master) and the device as Server (Slave) must be in the same
domain.
ii. The station ID of Server (Slave) should be the same as the 4th code of IP. For example, if
the IP is [Link], the station ID should set to be 5.
iii. Able to connect with at most 2 devices as Server (Slave).
iv. The communication timeout can be set with Pr3971.
g. If need to change the communication protocol immediately, please apply R5030 (ref: Appendix
4-b). If R5030 is not assigned or R5030.0 not activated, please set up the standard
communication protocol parameter according to the COM Port number.
For example: If using COM2, Pr3941~Pr3950 should be set up; if using COM3, Pr3961~Pr3970
should be set up.
h. The component contents need to be set up:
Data Written Address:Set up the data address of external devices (Slave) to be written
For example:Set the data written address as 2010 means the data address of external device
should be written in R2010. Assume the data address is 0801(16), then make R2010=2049 (usually
the address of external devices will be shown in hexadecimal form, please convert to decimal
form by yourself, 0801(16)=2049(10)).
Data Content be written:The data content written to external devices (Slave)
For example:If the data content is set as 2011, the data content written to the external device
should be filled in R2011. If the data content is 70, then make R2021=70.
Device Address:The station ID of external devices (Slave)
For example:If set the device address to be 1, it means the station ID of the external device is 1
(the station ID of external devices can be set by its own parameters).
i. All the address are filled in with decimal form in the ladder diagram.
j. Please refer to the Appendix of Modbus Reading Command for all the other details
3. Example
a. Required Specifications
Applying eHMC controller (using COM2) for Modbus data writing communication (station
ID=001, data address=0801H) with address 0801 of external device. The data written address of
MODW component is R2010 (R2010=2049); the data content be written is R2011 (R2011=70).
Write the stored value into the address 0801 of external device when I0 is activated, if the
writing action goes properly, then it's able to see the correct value on the external address; if
transmission error occurred, the transmission communication will be paused immediately and
alarms will be sent, it'll return to communication ready state after pressing the Reset button.
b. MSD
i. A400 Communication Ready State:
• Enter A400 state after rising edge-triggered after booting, Reset, or after the
previous data transmission is confirmed to be completed.

Instruction of PLC Editor Components – 44


机床产品/Machine Tool Products

PLC Components Introduction.

• A400 should keep activating R608.0


• The data transmission completion can be confirmed with R608, when R608.0 Off
and R608.10 On means the previous data is successfully transmitted (ref:
Appendix 4-a of Modbus Reading Command).
ii. A401 Modbus Writing State:
• In A400 state, it'll enter A401 state when I0 is activated.
• A401 will activate A411 with rising edge-trigger, trigger the MODW component
once to run the Modbus writing action.
iii. A403 Transmission Error State:
• In A401 state, if unable to complete the Modbus action successfully, the
controller will activate R608.31 automatically, which means there's a
transmission handshake error. Then enters A403 transmission error state and
trigger alarm R44.0 to announce the transmission error (the error code will be
shown at R5039, ref: Appendix 4-c of Modbus Reading Command).
• If triggers Reset in A403 state, it'll return to A400 state.
c. MSD

Instruction of PLC Editor Components – 45


机床产品/Machine Tool Products

PLC Components Introduction.

d. Ladder Diagram Example

Instruction of PLC Editor Components – 46


机床产品/Machine Tool Products

PLC Components Introduction.

e. IOCSAR
No. Description Note

I0 The I point triggering writing actions

C37 Reset Button Kernel Definition

S429 Keyboard Button: Ctrl

S430 Keyboard Button: A

A0 Rising edge-triggered after booting

A400 Communication Ready State

A401 Modbus Writing State

A403 Transmission Error State

A411 Writing action triggering flag

R44.0 Modbus transmission error alarm

R608.0 Data transmission start Kernel Definition

R608.10 Transmission completed with correct data Kernel Definition

R608.31 Transmission Error Kernel Definition

R2010 Data address to be written of external


device

Instruction of PLC Editor Components – 47


机床产品/Machine Tool Products

PLC Components Introduction.

No. Description Note

R2011 Data content writing to the external device

R5040 Assigned COM Port for Modbus


communication

Self–defined Modbus Command


1. Figure

Send assigned commands by Modbus


2. Description
a. Self-defined communication packet, only needs to write the communication content of
Modbus, CRC will be done by the component.
b. The communication format is RTU form(8-bit format), corresponding to the number of bits of
the COM Port setup (Pr3942 or Pr3962).
c. It's able to use the ModRS command for unlimited times, but can't run 2 or more ModRS
commands at the same time.
d. The ModRS command can't modify the transmitting data content during execution.
e. The system will show the transmission state of Modbus with R608.0/.10/.31 (ref: Appendix 4-a of
Modbus Reading Command), the error will be shown at R5039 if occurred during the
transmission (ref: Appendix 4-c of Modbus Reading Command).
f. Modbus COM Port is the COM Port used to set up the physical wiring, if the hardware is SUPER/
10/20/200, the COM Port would be 3 (R5040=3); if it's eHMC/3/6/11/21, the COM Port would be 2
(R5040=2).
g. Enable Modbus TCP if set R5040 to be 9, it'll be able to transmit the data through Internet (LAN),
the regulations are mostly the same as Modbus RS485, below are the differences:
i. The controller as Client (Master) and the device as Server (Slave) must be in the same
domain.
ii. The station ID of Server (Slave) should be the same as the 4th code of IP. For example, if
the IP is [Link], the station ID should set to be 5.
iii. Able to connect with at most 2 devices as Server (Slave).
iv. The communication timeout can be set with Pr3971.
h. If need to change the communication protocol immediately, please apply R5030 (ref: Appendix
4-b). If R5030 is not assigned or R5030.0 not activated, please set up the standard
communication protocol parameter according to the COM Port number.
i. The component contents need to be set up:
Initial Source Address:The initial register address of the sending data.
For example:Set the initial source address as 50 means the sending data starts from R50.
Initial Returning Address:The initial register address for saving the returned data.
For example:If set the initial returning address to be 60, it means the returned data will be
saved from R60.

Instruction of PLC Editor Components – 48


机床产品/Machine Tool Products

PLC Components Introduction.

Length of Source Data:The length of the sending data.


For example:Set the length of source data as 6 means the total number of the sending data is
6. Each of the data will be filled in to the source registers in decimal form. If the initial source
address is set as 50, then the sending data will be filled in to R50, R51, R52, R53, R54, R55 in
order.
j. All the address are filled in with decimal form in the ladder diagram.
k. Please refer to the Appendix of Modbus Reading Command for all the other details.
3. Example 1
a. Required Specifications
Applying eHMC controller (using COM2/ as Master) for Modbus data reading communication
with R60 and R61(station ID=002, data address=120) of the other eHMC controller (using COM2/
as Slave).
When I0 is activated, the command stored in Master end will be sent out. If Slave end reads the
signal properly, it'll return the values of assigned registers to Master end correctly and the
returned value will be saved in several registers starting from R60 (MODRS component setup in
Master end:initial source address=50, which means the sending data starts from R50; initial
returning address=60, which means the received data will be saved from R60; length of source
data=6, which means the total number of sending data is 6).
If transmission error occurred, the transmission will be paused immediately and alarms will be
sent, it'll return to communication ready state after pressing the Reset button.
b. Controller Setup in Slave End
i. Parameter Setup
Pr3234 (Activate Modbus Slave COM Port) =2
Pr3235 (Station ID of Slave) =2
Needs to be 8-bit format corresponding to the number of bits of the COM Port setup
(Pr3942 or Pr3962).
ii. After reboot, make sure the Modbus Slave is enabled correctly. If working normally,
R5029 will equal to 0. (Modbus Slave error code R5029, ref: 5-a)
c. Source Data Content in Master End
According to the required specifications, refer to Appendix 5-b. multiple R value reading
function, assign R50=2, R51=3, R52=0, R53=120, R54=0, R55=4
d. MSD
i. A400 Communication Ready State:
• Enter A400 state after rising edge-triggered after booting, Reset, or after the
previous data transmission is confirmed to be completed.
• A400 should keep activating R608.0
• The data transmission completion can be confirmed with R608, when R608.0 Off
and R608.10 On means the previous data is successfully transmitted (ref:
Appendix 4-a of Modbus Reading Command).
ii. A401 Modbus Reading State:
• In A400 state, it'll enter A401 state when I0 is activated.
• A401 will activate A411 with rising edge-trigger, trigger the MODRS component
once to run the Modbus reading action.
iii. A403 Transmission Error State:
• In A401 Modbus reading state, if unable to complete the Modbus action
successfully, the controller will activate R608.31 automatically, which means
there's a transmission handshake error. Then enters A403 transmission error
state and triggers alarm R44.0 to announce the transmission error (the error code
will be shown at R5039, ref: Appendix 4-c of Modbus Reading Command).
• If triggers Reset in A403 state, it'll return to A400 state.

Instruction of PLC Editor Components – 49


机床产品/Machine Tool Products

PLC Components Introduction.

e. MSD

f. Ladder Diagram Example

Instruction of PLC Editor Components – 50


机床产品/Machine Tool Products

PLC Components Introduction.

Instruction of PLC Editor Components – 51


机床产品/Machine Tool Products

PLC Components Introduction.

g. IOCSAR
No. Description Note

I0 The I point triggering Modbus actions

C37 Reset Button Kernel Definition

S429 Keyboard Button: Ctrl

S430 Keyboard Button: A

A0 Rising edge-triggered after booting

A400 Communication Ready State

A401 Modbus Reading State

A403 Transmission Error State

A411 Reading action triggering flag

R44.0 Modbus transmission error alarm

R608.0 Data transmission start Kernel Definition

R608.10 Transmission completed with correct Kernel Definition


data

R608.31 Transmission Error Kernel Definition

R50 Initial register address of the sending


data

R60 Initial register address for saving the


returned data.

R5040 Assigned COM Port for Modbus


communication
4. Example 2
a. Required Specifications
Applying eHMC controller (using COM2/ as Master) for Modbus data writing communication with
R60 and R61(station ID=002, data address=120) of the other eHMC controller (using COM2/ as
Slave).
When I0 is activated, the command stored in Master end will be sent out. If the Slave end
receives the signal properly, values will be written into R60 and R61 then return the correct
return value. The return value will be saved in several registers of Master end starting from R70
(MODRS component setup in Master end:initial source address=50, which means the sending
data starts from R50; initial returning address=70, which means the received value will be saved
from R70; length of source data=15, which means the total number of sending data is 15).

Instruction of PLC Editor Components – 52


机床产品/Machine Tool Products

PLC Components Introduction.

If transmission error occurred, the transmission will be paused immediately and alarms will be
sent, it'll return to communication ready state after pressing the Reset button.
b. Controller Setup in Slave End
i. Parameter Setup
Pr3234 (Activate Modbus Slave COM Port) =2
Pr3235 (Station ID of Slave) =2
Needs to be 8-bit format corresponding to the number of bits of the COM Port setup
(Pr3942 or Pr3962).
ii. After reboot, make sure the Modbus Slave is enabled correctly. If working normally,
R5029 will equal to 0. (Modbus Slave error code R5029, ref: 5-a)
c. Source Data Content in Master End
According to the required specifications, refer to Appendix 5-c. multiple R value writing
function, assign R50=2, R51=16, R52=0, R53=120, R54=0, R55=4, R56=8, R57=0, R58=1, R59=0,
R60=1, R61=7, R62=91, R63=205, R64=21
d. MSD
i. A400 Communication Ready State:
• Enter A400 state after rising edge-triggered after booting, Reset, or after the
previous data transmission is confirmed to be completed.
• A400 should keep activating R608.0
• The data transmission completion can be confirmed with R608, when R608.0 Off
and R608.10 On means the previous data is successfully transmitted (ref:
Appendix 4-a of Modbus Reading Command).
ii. A401 Modbus Writing State:
• In A400 state, it'll enter A401 state when I0 is activated.
• A401 will activate A411 with rising edge-trigger, trigger the MODRS component
once to run the Modbus writing action.
iii. A403 Transmission Error State:
• In A401 Modbus writing state, if unable to complete the Modbus action
successfully, the controller will activate R608.31 automatically, which means
there's a transmission handshake error. Then enters A403 transmission error
state and triggers alarm R44.0 to announce the transmission error (the error code
will be shown at R5039, ref: Appendix 4-c of Modbus Reading Command).
• If triggers Reset in A403 state, it'll return to A400 state.
e. MSD

Instruction of PLC Editor Components – 53


机床产品/Machine Tool Products

PLC Components Introduction.

f. Ladder Diagram Example

Instruction of PLC Editor Components – 54


机床产品/Machine Tool Products

PLC Components Introduction.

g. IOCSAR
No. Description Note

I0 The I point triggering Modbus actions

C37 Reset Button Kernel Definition

S429 Keyboard Button: Ctrl

S430 Keyboard Button: A

A0 Rising edge-triggered after booting

A400 Communication Ready State

A401 Modbus Writing State

A403 Transmission Error State

A411 Writing action triggering flag

R44.0 Modbus transmission error alarm

R608.0 Data transmission start Kernel Definition

Instruction of PLC Editor Components – 55


机床产品/Machine Tool Products

PLC Components Introduction.

R608.10 Transmission completed with correct Kernel Definition


data

R608.31 Transmission Error Kernel Definition

R50 Initial register address of the sending


data

R70 Initial register address for saving the


returned data.

R5040 Assigned COM Port for Modbus


communication
5. Appendix
a. Registers about Modbus Slave communication(R5029)
Error Code R5029 Explanation

0x00 0 Slave Activation Success

0x01 1 COM Port Open Failure

0x02 2 Illegal COM Port Number (1~3)

0x03 3 Illegal Station ID (0~255)

0x04 4 Incorrect Packet Length

0x05 5 Incorrect Packet Content

0x06 6 CRC error of packet delivered by Master

0x07 7 NC file upload suspension command error not received

0x08 8 NC File Reading Error

0x09 9 Return Failure


b. Multiple Register Reading Function
i. Transmit:
• Data transmitting format and example
Station ID (1) + Function Code (1) + Initial reading address (2) + Number of
Reading Data (2)
P.S. The number in the ( ) represents the number of data or the occupying Bytes
of the data.

Example:The station ID of Slave is 2, reading 2 registers from Slave, R60 & R61,
the initial source address of Master end starts from R50, R50~R55 total 6 data.

Instruction of PLC Editor Components – 56


机床产品/Machine Tool Products

PLC Components Introduction.

Station ID (1) Function Code Initial Reading Number of


(1) Address (2) Reading Data (2)

2 3 0、120 0、4

R50=2 R51=3 R52=0 R54=0


R53=120 R55=4
• Data Explanation
Data Number Command Explanation
Explanati of Data Value / Range
on (Occupyi
ng Bytes)

Station 1 Byte 0~255


ID

Function 1 Byte 3 MODBUS standard function code


Code 0x03

Initial 2 Bytes Register: Initial reading address = Register


Reading R0~R30000 number*2
Address* Corresponding Example:
initial reading The initial reading address of
address: register is R60, so the initial
0~60000 reading address =60*2=120
(decimal) Fill in 0, 120 following to the
format

Number 2 Bytes 1~125 It needs 2 reading data for a


of register of controller.
Reading Example:
Data (N) Needs 4 reading data when
reading R60, R61
Fill in 0, 4 following to the format

Instruction of PLC Editor Components – 57


机床产品/Machine Tool Products

PLC Components Introduction.

Calculation of Initial Reading Address*


(1) Calculate the initial reading address first.
(2) Judge if it's bigger than 255, if it's smaller or equals to 255, set the first byte
0 and fill in the second byte with the initial address.
(3) If it's bigger than 255, convert to hexadecimal form first then separate into
former and latter values, 2 digits for each.
(4) Convert the former and latter values into decimal form respectively then
fill in for use.
Example 1: R60
a. Initial Reading Address =60 x 2=120(10)
b. 120 is smaller than 255, the first and second byte will be 0, 120
respectively.
Example 2: R6000
a. Initial Reading Address =6000 x 2=12000(10)
b. 12000 is bigger than 255, requires conversion
c. 12000(10)=2EE0(16), separate into 2E(16), E0(16)
d. Convert 2E and E0 into decimal form respectively, so the first and
second byte will be 46, 224.
ii. Return:
• Date returning format and example
Station ID (1) + Function Code (1) + Number of bytes (1) + Data Vale (2 x N)
N= number of reading data
P.S. The number in the ( ) represents the number of data or the occupying bytes
of the data.

Example:The station ID of Slave is 2, reading 2 registers from Slave, R60=65537


and R61=123456789. The return values are stored in the returning address from
R60 of Master end, R60~R70, total 11 data.
Station Id (1) Function Code Number of Bytes Data Value (2xN)
(1) (1)

2 3 8 0、1、0、1、7、
91、205、21

R60=2 R61=3 R62=8 R63=0


R64=1
R65=0
R66=1
R67=7
R68=91
R69=205
R70=21
• Data Explanation
Data Number Command Explanation
Explan of Data Value / Range
ation (Occupyi
ng Bytes)

Instruction of PLC Editor Components – 58


机床产品/Machine Tool Products

PLC Components Introduction.

Station 1 Byte 0~255


ID

Functio 1 Byte 3
n Code

Numbe 1 Byte 2N N=the number of reading data


r of Example:
Bytes If the number of reading data is set
as 4 before transmitting, the number
of bytes will be 4 x 2=8

Data 2N Bytes 0~255 Judges the number of data


Value* according to the number of bytes,
every data will be converted to
decimal form after read by the
controller.

Calculation of data value*


(1) A register of the controller will be separated into 4 data values for
transmission, the value get first is high-byte and the latter is low-byte.
(2) For example, for values a, b, c, d, they should be calculated in the order
from left to right: a*166+b*164+c*162+d*160
Example 1:R value =65537, the data values will be 0, 1, 0, 1
a. The return values are 0, 1, 0, 1 in order.
b. Calculate with the formula: 0*166+1*164+0*162+1*160=65537
Example 2:R value =123456789, the data values will be 7, 91, 205, 21
a. The return values are 7, 91, 205, 21 in order.
b. Calculate with the formula:
7*166+91*164+205*162+21*160=123456789
c. Multiple Register Writing Function
i. Transmitting:
• Data transmitting format and example
Station ID (1) + Function Code (1) + Initial Writing Address (2) + Number of Writing Data
(2) + Number of Bytes of Writing Data (1) + Writing Data value (2N)
N=number of writing data
P.S. The number in the ( ) represents the number of data or the occupying bytes of the
data.

Example:The station ID of Slave is 2, writing to 2 registers of Slave, the writing values


are R60=65537 and R61=123456789 respectively. The initial source address of Master end
starts from R50, R50~R64 total 15 data.
Station ID (1) Function Code Initial Writing Number of Writing
(1) Address (2) Data (2)

2 16 0、120 0、4

Instruction of PLC Editor Components – 59


机床产品/Machine Tool Products

PLC Components Introduction.

R50=2 R51=16 R52=0 R54=0


R53=120 R55=4

Number of Bytes of Writing Data (1) Writing Data Value (2N)

8 0、1、0、1、7、91、205、21

R56=8 R57=0、R58=1
R59=0、R60=1
R61=7、R62=91
R63=205、R64=21
• Data Explanation
Data Number Command Explanation
Inform of Data Value / Range
ation (Occupyi
ng
Bytes)

Statio 1 Byte 0~255


n ID

Functi 1 Byte 16
on
Code

Initial 2 Bytes Register: Initial writing address = register number*2


Writing R0~R30000 Example:
Addres Corresponds to The initial writing address of the register is
s* the initial R60, corresponding to the initial writing
writing address =60*2=120
address: Fill in 0, 120 following to the format.
0~60000
(decimal)

Numb 2 Bytes 2~122 It needs 2 writing data to writing to a


er of register of controller.
Writing Example:
Data It needs 4 writing data to write value into
R60, R61.
Fill in 0,4 following to the format.

Numb 1 Byte 2N N=Number of writing data


er of Example:
Bytes If the number of writing data is set as 4, the
of number of bytes will be 4 x 2=8
Writing
Data

Instruction of PLC Editor Components – 60


机床产品/Machine Tool Products

PLC Components Introduction.

Data 2N Bytes 0~255 It needs 4 data for a register of controller


Value* Example:
* It needs 8 data to write R60, R61.

Instruction of PLC Editor Components – 61


机床产品/Machine Tool Products

PLC Components Introduction.

Calculation of Initial Writing Address*


(1) Calculate the initial writing address first.
(2) Judge if it's bigger than 255 ,if it's smaller or equals to 255, set the first byte as 0
and fill in the second byte with initial writing address.
(3) If it's bigger than 255, convert to hexadecimal form first then separate into former
and latter values, 2 digits for each.
(4) Convert the former and latter values into decimal form respectively then fill in for
use.
Example 1: R60
1. Initial Writing Address =60 x 2=120(10)
2. 120 is smaller than 255, the first and second byte will be 0, 120
respectively.
Example 2: R6000
1. Initial Writing Address =6000 x 2=12000(10)
2. 12000 is bigger than 255, requires conversion
3. 12000(10)=2EE0(16), separate into 2E(16), E0(16)
4. Convert 2E and E0 into decimal form respectively, so the first and second
byte will be 46, 224.
Calculation of Data Value**
(1) A register of the controller will be separated into 4 data values for transmission,
the value written in first is high-byte and the latter is low-byte.
(2) For example, with the written value x and being separated into 4 data values a, b,
c, d
x/166 =a……a1
a1/164 =b……b1
b1/162 =c……c1
c1=d
a is the highest order, d is the lowest order, put a, b, c, d in order as written value.

Example 1:For writing in the value of R=65537, the data values will be 0, 1, 0, 1.
1. Calculate with the formula
65537/166 =0……65537(a=0)
65537/164 =1……1(b=1)
1/162 =0……1(c=0)
1=d

a=0、b=1、c=0、d=1

Example 2:For writing in the value of R=123456789, the data values will be 7, 91,
205, 21
1. Calculate with the formula
123456789/166 =7……6016277(a=7)
10668473/164 =91……52501(b=91)
52501/162 =205……21(c=205)
21=d

a=7、b=91、c=205、d=21
ii. Returning:

Instruction of PLC Editor Components – 62


机床产品/Machine Tool Products

PLC Components Introduction.

• Data returning format and example


Station ID (1) + Function Code (1) + Initial Writing Address (2) + Number of Writing Data
(2)
P.S. The number in the ( ) represents the number of data or the occupying bytes of the
data.

Example:The station ID of Slave is 2, writing to 2 registers of Slave, the writing value


are R60=65537 and R61=123456789. The returned data are stored in the returning
address from R70 of Master end, R70~R75 total 6 data.
Station ID (1) Function Code Initial Writing Number of Writing
(1) Address (2) Data (2)

2 16 0、120 0、4

R70=2 R71=16 R72=0 R74=0


R73=120 R75=4
• Data Explanation
Data Number Command Value / Range Explanation
Explanation of Data
(Occupyi
ng
Bytes)

Station ID 1 Byte 0~255 The returned values are


the same as the
Function 1 Byte 16 transmitted values, used
Code for confirmation.

Initial 2 Bytes Register: R0~R30000


Writing Corresponds to the initial
Address writing address:0~60000
(decimal)

Number of 2 Bytes 2~122


Writing Data

Self-defined Modbus Command of SRI


1. Figure

Send self-defined Modbus commands through SRI port

Instruction of PLC Editor Components – 63


机床产品/Machine Tool Products

PLC Components Introduction.

2. Description
a. The Control Mode of SRI should be set as Software Mode, so the function can operate properly.
For example:

b. SRI port of the controller only supports the controller as Master, please refer to Modbus series
componens introduction if it's required to be Slave.
c. Self-defined packet of SRI only needs to setup the communication content of Modbus when
applying, CRC will be done by the component.
d. The communication format is RTU (8-bit format).

e. Initial Source Address(Source Reg):Setup the initial register of the transmitting packet, 8 bits
for each register. Please note that the last 3 registers must be reserved, Rstate, Rerror
and RRxComplete
f.

Instruction of PLC Editor Components – 64


机床产品/Machine Tool Products

PLC Components Introduction.

g. Initial Returning Address(Ret Reg):Setup the initial register of the returning packet, 8 bits for
each register. Please reserves the required registers according to the returning packet.
h. Length of Source Data(Source Len):According to the packet format of Modbus and deduct the
length after CRC, therefore it's 254 bytes at maximum.
i. Device Address(Station No):Corresponds to the COM Port of SRI.
j. It's able to use SRI command for unlimited times in the ladder program, but can't run 2 or more
SRI commands at the same time.
k. SRI command can't modify the content of transmitting data during execution.
l. The system will show the communication state at Rstate, details are shown below:

Value Function Explanation

0 Waiting to transmit
(0x00)

1 Transmitting
(0x01)

2 Waiting to receive
(0x02)

3 Receiving
(0x03)

16 Communication Failure, the error code is the value of Rerror .


(0x10)
• When communication failed, the second last register "Rerror" of the assigned data source
address will record the corresponding error code. (ref: R5039)
• After receiving the return value, the last register "RRxComplete " will be 1, it'll stay 0 at the
rest of the time.
• If the command is sent successfully, the state recorded by Rerror and RRxComplete will be
initialized.
3. Example
a. Please refer to the part about Master in ModRS example.
b. The packet format, setup methods are the same, the differences are listed below (transmission
state, error code, completion flag):

Instruction of PLC Editor Components – 65


机床产品/Machine Tool Products

PLC Components Introduction.

Modbus Series SRI Component


Component

Start the data transmission R608.0 on Starts the transmission when


SRI component activated
and Rstate =0

Transmis Waiting to Rstate =0


sion State transmit

Transmitting R608.1 on Rstate =1

Waiting to R608.2 on Rstate =2


receive

Receiving R608.3 on Rstate =3

Transmission R608.31 on Rstate =16


Error

Completion Flag R608.10 on RRxComplete =1


(transmission completed
with correct data)

Error Code R5039 Rerror

2.12 Background Running Component

1. Figure

2. Description
a. BGnd Run is used to execute the assigned macro program in ladder diagram. When the
component is activated, the assigned macro will be executed, the applied arguments are
introduced below:

Instruction of PLC Editor Components – 66


机床产品/Machine Tool Products

PLC Components Introduction.

i. Filename Number:Number of the macro (O0001~O9999)


ii. Line Number Register (Rn):Records the line number executing in the macro, please
input the register number (R1~R65535). Rn+1 is the alarm notification.
1. Example:Set the line number register to be 51, when alarm is triggered, R52 will
change to 1 from 0 till the alarm is cleared by BGnd Stop. It's recommended to
use this flag to confirm the macro execution is completed.
iii. BGnd Number:Setup the number of BGnd component, currently supports BG00~BG19,
20 in total.
b. BGnd Stop is used to reset the executing macro or BGnd alarms.

i. BGnd Number:Input the number of component needed to Reset (BG00~BG19).


3. Limitations
a. The version valid for PLC editors starts from 2.25.0, and needs to cooperate with controllers
after version 10.116.22.
b. Provides 20 BGnd devices (BG00~BG19).
c. The name of the macro must be started with “O”, but no need to write "O" in the ladder
diagram; the name of the macro is always a 4-digits natural number (nnnn).
d. Path of macro: DiskC\OpenCnc\Ncfiles 或 DiskC\OpenCnc\MACRO
e. Limitation of Macro content:
i. Only supports the following G code

Instruction of PLC Editor Components – 67


机床产品/Machine Tool Products

PLC Components Introduction.

• G04
• G10 L1000
• G10 L1801
• Other G code is not supported
ii. Only supports the following function
1. Mathematical functions (e.g. ABS, SIN, COS, MAX...)
2. Contact operation function: SETDO, READDI, READDO, READABIT
3. Flow control function: FOR、WHILE、IF、GOTO
4. Stop pre-interpreting function: WAIT
5. Other function is not supported
6. Note: It is necessary to add WAIT before READDI, READDO or READABIT to
confirm the chronological order.
iii. Not supporting M, S, T, B code
iv. Not supporting Increment Mode
v. Only supports local variables #1~#400 for reading and writing.
vi. Support global variable @ , the specifications are the same as regular macros.
f. Please refer to the alarm manual for BGnd related alarms.
i. When alarms happened, the number of the device which caused the alarm will be
shown.
ii. When using too many BGND components, it might cause lack of memory and the alarm
will happen.
g. The component can only be in the general scanning area, the scanning speed will still be the
same even it's being moved to the rapid scanning area.
h. Please execute this component with rising edge-trigger to avoid repeated executions.
i. After the component being activated and starts the execution, if being activated second time
before completion, the second activation command will be ignored.
j. Reset and Emergency Stop won't stop BGND components, only BGnd Stop is able to stop or
reset the components.
k. The BGnd Number must not be reapted, otherwise it will cause abnormal actions.

2.13 Indirect Addressing Function of Register

For some specific components that could applies with registers, if input the register number adding "@" can
activate the indirect addressing function.
As the example shown below, the content of R61 is 50, when scanning to the 4th line, the content of R50 will
be assigned to R62 and the final content of R62 is 1.

Instruction of PLC Editor Components – 68

You might also like