Manual de Instrucao CLP XINJE XC e GPM18 T
Manual de Instrucao CLP XINJE XC e GPM18 T
User manual[Instruction]
Catalog
CATALOG ....................................................................................................................................... 2
1 PROGRAM SUMMARY ............................................................................................................ 8
1 Program Summary
XC series PLC as the controllers accept the signal and execute the program in the controller, to
fulfill the requirements from the users. In this chapter, we start with the program forms, then
introduce the main features, the supported two program languages etc.
1-2.Program Language
1-3.Program Format
1 Program Summary
Program Language
XC series PLC support two kinds of program languages, instruction list and ladder, the two languages
can convert to the other;
To avoid the stolen or wrong modifying of user program, we encrypt the program. When uploading
the encrypted program, it will check in the form of password. This can maintain the user’s copyright;
meantime, it limits the download, to avoid the modification with the program spitefully.
Program comments
When the user program is too long, adding comments to the program and its soft components is
necessary.
Offset Function
Add offset appendix (like X3[D100]、M10[D100]、D0[D100]) behind coils, data registers can
realize indirect addressing. For example, when D100=9, X3[D100] =X14; M10 [D100] =M19, D0
[D100] =D9
⚫ XC series PLC offers enough basic instructions, can fulfill basic sequential control, data moving
and comparing, arithmetic operation, logic control, data loop and shift etc.
⚫ XC series PLC also support special compare, high speed pulse, frequency testing, precise time,
PID control, position control etc for interruption, high speed counter (HSC).
XC series PLC support C language function block, users can call the edited function block freely.
This function reduces the program quantity greatly.
XC series PLC support “Stop when power on PLC” function. With this function, when there is a
serious problem during PLC running, use this method to stop all output immediately. Besides, with
this method, connect PLC when parameters are set wrongly.
1 Program Summary
Communication Function
XC series PLC support many communication formats, like basic Modbus communication,
CABBUS communication, and free format communication. Besides, via special network module,
connect to Ether net, GPRS net.
1- .Program Language
2
1-2-1.Type
Instruction List
Instruction list inputs in the form of “LD”, “AND”, “OUT” etc. This is the basic input form of the
programs, but it’s hard to read and understand;
Ladder
With sequential control signal and soft components, draw the sequential control graph on program
interface, this method is called “Ladder”. This method use coil signs etc. to represent sequential
circuit, so it’s easier to understand the program. Meantime, monitor PLC with the circuit’s status.
E.g.:
X0 X2
Y5
Y5
1-2-2.Alternation
1 Program Summary
Instruction Ladder
1- .Program Format
3
Direct Input
The above two program methods can input in the correspond interface separately, especially in the
ladder window, there is a instruction hint function, which improves the program efficiency greatly;
Panel Configuration
As in XC series PLC, there are many instructions which have complicate usage and many using
methods, like pulse output instruction, main unit PID etc. XCPPro also support the configure
interface for these special instructions. In the correspond configure interface, input the parameters
and ID according to the requirements will be ok.
1 Program Summary
For the details of panel configuration, please refer XC series PLC user manual【software part】.
2 Soft Component’s Function
In chapter 1, we briefly tell the program language of XC series PLC. However, the most important
element to a program is the operands. These elements relate to the relays and registers inside the
controller. In this chapter, we will describe the functions and using methods of these relays and
registers.
2-7.Timers (T)
2-8.Counters (C)
2-10.Constant (K、H)
2-11.Pointer (P、I)
2-12.Program Principle
2 Soft Component’s Function
There are many relays, timers and counters inside PLC. They all have countless NO (Normally ON)
and NC (Normally Closed) contactors. Connect these contactors with the coils will make a
sequential control circuit. Below, we will introduce these soft components briefly;
Auxiliary Relays(M)
Status Relays(S)
Timer(T)
Counter(C)
According to different application and purpose, we can divide the counters to different types as below:
⚫ For internal count (for general using/power off retentive usage)
➢ 16 bits counter: for increment count, the count range is 1~32,767
➢ 32 bits counter: for increment count, the count range is 1~2,147,483,647
➢ These counters can be used by PLC’s internal signal. The response speed is one scan cycle
or longer.
⚫ For High Speed Count (Power off retentive)
➢ 32 bits counter: for increment/decrement count, the count range is -2,147,483,648~
+2,147,483,647
(Single phase increment count, single phase increment/decrement count, AB phase cont) specify
to special input points
➢ The high speed counter can count 80KHz frequency, it separates with the PLC’s scan cycle;
2 Soft Component’s Function
Data Register(D)
⚫ Usage of ED registers
Internal extension registers ED are used to store the data.
⚫ Addressing form
In basic units, ED registers are addressed in the form of decimal;
⚫ Points to note
ED registers are power-loss retentive. It fits for data transfer instructions such as MOV, BMOV,
and FMOV.
Constant(B)(K)(H)
⚫ In every type of data in PLC, B represents Binary, K represents Decimal, and H represents
Hexadecimal. They are used to set timers and counters value, or operands of application instructions.
2 Soft Component’s Function
2-2-1.Structure of Memory
In XC series PLC, there are many registers. Besides the common data registers D, FlashROM registers,
we can also make registers by combining bit soft components.
2 Soft Component’s Function
Timer T/Counter C
M0
MOV T11 D0
T11
Y1
In the above example, MOV T11 D0, T11 represents word register;
LD T11, T11 represents bit register.
FlashROM Register FD
⚫ For common usage, 16 bits, (via combine two sequential 16 bits registers)
⚫ The soft components which can be combined to be words are: X、Y、M、S、 T、C
2 Soft Component’s Function
⚫ Format: add “D” in front of soft components, like DM10, represents a 16 bits data from
M10~M25
⚫ Get 16 points from DXn, but not beyond the soft components range; ⚫ The word
combined by bit soft components can’t realize bit addressing;
E.g.:
M0
MOV K21 DY0
M1
MOV K3 D0
When M0 changes from OFF to be ON, the value in the word which is combined by Y0~Y17
equals 21, i.e. Y0、Y2、Y4 becomes to be ON
Before M1 activates, if D0=0, DX2[D0] represents a word combined by
X2~X21
If M1 changes from OFF→ON, D0=3,then DX2[D0] represents a
Bit soft components structure is simple, the common ones are X、Y、M、S、T、C, besides, a bit of
a register can also represents:
Relay
Register ’s Bit
D5[D1].4
Y1
XC1 Series
Range points
Mnemonic Name 10I/O 16 I/O 24 I/O 32 I/O 10 I/O 16 24 I/O 32 I/O
I/O
Input Points X0~X4 X0~X7 X0~X13 X0~X17 5 8 12 16
※1
I/O points Y0~Y4 Y0~Y7 Y0~Y13 Y0~Y17 5 8 12 16
Output Points
X※2 Internal Relay X0~X77 64
Y※3 Internal Relay Y0~Y77 64
※4
M0~M199【M200~M319】 320
For Special Usage ※5M8000~M8079
For Special Usage ※5M8120~M8139
M Internal Relay ※
128
For Special Usage 5M8170~M8172
For Special Usage ※5M8238~M8242
For Special Usage ※5M8350~M8370
S Flow S0~S31 32
T0~T23: 100ms not accumulation
T100~T115: 100ms accumulation
T Timer T200~T223: 10ms not accumulation 80
T300~T307: 10ms accumulation
T400~T403: 1ms not accumulation
2 Soft Component’s Function
C620~C621
C630~C631
D0~D99【D100~D149】※4 150
※5
For Special Usage D8000~D8029
For Special Usage ※5D8060~D8079
D Data Register For Special Usage ※5D8120~D8179
138
For Special Usage ※5D8240~D8249
For Special Usage ※5D8306~D8313
For Special Usage ※5D8460~D8469
FD0~FD411 412
For Special Usage ※5FD8000~FD8011
XC2 Series
Range Points
Internal
X※2 Relay X0~X1037 544
Internal
Y※3 Relay Y0~Y1037 544
M0~M2999 【M3000~M7999】
Internal
※4 8000
M
Relay
For Special Usage※5M8000~M8767 768
S0~S511 【S512~S1023】
S Flow ※4 1024
2 Soft Component’s Function
FD0~FD127 128
FLASH
FD
Register For Special Usage※5FD8000~FD8383 384
XC3 Series
Range Points
Mnemonic Name 14 24/32 48/60
14 I/O 24/32 I/O 48/60 I/O I/O I/O I/O
X0~X15 X0~X33
Input Points X0~X7 8 14/18 28/36
X0~X21 X0~X43
I/O Points
※1
Y0~Y11 Y0~Y23
Output Points Y0~Y5 6 10/14 20/24
Y0~Y15 Y0~Y27
M0~M2999 【M3000~M7999】
※4 8000
M Internal Relay
For Special Usage※5M8000~M8767 768
S0~S511 【S512~S1023】
S Flow ※4 1024
FD0~FD3071 3072
FlashROM
FD
REGISTER※6
For Special Usage※5FD8000~FD9023 1024
EXPANSION’S
ED※7 INTERNAL ED0~ED16383 16384
REGISTER
XC5 Series
X0~X15 X0~X33
Input Points 14/18 28/36
X0~X21 X0~X43
I/O Points
※1
Y0~Y11 Y0~Y23
Output Points 10/14 20/24
Y0~Y15 Y0~Y27
M0~M3999 【M4000~M7999】
※4 8000
M Internal Relay
For Special Usage※5M8000~M8767 768
S0~S511 【S512~S1023】
S Flow ※4
1024
XCM Series
FD0~FD1535 1536
FlashROM For Special Usage※5FD8000~FD8349
FD
REGISTER※6 460
For Special Usage※5FD8890~FD8999
EXPANSION’S
ED※7 INTERNAL ED0~ED36863 36864
REGISTER
XCC Series
Y0~Y11
Output Points Y0~Y15 10/14
EXPANSION’S
ED※7 INTERNAL ED0~ED36863 36864
REGISTER
※1: I/O points, means the terminal number that users can use to wire the input, output
※2: X, means the internal input relay, the X beyond Input points can be used as middle relay;
※3: Y, means the internal output relay, the Y beyond Output points can be used as middle relay;
※4: The memory zone in【 】 is power off retentive zone, soft components D、M、S、T、C
can change the retentive area via setting. Please refer to 2-3-2 for details;
※5: For special use, means the special registers occupied by the system, can’t be used for other
purpose. Please refer to Appendix 1.
2 Soft Component’s Function
※6: FlashROM registers needn’t set the power off retentive zone, when power is off (no battery), the
data will not lose
※7: Expansion’s internal register ED, require PLC hardware V3.0 or above
※8: Input coils、output relays are in octal form, the other registers are in decimal form;
※9: The I/O that is not wired with external device can be used as fast internal relays;
※10: For the soft components of expansion devices, please refer to relate manuals;
The power off retentive area of XC series PLC are set as below, this area can be set by user again;
System’s
Soft SET default Retentive
FUNCTION
components AREA value Zone
T FD8204 Start tag of T power off retentive zone 640 Not set
2 Soft Component’s Function
XC5 T FD8204 Start tag of T power off retentive zone 640 Not set
Series
C FD8205 Start tag of C power off retentive zone 320 C320~C639
S FD8206 Start tag of S power off retentive zone 512 S512~S1023
Start tag of ED power off retentive
ED FD8207 zone 0 ED0~ED36863
zone
T FD8204 Start tag of T power off retentive zone 640 Not set
C FD8205 Start tag of C power off retentive zone 320 C320~C639
S FD8206 Start tag of S power off retentive zone 512 S512~S1023
Start tag of ED power off retentive
ED FD8207 zone 0 ED0~ED36863
XCC T FD8204 Start tag of T power off retentive zone 620 Not set
series
C FD8205 Start tag of C power off retentive zone 320 C320~C639
S FD8206 Start tag of S power off retentive zone 512 S512~S1023
Start tag of ED power off retentive
ED FD8207 zone 0 ED0~ED36863
User can set the power off retentive area through the XCPpro software:
Open XCPpro software, click save hold memory. Click read from PLC to show the current area.
For example: For XC3 series PLC, D: 100 means the area is from D100~D7999.
After changing the area, please click ok and download an empty program inside PLC.
2 Soft Component’s Function
Number List
XC series PLC’s input/output are all in octal form, each series numbers are listed below:
Range Points
Series Name 16
10I/O 16 I/O 24 I/O 32 I/O 10 I/O I/O 24 I/O 32 I/O
Range Points
Range Points
Range Points
Series Name
24/32 I/O 48/60 I/O 24/32 I/O 48/60 I/O
X0~X15 X0~X33
X X0~X21 X0~X43 14/18 28/36
XC5
Y0~Y11 Y0~Y23
Y Y0~Y15 Y0~Y27 10/14 20/24
Range Points
Series Name
24 I/O 32 I/O 48 I/O 24 I/O 32 I/O 48 I/O
X X0~X15 X0~X21 X0~X33 14 18 28
XCM
Y Y0~Y11 Y0~Y15 Y0~Y23 10 14 20
Range Points
Series Name
24 I/O 32 I/O 24 I/O 32 I/O
X X0~X15 X0~X21 14 18
XCC
Y Y0~Y11 Y0~Y15 10 14
Function
2 Soft Component’s Function
XC series PLC
CPU unit
Input Relay
X
⚫ PLC’s input terminals are used to accept the external signal input, while the input relays are a type
of optical relays to connect PLC inside and input terminals;
⚫ The input relays have countless normally ON/OFF contactors, they can be used freely;
⚫ The input relays which are not connected with external devices can be used as fast internal relays;
Output Relay
Y
⚫ PLC’s output terminals can be used to send signals to external loads. Inside PLC, output relay’s
external output contactors (including relay contactors, transistor’s contactors) connect with output
terminals.
⚫ The output relays have countless normally ON/OFF contactors, they can be used freely;
⚫ The output relays which are not connected with external devices can be used as fast internal relays;
Execution Order
XC series PLC
CPU unit
Program
Dispose Area
⚫ Input Disposal
➢ Before PLC executing the program, read every input terminal’s ON/OFF status of PLC to
the image area.
➢ In the process of executing the program, even the input changed, the content in the input
image area will not change. However, in the input disposal of next scan cycle, read out the
change.
⚫ Output Disposal
➢ Once finish executing all the instructions, transfer the ON/OFF status of output Y image area
to the output lock memory area. This will be the actual output of the PLC.
2 Soft Component’s Function
➢ The contacts used for the PLC’s external output will act according to the device’s response
delay time.
Number List
The auxiliary relays M in XC series PLC are all in decimal form; please refer the details from tables
below:
RANGE
M8000~M8079
M8120~M8139
RANGE
RANGE
RANGE
RANGE
RANGE
Function
In PLC, auxiliary relays M are used frequently. This type of relay’s coil is same with the output relay.
They are driven by soft components in PLC;
Auxiliary relays M have countless normally ON/OFF contactors. They can be used freely, but this type
of contactors can’t drive the external loads.
⚫ For common use
➢ This type of auxiliary relays can be used only as normal auxiliary relays. I.e. if power supply
suddenly stops during the running, the relays will disconnect.
➢ Common usage relays can’t be used for power off retentive, but the zone can be modified;
XC series PLC’s status relays S are addressed in form of decimal; each subfamily’s
Address List ID is listed below:
RANGE
SERIES NAME
FOR COMMON USE FOR POWER-OFF RETENTIVE USE
XC2 S S000~S511 S512~S1023
RANGE
SERIES NAME
FOR COMMON USE FOR POWER-OFF RETENTIVE USE
XC3 S S000~S511 S512~S1023
RANGE
SERIES NAME
FOR COMMON USE FOR POWER-OFF RETENTIVE USE
XC5 S S000~S511 S512~S1023
RANGE
SERIES NAME
FOR COMMON USE FOR POWER-OFF RETENTIVE USE
XCM S S000~S511 S512~S1023
Status relays are very import in ladder program; usually use them with instruction
“STL”. In the form on flow, this can make the program’s structure much clear and
Function
easy to modify;
2- .Timer (T)
7
2 Soft Component’s Function
RANGE
SERIES NAME
FOR COMMON USE POINTS
T0~T23: 100ms not accumulation
T100~T115: 100ms accumulation
T200~T223: 10ms not accumulation
XC1 T 80
T300~T307: 10ms accumulation
T400~T403: 1ms not accumulation
T500~T503: 1ms accumulation
T0~T99: 100ms not accumulation
T100~T199: 100ms accumulation
XC2
T200~T299: 10ms not accumulation
XC3
XC5 T T300~T399: 10ms accumulation 640
XCM T400~T499: 1ms not accumulation
XCC
T500~T599: 1ms accumulation
T600~T639: 1ms with precise time
The timers accumulate the 1ms, 10ms, 10ms clock pulse, the output contactor
Function activates when the accumulation reaches the set value;
We use OUT or TMR instruction to time for the normal timers. We use constant (K) to set the value,
or use data register (D) to indirect point the set value;
2 Soft Component’s Function
Timer T0~T599 is 16 bits linear increment mode (0~K32767), when the timer’s value
Timer Value reaches the max value K32767, it stops timing. The timer’s status keeps
still;
2- .Counter (C)
8
XC series PLC counters’ number are all decimal, please see the following table for
Number list all the counter numbers.
TYPE DESCRIPTION
16 bits forward counter C0~C299
32 bits forward/backward C300~C599 (C300,C302...C598)(each occupies 2 counters
counter number) the number should be even
Counter
The characteristics of 16 bits and 32 bits counters:
characteristics
Changing of the
current value Change after positive count Change after positive count (Loop counter)
Hold the action after Hold the action after positive count, reset if
Output contact positive count negative count
The assignment of common use counters and power off retentive counters, can me
Function changed via FD parameters from peripheral devices;
16 bits binary increment counters, the valid value is K1~K32,767 (decimal type
constant). The set value K0 and K1 has the same meaning. I.e. the output contact
works on the first count starts
X0
RST C0 If cut the PLC power supply, the normal
counter value become zero, the retentive K10
X1 counter can store the value, it can accumulate the
C0
value of last time.
C0
Y0
2 Soft Component’s Function
When X001 is ON once, the counter increases 1. When the counter value is 10, its output is
activated. After, when the X001 is ON again, the counter continues
increasing 1.
It also can set the counter value in D register. For example, D10=123 is the same
as K123.
X3 If M8238=1, it is
RST C300 decrease mode;
M8238=0, it is increase mode.
X4
C300 Set the count value in K or D, if set in D0 register,
D0 and D1 will be seemed as one
C300
Y1 32bits value.
⚫
⚫
⚫
K10
X004 is ON, C300 starts to count.
value
16 bits counter
《
set as constant K》 《set in D register》
X000
X001 MOV K100 D5
C0 K100
X001
D5 C0
32 bits counter
》
《set as constant K 《set in D register》
X000
X001 DMOV K43100 D0
C300 K43,100
D0(D1)
X001
C300
Count value
C0~C299 are 16 bits linear increase counter (0~32767), when the counter value reaches 32767, it will
stop count and keep the state.
C300~C599 are 32 bits linear increase/decrease counter (-2147483648~+2147483647), when the
counter value reaches 2147483647, it will become -2147483648, when the counter value reaches -
2147483648, it will become 2147483647, the counter state will change as the count value.
RANGE
D8000~D8029
D8060~D8079
D8120~D8179
XC1 D D0~D99 D100~D149 138
D8240~D8249
D8306~D8313
D8460~D8469
D8000~D8511
XC2 D D0~D999 D4000~D4999 612
D8630~D8729
XC3
XC5 D D0~D3999 D4000~D7999 D8000~D9023 1024
Data register is soft element which used to store data, it includes 16 bits and
Structure 32 bits. ( 32 bits contains two registers, the highest bit is sign bit )
D0(16 bits)
0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0
b15 B0
Sign bit 0:
pos itive
1: negative
Use the applied instruction to read and write the register data. Or use other
devices such as HMI.
2 Soft Component’s Function
bit 0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 bit
b31 b0
Sign bit
0 : positive
1 : negative
When appoint the 32bits register, if set D0, the PLC will connect the next register D1 as
the high bits. Generally, we often appoint even address register.
Function
⚫ Normal type
➢ When write a new value in the register, the former value will be covered.
➢ When PLC from RUN to STOP or STOP to RUN, the value in the register will be cleared.
⚫ Retentive type
➢ When PLC from RUN to STOP or power off, the value in the register will be retained.
➢ The retentive register range can be set by user.
⚫ Special type
➢ Special register is used to set special data, or occupied by the system.
➢ Some special registers are initialized when PLC is power on.
➢ Please refer to the appendix for the special register address and function.
⚫ Used as offset (indirect appoint)
➢ Data register can be used as offset of soft element.
➢ Format : Dn[Dm]、Xn[Dm]、Yn[Dm]、Mn[Dm].
➢ Word offset: DXn[Dm] means DX[n+Dm].
➢ The offset value only can be set as D register.
M8002
MOV K0 D0
M2
MOV K5 D0
M8000
MOV D10[D0] D100
Y0[D0]
Data register D can deal with many kinds of data and realize various controls.
Example
⚫ Data storage
M0
When M0 is ON, transfer the MOV D0 D10 value of D10 to D0
M0
MOV C10 D0 When M0 is ON, move the value of C10 to D0.
2- 0.Constant
1
⚫ Constant K
K is used to display decimal numbers. K10 means decimal number 10. It is used to set timer and counter
value, operand value of applied instruction.
⚫ Constant H
H is used to display hex numbers. H10 means hex number 10. It is used to set operand value of applied
instruction.
2- 1.PROGRAM PRINCIPLE
1
⚫ Tag P、I
Tag P、I are used in branch division and interruption.
Tag for branch (P) is used in condition jump or subroutine’s jump target; Tag for
interruption (I) is used to specify the e input interruption, time interruption; The
tags P、I are both in decimal form, each coding principle is listed below:
SERIES NAME RANGE
XC1、XC2、XC3、XC5、XCM P P0~P9999
RANGE
SERIES NAME FOR EXTERNAL
INTERRUPTION For time interruption
2 Soft Component’s Function
Falling
Input Rising edge edge
terminals interruption
interruption
X2 I0000 I0001 There are 10 channels time interruption,
the represented method is: I40**~I49**.
X5 I0100 I0101 (“**” represents interruption time, the unit
XC2 I
is mm)
X10 I0200 I0201
RANGE
FOR EXTERNAL
INTERRUPTION
SERIES I/O
NAME Rising Falling For time interruption
Input edge edge
terminals interruption
interruption
14 X7 I0000 I0001
X2 I0000 I0001
24
X5 I0100 I0101 There are 10 channels time interruption,
32
X10 I0200 I0201 the represented method is: I40**~I49**.
XC3 I
(“**” represents interruption time, the
19 X10 I0000 I0001 unit is mm)
48 X7 I0100 I0101
60
X6 I0200 I0201
RANGE
FOR EXTERNAL
INTERRUPTION
SERIES I/O
NAME Rising Falling For time interruption
Input edge edge
terminals interruption
interruption
X2 I0000 I0001
X5 I0100 I0101
24
X10 I0200 I0201
32 There are 10 channels time interruption,
X11 I0300 I0301
the represented method is: I40**~I49**.
XC5 I
X12 I0400 I0401 (“**” represents interruption time, the
unit is mm)
X2 I0000 I0001
48
X5 I0100 I0101
60
X10 I0200 I0201
2 Soft Component’s Function
RANGE
FOR EXTERNAL
INTERRUPTION
SERIES I/O
NAME Rising Falling For time interruption
Input edge edge
terminals interruption
interruption
X2 I0000 I0001
X5 I0100 I0101 There are 10 channels time interruption,
24 the represented method is: I40**~I49**.
XCM I X10 I0200 I0201
32 (“**” represents interruption time, the
X11 I0300 I0301 unit is mm)
X12 I0400 I0401
X1
If coil X0 gets ON, jump to the step behind
Y0 tag P1;
If the coil X0 is not ON, do not execute
P1 jump action, but run with the original
program;
X2
RST T0
X0
CALL P10
If X0 gets ON, jump to the subroutine
from the main program; If the coil is not
ON, run with the original program;
FEND
P10
After executing the subroutine, return to the
main program;
SRET
2 Soft Component’s Function
Tag I is usually used in interruption, including external interruption, time interruption etc.
use with IRET (interruption return)、EI (enable interruption)、DI (disable interruption);
⚫ External interruption
➢ Accept the input signal from the special input terminals, not affected by the scan
cycle. Activate the input signal, execute the interruption subroutine.
➢ With external interruption, PLC can dispose the signal shorter than scan cycle; so
it can be used as essential priority disposal in sequence control, or used in short time pulse
control.
⚫ Time interruption
➢ Execute the interruption subroutine at each specified interruption loop tine. Use this
interruption in the control which requires it to be different with PLC’s operation cycle;
When use this input/output format in a batch, the drive time and operation cycle of input filter and
output device will also appear response delay.
Y3
Y4
X2
Y3
2 Soft Component’s Function
3-3.[AND], [ANI]
3-4.[OR], [ORI]
3-6.[LDD], [LDDI]
3-7.[ORB]
3-8.[ANB]
3-9.[MCS], [MCR]
3-10.[ALT]
3-11.[PLS], [PLF]
3-12.[SET], [RST]
3-13.[OUT], [RST] (Aim at counter device)
3-14.[NOP], [END]
3-15.[GROUP], [GROUPE]
All XC1, XC2, XC3, XC5, XCM, XCC series support the below instructions:
Mnemonic Function Format and Device Chapter
LD Initial logical operation 3-2
(LoaD) contact type NO (normally
open) M0
X、Y、M、S、T、C、Dn.m、FDn.m
LDD Read the status from the 3-6
(LoaD contact directly X0
D
Directly)
X
LDI Initial logical operation 3-2
(LoaD contact type NC (normally
Inverse) closed) M0
X、Y、M、S、T、C、Dn.m、FDn.m
LDDI Read the normally closed 3-6
contact directly X0
D
X
LDP Initial logical operation- 3-5
(LoaD Rising edge
Pulse) pulse M0
X、Y、M、S、T、C、Dn.m、FDn.m
LDF Initial logical operation- 3-5
(LoaD Falling /trailing
Falling edge pulse M0
Pulse)
X、Y、M、S、T、C、Dn.m、FDn.m
AND Serial connection of NO 3-3
(AND) (normally open) contacts
M0
X、Y、M、S、T、C、Dn.m、FDn.m
ANDD Read the status from the 3-6
contact directly X0
D
X
ANI Serial connection of NC 3-3
(AND (normally closed) contacts
Inverse)
M0
X、Y、M、S、T、C、Dn.m、FDn.m
ANDDI Read the normally closed 3-6
contact directly X0
D
X、Y、M、S、T、C、Dn.m、FDn.m
ANDF Serial connection of 3-5
(AND falling/trailing edge pulse
Falling M0
pulse)
X、Y、M、S、T、C、Dn.m、FDn.m
OR Parallel connection of NO 3-4
(OR) (normally open) contacts
M0
X、Y、M、S、T、C、Dn.m、FDn.m
ORD Read the status from the 3-6
contact directly
X0
D
X
ORI Parallel connection of NC 3-4
(OR (normally closed) contacts
M0
Inverse)
X、Y、M、S、T、C、Dn.m、FDn.m
ORDI Read the normally closed 3-6
contact directly
X0
D
X
ORP Parallel connection of rising 3-5
(OR edge pulse
M0
Pulse)
X、Y、M、S、T、C、Dn.m、FDn.m
ORF Parallel connection of 3-5
(OR falling/trailing edge pulse
M0
Falling
pulse)
X、Y、M、S、T、C、Dn.m、FDn.m
ANB Serial connection of multiply 3-8
(ANd parallel circuits
Block)
None
ORB Parallel connection of 3-7
(OR multiply parallel circuits
Block)
None
OUT Final logic operation type 3-2
Y0
(OUT) coil drive
Y、M、S、T、C、Dn.m
OUTD Output to the contact 3-6
directly
Y0
D
Y
SET Set a bit device SET Y0 3-12
(SET) permanently ON
Y、M、S、T、C 、Dn.m
RST Reset a bit device RST Y0 3-12
(ReSeT) permanently OFF
Y、M、S、T、C 、Dn.m
PLS Rising edge pulse PLS Y0 3-11
(PuLSe)
X、Y、M、S、T 、C、Dn.m
PLF Falling/trailing edge pulse PLF Y0 3-11
(PuLse
Falling)
X、Y、M、S、T 、C、Dn.m
MCS Connect the public serial Y0 3-9
(New bus contacts
line start)
None
MCR Clear the public serial Y0 3-9
(Bus line contacts
return)
None
ALT The status of the assigned 3-10
device is inverted on every ALT M0
(Alternate
state) operation of the instruction
X、Y、M、S、T、C、Dn.m
END Force the current program END 3-14
(END) scan to end
None
GROUP Group GROUP 3-15
N one
GROUPE Group End GROUP E 3-15
None
TMR Time 2-7
T0 K10
( )
Operands: X、Y、M、S、T、C、Dn.m、
FDn.m
LDI Initial logic operation contact
(LoaD Inverse) type NC (Normally
Closed) M0
Devices:X、Y、M、S、T、C、Dn.m、
FDn.m
OUT Final logic operation type
Y0
(OUT) drive coil
Operands: X、Y、M、S、T、C、Dn.m
Statement
⚫ Connect the LD and LDI instructions directly to the left bus bar. Or use them to define
a new block of program when using ANB instruction.
⚫ OUT instruction is the coil drive instruction for the output relays、auxiliary relays、
status、timers、counters. But this instruction can’t be used for the input relays ⚫ Can
not sequentially use parallel OUT command for many times.
⚫ For the timer’s time coil or counter’s count coil, after using OUT instruction, set constant
K is necessary.
⚫ For the constant K’s setting range、actual timer constant、program’s step relative to
OUT instruction (include the setting value), See table below:
Program
X0 LD
Y100
X0
X1
M1203 OUT Y100
T0 K19 LDI X1
T0
Y1
OUT M1203
OUT T0 K19
LD T0
OUT Y1
3- .[AND] , [ANI]
3
Statements
⚫ Use the AND and the ANI instruction for serial connection of contacts. As many contacts
as required can be connected in series. They can be used for many times.
⚫ The output processing to a coil, through writing the initial OUT instruction is called a
“follow-on” output (For an example see the program below: OUT M2 and OUT Y003).
Follow-on outputs are permitted repeatedly as long as the output order is correct. There’s
no limit for the serial connected contacts’ Nr. and follow-on outputs’ number.
Y2 X2 M1 LD X2
Y2 X3
M2 AND M1
Program OUT Y2
T1
Y3
LD Y2
ANI X3
OUT M2 AND T1
OUT Y3
3- .[OR] , [ORI]
4
OR Parallel connection of
(OR) NO (Normally Open)
contacts M0
Operands: X、Y、M、S、T、C、Dn.m、FDn.m
ORI Parallel connection of
(OR NC (Normally
M0
Inverse) Closed) contacts
Operands: X、Y、M、S、T、C、Dn.m、FDn.m
Statements
⚫ Use the OR and ORI instructions for parallel connection of contacts. To connect a block
that contains more than one contact connected in series to another circuit block in parallel,
⚫ OR and ORI start from the instruction’s step, parallel connect with the LD and LDI
instruction’s step said before. There is no limit for the parallel connect times.
X5 LD X5
Y6
X6 OR X6
Program M11
OR M11
Y6 M4 X7
M100 OUT Y6
M12
LDI Y6
M13
AND M4
OR M12
ANI X7
OR M13
OUT M100
Relationship with ANB
Statements
LDP、ANDP、ORP are active for one program scan after the associated devices switch from
OFF to ON.
LDF、ANDF、ORF are active for one program scan after the associated devices switch from
ON to OFF.
X5 LDP X5
M13
X6 ORP X6
Program M8000 X7
M15 OUT M13
LD M8000
ANDP X7
OUT M15
(AND pulse
Pulse)
Operands: X、Y、M、S、T、C、Dn.m、FDn.m
Operands: X、Y、M、S、T、C、Dn.m、FDn.m
ORF Parallel connection of
(OR Falling Falling/trailing edge pulse
pulse) M0
Operands: X、Y、M、S、T、C、Dn.m、FDn.m
Devices: X
LDDI Read the normally
X0
closed contact directly
D
Devices: X
ANDD Read the status from the
contact directly X0
D
Devices: X
ANDDI Read the normally
X0
closed contact directly
D
Devices: X
ORD Read the status from the
contact directly
X0
D
Devices: X
ORDI Read the normally
closed contact directly
X0
D
Devices: X
OUTD Output to the contact
directly
Y0
D
Devices: Y
Statement
Y0 X0 X2 LDD
Program MD13 X0
X1 D D LDDI
D
X2
ORD X2
ANB
OUTD Y0
3- .[ORB]
7
Statements
➢ The serial connection with two or more contacts is called "serial block". If parallel connect the
serial block, use LD, LDI at the branch start place, use ORB at the stop place;
➢ As the ANB instruction,an ORB instruction is an independent instruction and is not associated
with any device number.
➢ There are no limitations to the number of parallel circuits when using an ORB instruction in the
sequential processing configuration.
Program
ORB
OUT
3- .[ANB]
8
Program
Devices:None
MCR Denotes the
(Master end of a master
control control block Y0
Reset)
Devices:None
LD X0
OR X1
LD X2 Start of a branch
AND X3
LDI X4
AND X5 End of a parallel circuit block
ORB
OR X6
ANB Serial connect with the preceding circuit
OR X7
OUT Y20
3-9.[MCS] , [MCR ]
➢
MCS、MCR instructions should use in pair.
➢ The bus line could be used nesting. Between the matched MCS、MCR
instructions use matched MCS 、 MCR instructions. The nest level
increase with the using of MCS instruction. The max nest level is 10.
When executing MCR instruction, go back to the upper bus line.
➢ When use flow program, bus line management could only be used in the
same flow. When end some flow, it must go back to the main bus line.
line.
Program X1 X2 LD X1
Y0
MCS Bus line starts
M1 M3
Y1 LD X2
M2 OUT Y0
Y2
LD M1
M3
Y1
M2
Y2
LD
OUT
LD
OUT
MCR
MCR Bus line back
3- 0.[ALT]
1
The status of the destination device is alternated on every operation of the ALT
Statements instruction.
M100 LDP M100
ALT M0
ALT M0
Program
M0 LD M0
Y0
OUT Y0
M0
Y1 LDI M0
OUT Y1
3- 1.[PLS] , [PLF]
1
(Pulse) pulse
⚫ When a PLS instruction is executed, object devices Y and M operate for one
Statements operation cycle after the drive input signal has turned ON.
⚫ When a PLF instruction is executed, object devices Y and M operate for one
operation cycle after the drive input signal has turned OFF.
Program
LD
X0
RST Y0
3- 2.[SET] , [RST]
1
device
permanently
OFF
、S、T、C、Dn.m
Devices: Y、M
Turning ON X010 causes Y000 to turn ON. Y000 remains ON even after X010
Statements turns OFF. Turning ON X011 causes Y000 to turn OFF. Y000 remains OFF even after
X011 turns OFF. It’s the same with M、S. ⚫ SET and RST instructions can be used for
the same device as many times
as necessary. However, the last instruction activated determines the
current status.
Besides, it’s also possible to use RST instruction to reset the current
When use SET, RST commands, avoid to use the same ID with OUT
command;
LD X10
X10
Program SET Y0 SET Y0
X11 LD X11
RST Y0
RST Y0
X12
SET M50 LD X12
X13 SET M50
RST M50
LD X13
X14
SET S0 RST M50
X15 LD X14
RST S0
SET S0
X10 K10
T250 LD X15
X17 RST S0
RST T250 LD X10
OUT T250 K10
X10 LD X17
RST T250
X11
Y0
device
permanently
OFF
Device:C
In the preceding example, when M0 is ON, carry on positive count with OFF→ON of
X0.
Counter’s current value increase, when reach the set value (K or D), the output contact is
reset.
When M1 is ON, counter’s C600 output contact is reset, counter’s current value turns to be
0.
3- 4. [END]
1
(END) current
program scan
to end
Devices:
None
Statements
PLC repeatedly carry on input disposal, program executing and output disposal. If
write END instruction at the end of the
program, then the instructions behind END
instruction won’t be executed. If there’s no
END instruction in the program, the PLC
executes the end step and then repeat
executing the program from step 0.
When debug, insert END in each program
segment to check out each program’s action.
Then, after confirm the correction of
preceding block’s action, delete END
instruction.
Besides, the first execution of RUN begins with
END instruction.
When executing END instruction, refresh monitor timer. (Check if scan cycle is a long timer.)
3- 5.[GROUP] , [GROUPE]
1
Mnemonic and Function
Devices: None
GROUPE GROUP END GROUPE
Devices: None
Statements
There are other methods. E.g. jump instructions or step ladder. However, when use step ladder, if
the main program’s output coil is programmed, then the disposal method is the same with dual coil,
please note this.
4 Applied Instructions
4-3.Flow Instructions
4-5.Move Instructions
4-8.Data Convert
4-9.Floating Operation
4-10.Clock Operation
Program Flow
Conditi
CJ Pn
CJ on 4-3-1
jump
Call
CALL Pn
CALL subrout 4-3-2
ine
Subrou
SRET tine 4-3-2
SRET
return
Flow
STL 4-3-3
start STL Sn
Flow
STLE 4-3-3
end STLE
Open
the
assigned
SET flow, SET Sn 4-3-3
close the
current
flow
Open
the
assigned
flow,
ST 4-3-3
not ST Sn
close the
current
flow
Start a
FOR- FOR S
FOR 4-3-4
NEXT
loop
End of
a FOR-
NEXT 4-3-4
NEXT
NEXT
loop
Main
FEND program 4-3-5
FEND
END
Program
END END
4-3-5
END
Data Compare
LD= LD
activates
4-4-1
if (S1) =
LD= S1 S2
(S2)
LD> LD
activates
4-4-1
if (S1) >
LD> S1 S2
(S2)
LD< LD
activates
4-4-1
if (S1)
LD< S1 S2
=< (S2)
LD< LD
> activates
if ( S1 4-4-1
) ≠ (
LD<> S1 S2
S2)
LD< LD
= activates
if ( S1 4-4-1
) ≤ (
LD<= S1 S2
S2)
LD> LD
= activates
if ( S1 4-4-1
) ≥ (
LD>= S1 S2
S2)
AND= AND
activates
if ( S1 4-4-2
)=(
AND= S1 S2
S2)
AND AND
> activat 4
es if( -
S1 ) AND> S1 S2 4
-
> ( 2
S2)
AND AND
< activat 4
es if( -
AND< S1 S2 4
S1 )
-
< ( 2
S2)
AND AND
<> activat 4
es if( -
S1)≠ AND<> S1 S2 4
-
( S2
2
)
AND AND
<= activat 4
es if( -
AND<= S1 S2 4
S1)≤
-
( S2 2
)
AND AND
>= activat 4
es if( -
S1)≥ AND= S1 S2 4
-
( S2
2
)
OR OR
= activat 4
es if( -
S1 ) 4
-
= ( 3
OR= S1 S2
S2)
OR OR
> activat 4
es if( -
S1 ) 4
-
> ( 3
OR> S1 S2
S2)
OR OR
< activat 4
es if( -
S1 ) 4
-
< ( 3
OR< S1 S2
S2)
OR OR
<> activat 4
es if( -
S1)≠ 4
-
( S2 3
OR<> S1 S2
)
OR OR
<= activat 4
es if( -
S1)≤ 4
-
( S2 3
OR<= S1 S2
)
OR OR
>= activat 4
es if( -
S1)≥ 4
-
( S2
OR>= S1 S2
3
)
Data Move
4
Comp -
CMP are the CMP S1 S D 5
data -
1
Comp 4
are the -
ZCP data in ZCP S1 S2 S D 5
certai -
n area 2
4
-
MO Mov MOV S D 5
V e
-
3
4
Bloc -
BM BMOV S D n
k 5
OV
move -
4
4
Transf
-
PMO er the PMOV S D n 5
V Data
-
block
5
Multi
- 4
point -
FMO
s FMOV S D n 5
V
repea -
t 6
move
Flash 4
RO -
FWR FWRT S D
M 5
T
writt -
en 7
4
-
MSE Zone MSET S1 S2 5
T set
-
8
4
-
ZRS Zone ZRST S1 S2 5
T reset
-
9
Swa 4
p the -
SWA high SWAP S 5
P and -
low 1
byte 0
4
-
XC Exchange XCH D1 D2 5
H two values -
1
1
4
-
EM Float 5
OV move -
1
2
Data
Operat
ion
4
-
AD Add ADD S1 S2 D 6
D ition
-
1
4
Subtr -
SU SUB S1 S2 D
actio 6
B
n -
2
4
Multip -
MU
licatio 6
L
n -
MUL S1 S2 D 3
4
-
DI Divi DIV S1 S2 D 6
V sion
-
4
4
-
Incre INC D
INC 6
ment
-
5
Decr 4
DE
emen -
C
t 6
DEC D -
5
4
M -
ME
ea 6
AN
n -
MEAN S D n 6
4
Wor -
WA WAND S1 S2 D
d 6
ND
And -
7
4
Wor -
WO WOR S1 S2 D
d 6
R
OR -
7
4
Word -
WX WXOR S1 S2 D
exclusive 6
OR
OR -
7
4
-
CM Comp CML S D 6
L liment
-
8
4
Neg -
NE NEG D
ativ 6
G
e -
9
Data
Shift
4
-
SH Arithmetic SHL D n 7
L Shift Left
-
1
4
-
SH Arithmetic SHR D n 7
R Shift Right
-
1
4
Logic -
LS LSL D n
shift 7
L
left -
2
4
Logic -
LS LSR D n
shift 7
R
right -
2
4
-
RO Rotation ROL D n 7
L shift left
-
3
4
Rotation -
RO ROR D n
shift 7
R
right -
3
SFTL S Dn n 4
SFT Bit shift 1 2 -
L left 7
-
4
SFTR S Dn n 4
SFT Bit shift 1 2 -
R right 7
-
5
WSFL SDn n 4
WS Word shift 1 2 -
FL left 7
-
6
WSFR n1
S n 4
WS Word shift 2 -
FR right 7
-
7
Data Convert
Single
word 4
integer WTD -
WT
converts 8
D
to double -
word 1
S D
integer
16 bits 4
integer -
FLT converts FLT
8
to float -
point S D 2
32 bits 4
integer -
DFL converts DFLT
8
T to float -
point S D 2
64 bits 4
integer -
FLT converts FLTD
8
D to float -
point S D 2
4
Float
-
point INT
INT 8
converts
-
to integer
S D 3
4
BCD -
BIN
BIN converts to 8
binary -
S D 4
4
Binary -
BC BCD
converts to 8
D
BCD -
S D 5
4
Hex. -
ASC ASCI
converts to 8
I
ASCII -
S D n 6
4
ASCII -
HE HEX
converts to 8
X
Hex. -
S D n 7
4
DEC
Coding -
O DECO S D n 8
-
8
4
-
ENC High bit ENCO 8
O coding
-
S D n
9
4
Lo
-
w
ENC ENCOL 8
bit
OL -
cod
1
ing S D n
0
Float Point Operation
4
-
EC Float ECMP 9
MP compare
-
S1 S2 D 1
4
-
EZC Float Zone EZCP 9
P compare
-
S1 S2 D1 D2
2
4
-
EA EADD
Float Add 9
DD
-
S1 S2 D 3
4
-
ESU Float ESUB 9
B Subtract
-
S1 S2 D 4
Float 4-
EMU
Multipli 9-
L EMUL S1 S2 D 5
cation
4-
Float
EDIV 9-
division EDIV S1 S2 D 6
Float 4-
ESQ ESQR S D
Square 9-
R
Root 7
4-
SIN S D
SIN Sine 9-
8
4-
COS S D
COS Cosine 9-
9
4-
TAN S D
TAN Tangent 9-
10
4-
Floating ASIN S D
ASIN 9-
Sine
11
4-
ACO Floating
9-
S Cosine ACOS S D 12
4-
ATA Floating
9-
N Tangent ATAN S D 13
Clock Operation
Read 4-
TRD D
TRD RTC 10
data -1
Write 4-
TWR D
TWR RTC 10
data -2
4-2.Reading Method of Applied Instructions
In this manual, the applied instructions are described in the following manner.
1. Summary
ADDITION [ADD]
2. Operands
Operands Function Data Type
S1 Specify the augends data or register 16 bits/32 bits, BIN
S2 Specify the summand data or register 16 bits/32 bits, BIN
D Specify the register to store the sum 16 bits/32 bits, BIN
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
Bit D ● ● ● ● ● ● ●
Operands System
X Y M S T C Dn.m
X0
(D10)+(D12)→(D14)
X0
(D11D10)+(D13D12)→(D15D14)
➢ The data contained within the two source devices are combined and total is stored in the
specified destination device. Each data’s highest bit is the sign bit, 0 stands for positive, 1 stand
for negative. All calculations are algebraic processed. (5+ (-8) = -3).
➢ If the result of a calculations is “0”, the “0’ flag acts. If the result exceeds 323,767(16 bits
limit) or 2,147,483,648 (32 bits limit), the carry flag acts. (Refer to the next page). If the result
exceeds -323,768 (16 bits limit) or -2,147,483,648 (32 bits limit ) , the borrow flag acts (Refer
to the next page)
➢ When carry on 32 bits operation, word device’s 16 bits are assigned, the device follow closely
the preceding device’s ID will be the high bits. To avoid ID repetition, we recommend you
assign device’s ID to be even ID.
➢ The same device may be used a source and a destination. If this is the case then the result
changes after every scan cycle. Please note this point.
Related flag
Double word(32 bit)engrosses two data register, it’s composed by two consecutive data registers,
the first one is assigned by double word object instruction. The dispose bound is:
Dec. -214, 748, 364, 8~214, 748, 364, 7, Hex. 00000000~FFFFFFFF.
※1:Flag after executing the instruction, instructions without the direct flag will not display.
※2: S· Source operand, its content won’t change after executing the instruction
※3: D· Destinate operand, its content changes with the execution of the instruction
※4:Tell the instruction’s basic action, using way, applied example, extend function, note items etc.
ST Open the assigned flow, not close the current flow (Open
the new flow) 4-3-3
1. Summary
As used to run a part of program, CJ shorten the operation cycle and using the dual coil
Condition Jump [CJ]
16 bits CJ 32 bits -
Execution Normally ON/OFF coil Suitable XC1.XC2.XC3.XC5.XCM
condition Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
Pn Jump to the target (with pointer Nr.) P (P0~P9999) Pointer's Nr.
Other Pointer
P I
●
In the below graph, if X000 is “ON”, jump from the first step to the next step behind
Description
P6 tag. If X000 “OFF”, do not
X0
CJ P6 execute the jump construction;
P6
X0
CJ P7
X5
Y0
P7
X6
RST T246
1. Summary
Call the programs which need to be executed together, decrease the program's steps;
Subroutine Call [CALL]
2. Operands
Operands Function Data Type
Pn Jump to the target (with pointer Nr.) P (P0~P9999) Pointer's Nr.
Others
Pointer
P I
●
X0
CALL P10
⚫ If X000= “ON”, execute the call
Description
instruction and jump to the step tagged
by P10. After executing the subroutine,
FEND return the original step via SRET
instruction. Program the tag with FEND
P10 instruction (will describe this
instruction later)
⚫ In the subroutine 9 times call is
allowed, so totally
there can be 10 nestings.
SRET
END
1、Summary
Instructions to specify the start, end, open, close of a flow;
Open the specified flow, close the local flow [SET]
Open the specified flow, not close the local flow [ST]
16 bits ST 32 bits -
Execution Normally ON/OFF, Suitable XC1.XC2.XC3.XC5.XCM
condition Rising/Falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
Sn Jump to the target flow S Flow ID
Bit System
Operands
X Y M S T C Dn.m
Sn ●
Description
STL and STLE should be used in pairs. STL represents the start of a flow; STLE represents the
end of a flow.
After executing of SET Sxxx instruction, the flow specified by these instructions is ON.
After executing RST Sxxx instruction, the specified flow is OFF.
In flow S0, SET S1 closes the current flow S0, open flow S1.
In flow S0, ST S2 opens the flow S2, but don’t close flow S0.
When flow turns from ON to be OFF, reset OUT、PLS、PLF、not accumulate timer etc, which
belong to the flow.
ST instruction is usually used when a program needs to run more flows at the same time.
After executing of SET Sxxx instruction, the pulse instructions will be closed (including one-
segment, multi-segment, relative or absolute, return to the origin)
SET S0
STL S0
SET S1
ST S2
STLE
STL S1
STLE
STL S2
STLE
1. Summary
Loop execute the program between FOR and NEXT with the specified times;
Loop starts [FOR]
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S Program’s loop times between FOR~NEXT 16 bits, BIN
Word
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ●
Description
⚫ FOR.NEXT instructions must be programmed as a pair. Nesting is allowed, and the nesting level
is 8.
⚫ Between FOR/NEXT, LDP.LDF instructions are effective for one time. Every time when M0
turns from OFF to ON, and M1 turns from OFF to ON, [A] loop is executed 6 times.
⚫ Every time if M0 turns from OFF to ON and M3 is ON, [B] loop is executed 5×7=35 times.
⚫ If there are many loop times, the scan cycle will be prolonged. Monitor timer error may occur,
please note this.
⚫ If NEXT is before FOR, or no NEXT, or NEXT is behind FENG, END, or FOR and NEXT
number is not equal, an error will occur.
⚫ Between FOR~NEXT, CJ nesting is not allowed, also in one STL, FOR~NEXT must be
programmed as a pair.
S·
M0
FOR K5
M1
FOR K6
INC D0 [A ]
NEXT
M3 [C ]
FOR K7
INC D1 [B ]
NEXT
NEXT
1. Summary
FEND means the main program ends, while END means program ends;
main program ends [FEND]
2. Operands
Operands Function Data Type
None - -
None
Even though [FEND] instruction represents the end of the main program, if
Description
execute this instruction, the function is same with END. Execute the output/input
disposal, monitor the refresh of the timer, and return to the 0th step.
⚫ If program the tag of CALL instruction behind FEND instruction, there must be SRET
instruction. If the interrupt pointer program behind FEND instruction, there must be IRET
instruction.
⚫ After executing CALL instruction and before executing SRET instruction, if execute
FEND instruction; or execute FEND instruction after executing FOR instruction and
before executing NEXT, then an error will occur.
⚫ In the condition of using many FEND instruction, please compile routine or subroutine
between the last FEND instruction and END instruction.
1. Summary
LD□ is the point compare instruction connected with the generatrix.
LD Compare [LD□]
2. Operands
Operands Function Data Type
S1 Specify the Data ( to be compared) or soft 16/32bits, BIN
component’s address code
Word
Operands System Constant Module
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
Description
S1· S2·
X0
LD= K100 C0 Y0
Note Items
X1
LD> D200 K-30 SET Y1
M4
When the source data’s highest bit (16 bits:b15,32 bits:b31) is 1, use the data as a
negative.
1. Summary
AND□: The compare instruction to serial connects with the other contactors.
AND Compare [AND□]
2. Operands
Operands Function Data Type
S1 Specify the Data (to be compared) or soft 16/32bit,BIN
component’s address code
Word
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
Description
X2
DAND> K68899 D10 M50
M4
When the source data’s highest bit (16 bits:b15,32 bits:b31) is 1, use the data as a
negative.
1. Summary
OR□ The compare instruction to parallel connect with the other contactors
Parallel Compare [OR□]
2. Operands
Operands Function Data Type
S1 Specify the Data ( to be compared) or soft 16/32 bit, BIN
component’s address code
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
Description
X0
Y0
S1· S2·
Note Items
OR= K100 C0
X2 M4
M50
When the source data’s highest bit (16 bits:b15,32 bits:b31) is 1, use the data as a
negative.
The comparison of 32 bits counter (C300~) must be 32 bits instruction. If assigned as a 16
bits instruction, it will lead the program error or operation error.
4- .Data Move
5
1. Summary
Compare the two specified Data, output the result.
Data compare [CMP]
2. Operands
Operands Function Data Type
S1 Specify the data (to be compared) or soft 16 bit, BIN
component’s address code
Word
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ● ● ●
S ● ● ● ● ● ● ● ● ●
Bit
Oper System
ands
X Y M S T C Dn..m
D ● ● ●
S1· S· D
X0
CMP D10 D20 M0
Description
M0
D10 > D20 ON
M1
D10 = D20 ON
M2
D10 < D20 ON
⚫ Compare data S 1· and S · , output the three points’ ON/OFF status (start with
1. Summary
Compare the two specify Data with the current data, output the result.
Data Zone compare [ZCP]
16 bits ZCP 32 bits DZCP
Execution Normally ON/OFF, Suitable XC1.XC2.XC3.XC5.XCM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S1 Specify the down-limit Data (of the compare stand) 16 bit, BIN
or soft component’s address code
S2 Specify the Up-limit Data (of the compare stand) 16 bit, BIN
or soft component’s address code
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
Bit
S ● ● ● ● ● ● ● ● ●
Oper System
ands
X Y M S T C Dn..m
D ● ● ●
·
S
S1· S2· D·
X0
D
0
D20 D0 D31(分)
M2
D0 > D31(分) M2 ON
Even X000=OFF stop ZCP instruction,M0~M2 will keep
the original status
Compare S· data with S 1 and S2 , output the three pointD· ’s ON/OFF status according
to the zone size.
D· , D· +1, D· +2 : the three point’s ON/OFF output according to the result
4-5-3.MOV [MOV]
1. Summary
Move the specified data to the other soft components
MOV [MOV]
2. Operands
Operands Function Data Type
S Specify the source data or register’s address code 16 bit/32 bit, BIN
D Specify the target soft component’s address code 16 bit/32 bit, BIN
Description
⚫ Move the source data to the target
same
X0 S· D· ⚫ Convert
MOV K10 D10 constant K10 to be BIN
code automatically
<read the counter’s or time’s current value> <indirectly specify the counter’s, time’s set value>
X2
MOV K10 D20
X1
M0 MOV T0 D20
T20 D20
1. Summary
Move the specified data block to
Data block move [BMOV]
2. Operands
Operands Function Data Type
S Specify the source data block or soft component 16 bits, BIN; bit
address code
D Specify the target soft components address code 16 bits, BIN; bit
n Specify the move data’s number 16 bits, BIN;
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ● ●
n ● ● ● ● ● ● ●
Bit
Operands System
X Y M S T C Dn.m
S ● ● ●
D ● ● ●
➢ Move the specified “n” data to the specified “n” soft components in the form
Description block.
S· D· n n=3
X0
BMOV D5 D10 K3
BMOV D10 D9 K3
X1
X2
D10 D9
D11 D10
D12 D11
D10 D11
D11 D12
D12 D13
1. Summary
Move the specified data block to the other soft components
Data block move[PMOV]
2. Operands
Operands Function Data Type
S Specify the source data block or soft component 16 bits, BIN; bit
address code
D Specify the target soft components address code 16 bits, BIN; bit
n Specify the move data’s number 16 bits, BIN;
S ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ● ●
n ● ● ● ● ● ● ●
Oper system
Bit ands
X Y M S T C Dn.m
S ● ● ●
D ● ● ●
Description
➢ Move the specified “n” data to the specified “n” soft components in form of block
S· D· n
X0
PMOV D5 D10 K3
D5 D10 n=3
D6 D11
D7 D12
⚫ The function of PMOV and BMOV is mostly the same, but the PMOV
has the
faster speed
⚫ PMOV finish in one scan cycle, when executing PMOV , close all the
interruptions
⚫ Mistake many happen, if there is a repeat with source address and target
address
1. Summary
Move the specified data block to the other soft components
Fill Move [FMOV]
2. Operands
Operands Function Data Type
S Specify the source data block or soft component 16 bits, BIN; bit
address code
D Specify the target soft components address code 16 bits, BIN; bit
S ● ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ● ●
n ● ● ● ● ● ● ●
X0
S· D·
n
DFMOV D0 D10 K3
X0
K0 D1
K0 D2
K0 D3
K0 D4
n
K0 D5
K0 D6
K0 D7
K0 D8
K0 D9
1. Summary
Write the specified data to other soft components
FlashROM Write [FWRT]
2. Operands
Operands Function Data Type
S The data write in the source or save in the soft 16 bits/32 bits, BIN
element
Word D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ● ●
D ●
D1 ●
D2 ● ● ● ● ● ● ● ●
S· D· S· D1· D2·
X1 X2
DFWRT D0 FD0 FWRT D0 FD0 K3
Write value in D0, D1 into FD0, FD1 Write value in D0, D1, and D2 into FD0, FD1,
※1:FWRT instruction only allows data to write into FlashROM register. In this storage, even battery
drop, data could be used to store important technical parameters
※2:Written of FWRT needs a long time, about 150ms, so frequently operate this operate this operate
operation is recommended
※3:The written time of FlashROM is about 1,000,000 times. So we suggest using edge signal (LDP,
LDF etc.) to trigger.
※4:Frequently written of FlashROM
1. Summary
Set or reset the soft element in certain range
Multi-set [MSET]
2. Operands
Operands Function Data Type
D1 Start soft element address bit
D2 End soft element address bit
Bit
Operands System
X Y M S T C Dn.m
D1 ● ● ● ● ● ●
D2 ● ● ● ● ● ●
Description MSET M10 M120
X0
Zone set unit
⚫ When D1>
·
1. Summary
Reset the soft element in the certain range
Multi-reset [ZRST]
2. Operands
Operands Function Data Type
D1 Start address of soft element Bit:16 bits, BIN
D2 End address of soft element Bit:16 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
Wor
d D1 ● ● ● ●
D2 ● ● ● ● ●
Bit
Operands System
X Y M S T C Dn.m
D1 ● ● ● ● ● ●
D2 ● ● ● ● ● ●
D1· D2·
X0
ZRST M 500 M 559
Description Zone reset
bits M5
D1· D2·
00~M559
ZRST D0 D100
➢ As fill move for constant K0, 0 can be written into DX, DY, DM, DS,
T, C, and D.
1. Summary
Swap the high and low byte
High and low byte swap [SWAP]
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ●
Word
S·
Description 0 SWAP D 10
D 10
Low 8 -
High 8 -bit bit
4-5-11.Exchange [XCH]
1. Summary
Exchange the data in two soft elements
Exchange [XCH]
2. Operands
Operands Function Data Type
D1 The soft element address 16 bits, BIN
D2 The soft element address 16 bits, BIN
Word D FD ED TD CD DX DY DM DS K /H ID QD
D1 ● ● ● ● ● ●
D2 ● ● ● ● ● ●
X0
⚫
The contents of the two destination devices D1 and D2 are swapped,
⚫ When drive input X0 is ON, each scan cycle should carry on data
exchange, please note.
X0
⚫ 32 bits instruction [DXCH] swaps value composed by D10, D11 and the value composed by D20,
D21.
2. Operands
Operand Function Type
S Source soft element address 32 bits, BIN
D Destination soft element address 32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ●
EMOV D0 D10
X0
(D1,D0)→(D11,D10)
⚫ X0 is ON, send the floating number from (D1, D0) to (D11, D10). ⚫ X0
is OFF, the instruction doesn’t work
S· D·
X0
(K500)→(D11,D10)
1. Summary
Add two numbers and store the result
Add [ADD]
2. Operands
Operands Function Data Type
S1 The number address 16 bit/32 bit, BIN
S2 The number address 16 bit/32bit, BIN
D The result address 16 bit/32bit, BIN
Description
S1· S2 · D·
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
X0
ADD D10 D12 D14
(D10) + (D12) → (D14)
➢ The data contained within the two source devices are combined and the total is stored in the
specified destination device. Each data’s highest bit is the sign bit, 0 stands for positive、1
stands for negative. All calculations are algebraic processed.(5+(-8)= -3)
➢ If the result of a calculation is “0”, the “0” flag acts. If the result exceeds 323,767(16 bits
limit)or 2,147,483,647(32 bits limit), the carry flag acts.(refer to the next page). If the
result exceeds –323,768(16 bits limit)or –2,147,483,648(32 bits limit), the borrow flag
acts (Refer to the next page)
➢ When carry on 32 bits operation, word device’s low 16 bits are assigned, the device following
closely the preceding device’s ID will be the high bits. To avoid ID repetition, we recommend
you assign device’s ID to be even ID.
➢ The same device may be used as a source and a destination. If this is the case then the result
changes after every scan cycle. Please note this point
R elated flag
Flag meaning
Flag Name Function
ON:the calculate result is zero
M8020 Zero
OFF:the calculate result is not zero
ON:the calculate result is less than -32768(16 bit) or -2147483648(32bit)
M8021 Borrow OFF:the calculate result is over -32768(16 bit) or -2147483648(32bit)
ON:the calculate result is over 32768(16 bit) or 2147483648(32bit)
M8022 Carry OFF:the calculate result is less than 32768(16 bit) or 2147483648(32bit)
4-6-2.Subtraction [SUB]
1. Summary
Sub two numbers, store the result
Subtraction [SUB]
2. Operands
Operands Function Data Type
S1 The number address 16 bits /32 bits, BIN
S2 The number address 16 bits /32 bits, BIN
D The result address 16 bits /32 bits, BIN
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
S1· S2· D·
X0
(D10)—(D12)→(D14)
➢ S 1 · Appoint
the soft unit’s content; subtract the soft unit’s content appointed by S
2 in ·
the format of algebra. The result will be stored in the soft unit appointed by D · .
(5-(-8)=13)
➢ The action of each flag, the appointment method of 32 bits operation’s soft units
are both
➢ The importance is: in the preceding program, if X0 is ON, SUB operation will be
executed every scan cycle
The relationship of the flag’s action and vale’s positive/negative is shown below:
4-6-3.Multiplication [MUL]
1. Summary
Multiply two numbers, store the result
Multiplication [MUL]
2. Operands
Operands Function Data Type
S1 The number address 16 bits/32bits,BIN
S2 The number address 16 bits/32bits,BIN
D The result address 16 bits/32bits,BIN
Word D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
MUL D0 D2 D4
X0
➢ The contents of the two source devices are multiplied together and the result is stored at
the destination device in the format of 32 bits. As in the upward chart: when (D0)=8,
➢ The result’s highest bit is the symbol bit: positive (0), negative (1).
➢ When be bit unit, it can carry on the bit appointment of K1~K8. When appoint K4, only
DMUL D0 D2 D4
X1
4-6-4.Division [DIV]
1. Summary
Divide two numbers and store the result
Division [DIV]
2. Operands
Operands Function Data Type
S1 The number address 16 bits / 32 bits, BIN
S2 The number address 16 bits /32 bits, BIN
D The result address 16 bits /32 bits, BIN
Word D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
<16 bits operation >
Description S1· S2· D·
DIV D0 D2 D4
X0
➢ S 1 ·Appoints
the device’s content be the dividend, S2· appoints the device’s content be the
divisor, D· and appoints the device and the next one to store the result and the remainder.
➢ In the above example, if input X0 is ON, division operation is executed every scan cycle.
DDIV D0 D2 D4
X1
➢ The dividend is composed by the device appointed by and the next one. The divisor S1·
is composed by the device appointed by S2 · and the next one. The result and the
remainder are stored in the four sequential devices, the first one is appointed by D·
➢ If the value of the divisor is 0, then an operation error is executed and the operation of
➢ The highest bit of the result and remainder is the symbol bit (positive: 0, negative: 1).
When any of the dividend or the divisor is negative, then the result will be negative. When the
dividend is negative, then the remainder will be negative.
4-6-5.Increment [INC] & Decrement [DEC]
1. Summary
Increase or decrease the number
Increment 1[INC]
Increment 1[DEC]
2. Operands
Operands Function Data Type
D The number address 16 bits / 32bits, BIN
D ● ● ● ● ● ●
< Increment [INC]>
Description D·
X0
INC D0 (D0)+1→(D0)
<Decrement [DEC]>
D·
X1
DEC D0 (D0)-1 →(D0)
4-6-6.Mean [MEAN]
1. Summary
Get the mean value of numbers
Mean [MEAN]
2. Operands
Operands Function Data Type
S The head address of the numbers 16 bits, BIN
D The mean result address 16 bits, BIN
n The number quantity 16 bits, BIN
Word
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ● ● ●
n ●
S· D·
Description n
MEAN D0 D10 K3
X0
(D10)
The value of all the devices within the source range is summed and then divided by the
number of devices summed, i.e. n... This generates an integer mean value which is stored in the
destination device (D) The remainder of the calculated mean is ignored.
If the value of n is specified outside the stated range (1 to 64) an error is generated.
4-6-7. Logic AND [WAND], Logic OR [WOR], Logic Exclusive OR [WXOR]
1. Summary
Do logic AND, OR, XOR for numbers
Logic AND [WAND]
Logic OR[WOR]
2. Operands
Operands Function Data Type
S1 The soft element address 16bit/32bit,BIN
S2 The soft element address 16bit/32bit,BIN
D The result address 16bit/32bit,BIN
S1 ● ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
X0
1 or 0=1 1 or 1=1
If use this instruction along with CML instruction, XOR NOT operation could also
be executed.
S1· S2· D·
X0
WXOR D10 D12 D14
4-6-8.Converse [CML]
1. Summary
Converse the phase of the numbers
Converse [CML]
2. Operands
Operands Function Data Type
S Source number address 16 bits/32 bits, BIN
D Result address 16 bits/32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
Description
S· D·
M0 1 0 1 0 1
↑ CML D0 DY0
D0 0 1 0 1 0 1 0 1 0 1 0
X17
M17
-6-9.Negative [NEG]
4
1. Summary
Get the negative number
Negative [NEG]
2. Operands
Operands Function Data Type
D The source number address 16 bits/ bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
D ● ● ● ● ● ●
D·
M0
NEG D10 (D10) +1 (D10)
Description
➢ The bit format of the selected device is inverted, I.e. any occurrence of a “1’ becomes a “0”
and any occurrence of “0” becomes “1”, when this is complete, a further binary 1 is added to the
bit format. The result is the total logic sigh change of the selected devices contents.
4- .Shift Instructions
7
1. Summary
Do arithmetic shift left/right for the numbers
Arithmetic shift left [SHL]
2. Operands
Operands Function Data Type
D The source data address 16bit/32bit,BIN
n Shift left or right times 16bit/32bit,BIN
D FD ED TD CD DX DY DM DS K /H ID QD
D ● ● ● ● ● ●
n ●
After once execution, the low bit is filled in 0, the final bit is stored in
Description carry flag.
After once execution, the high bit is same with the bit before
shifting; the final bit is stored in carry flag.
< Arithmetic shift left > < Arithmetic shift right >
4-7-2. Logic shift left [LSL], Logic shift right [LSR]
1. Summary
Do logic shift right/left for the numbers
Logic shift left [LSL]
2. Operands
Operands Function Data Type
D Source data address 16 bits/32 bits, BIN
n Arithmetic shift left/right times 16 bits/32bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
D ● ● ● ● ● ●
n ●
After once execution, the low bit is filled in 0, the final bit is stored in carry
Description flag.
LSL meaning and operation are the same as SHL.
After once execution, the high bit is same with the bit before shifting, the final bit is stored in
carry flag。
LSR and SHR are different, LSR add 0 in high bit when moving, and SHR all bits are moved.
< Logic shift left > < Logic shift right >
4-7-3. Rotation shift left [ROL], Rotation shift right [ROR]
1. Summary
Continue and cycle shift left or right
Rotation shift left [ROL]
2. Operands
Operands Function Data Type
D Source data address 16 bits/32 bits, BIN
n Shift right or left times 16 bits/32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
D ● ● ● ● ● ●
n ●
Description ⚫ The bit format of the destination device is rotated n bit places to the left on every
operation of the instruction.
< Rotation shift left > < Rotation shift right >
1. Summary
Bit shift left
Bit shift left [SFTL]
2. Operands
Operands Function Types
S Source soft element head address bit
D Target soft element head address bit
n1 Source data quantity 16 bits /32 bits, BIN
n2 Shift left times 16 bits/32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
n1 ● ● ● ● ● ● ● ●
n2 ● ● ● ● ● ● ● ●
Bit Operands
System
S Y M S T C Dn..m
D ● ● ● ● ●
X ● ● ● ● ●
⚫ The instruction copies n2 source devices to a bit stack of length n1. For every
Description new addition of n2 bits, the existing data within the bit stack is shifted n2 bits to
the left/right. Any bit data moving to the position exceeding the n1 limit is diverted to
an overflow area.
⚫ In every scan cycle, loop shift left action will be executed
① M15~M12→Overflow
② M11~M 8→M15~M 12
③ M 7~M 4→M11~M8
④ M 3~M 0→M7~M4
⑤ X 3~X 0→M3~M0
1. Summary
Bit shift right
Bit shift right [SFTR]
2. Operands
Operands Function Data Type
S Source soft element head address bit
D Target soft element head address bit
n1 Source data quantity 16 bits/32 bits, BIN
n2 Shift right times 16 bits/32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
n1 ● ● ● ● ● ● ● ●
n2 ● ● ● ● ● ● ● ●
Bit
Operands System
X Y M S T C Dn..m
S ● ● ● ● ● ●
D ● ● ● ● ●
⚫ The instruction copies n2 source devices to a bit stack of length n1. For every
Description new addition of n2 bits, the existing data within the bit stack is
shifted n2 bits to the left/right. Any bit data moving to the position exceeding the n1
limit is diverted to an overflow area.
⚫ In every scan cycle, loop shift right action will be executed
⚫ M 3~M 0→Overflow
⚫ M 7~M 4→M3~M0
⚫ M11~M 8→M7~M4
⚫ M15~M12→M11~M8
⚫ X 3~X 0→M15~M12
2. Operands
Operands Function Data Type
S Source soft element head address 16 bits/32 bits, BIN
D Target soft element head address 16 bits /32 bits, BIN
n1 Source data quantity 16 bits /32 bits, BIN
n2 Word shift left times 16 bits /32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
n1 ● ● ● ● ● ● ●
n2 ● ● ● ● ● ● ●
➢ The instruction copies n2 source devices to a word stack of length n1.
Description For each addition of n2 words, the existing data within the word stack is
shifted n2 words to the left. Any word data moving to a position exceeding the n1
limit is diverted to an overflow area.
➢ In every scan cycle, loop shift left action will be executed.
① D25~D22→Overflow
② D21~D18→D25~D22
③ D17~D14→D21~D18
④ D13~D10→D17~D14
⑤ D 3~D 0→D13~D10
1. Summary
Word shift right
Word shift right [WSFR]
2. Operands
Operands Function Data Type
S Source soft element head address 16 bits/32 bits, BIN
D Target soft element head address 16 bits/32 bits, BIN
n1 Source data quantity 16 bits/32 bits, BIN
n2 Shift right times 16 bits/32 bits, BIN
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
n1 ● ● ● ● ● ● ●
n2 ● ● ● ● ● ● ●
⚫ shifted n2 words to the right. Any word data moving to a position In every scan
cycle, loop shift right action will be executed exceeding the n1 limit is diverted to an overflow area.
◆ D13~D10→Overflow
◆ D17~D14→D13~D10
◆ D21~D18→D17~D14
◆ D25~D22→D21~D18
◆ D 3~D 0→D25~D22
n2 字右移
4- .Data Convert
8
1. Summary
Single word integer converts to double word integer [WTD]
2. Operands
Operands Function Data Type
S Source soft element address 16 bits, BIN
D Target soft element address 32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
WTD D0 D10
S· D·
Description X0(D0)
Double
0 or 1 D0
D11 D10
High bits Low bits
1. Summary
16 bits integer converts to float point [FLT]
2. Operands
Operands Function Data Type
S Source soft element address 16 bits/32 bits/64 bits, BIN
D Target soft element address 32 bits/64 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ●
D ●
<16 bits>
S· D·
Description (D10) → (D13,D12)
X0
BIN integer Binary float point
<64 bits>
S· D·
X0
( FLTD D10 D14 D13,D12,D11,D10)→ (D17,D16,D15,D14)
BIN integer Binary float point
Convert BIN integer to binary float point. As the constant K, H will auto convert by the
float operation instruction, so this FLT instruction can’t be used.
The instruction is contrary to INT instruction
1. Summary
Float point converts to integer [INT]
2. Operands
Operands Function Data Type
S Source soft element address 16 bits/32 bits, BIN
D Target soft element address 16 bits/32 bits, BIN
S ● ●
D ●
<16 bits>
S· D·
<32 bits>
(D11,D10) → S· D· (D20,D21)
X0
Binary Float BIN integer
Give up the data after the decimal dot
⚫ The binary source number is converted into a BIN integer and stored at the destination
When converting, less than 1 and abandon it, zero flag is ON.
1. Summary
BCD convert to binary [BIN]
2. Operands
Operands Function Data Type
S Source soft element address BCD
D Target soft element address 16 bits/32 bits, BIN
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
Convert and move instruction of Source (BCD) → destination (BIN)
Description
S· D·
X0 BIN D10 D0
➢ When source data is not BCD code, M8067(Operation error), M8004 (error occurs) ➢
As constant K automatically converts to binary, so it’s not suitable for this instruction.
1. Summary
Binary convert to BCD [BCD]
2. Operands
Operands Function Data Type
S Source soft element address 16 bits/32 bits, BIN
D Target soft element address BCD code
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
Convert and move instruction of source (BIN)→destination (BCD)
Description
S· D·
X0
BCD D10 D0
1. Summary
Hex. convert to ASCII [ASCI]
2. Operands
Operands Function Data Type
S Source soft element address 2 bits, HEX
D Target soft element address ASCII code
n Transform character quantity 16 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
n ● ● ● ● ● ● ●
S· D· n
X0
Description ASCI D100 D200 K4
S· D·
Convert each bit of source ’s (S) hex f ormat data to be ASCII code, move separately to the
high 8 bits and low 8 bits of destination (D). The convert alphanumeric number is assigned
with n.
D· is low 8 bits, high 8 bits, store ASCII data.
1. Summary
ASCII converts to Hex. [HEX]
2. Operands
Operands Function Date type
S Source soft element address ASCII
D Target soft element address 2 bits, HEX
n Character quantity 16 bits, BIN
Word D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
n ●
S· D·
n
Description HEX D200 D100 K4
X0
4-8-8.Coding [DECO]
1. Summary
Transform the ASCII code to Hex numbers.
Coding [DECO]
16 bits DECO s -
Execution Normally ON/OFF, Suitable XC2.XC3.XC5.XCM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S Source soft element address ASCII
D Target soft element address 2 bits HEX
n The coding soft element quantity 16bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
n ●
Bit
Operands System
X Y M S T C Dn.m
D ● ● ● ● ● ●
X10
7 6 5 4 ③ 2 1 0
0 0 0 0 1 0 0 0
M17 M16 M15 M14 M13 M12 M11 M10
The source address is 1+2=3,so starts from M10, the number 3 bit
(M13) is 1. If the source is all 0, M10 is 1.
DECO D0 D1 K3
X0
② ①
全部转化为 0
③
Low n bits (n≤4) of source address are decoded to target address. n≤3, the
high bit of target address all become 0.
When n=0, no operation, beyond n=0~14, don’t execute the instruction.
1. Summary
Transform the ASCII code to hex numbers
High bit coding [ENCO]
2. Operands
Operands Function Data Type
S data address need coding 16 bits, BIN; bit
D Coding result address 16 bits, BIN
n soft element quantity to save result 16 bits, BIN
3. Suitable soft components
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ● ●
D ● ● ● ● ● ●
n ●
Bit
Operands System
X Y M S T C Dn..m
S ● ● ● ● ● ●
X0
b15 D10 4 ② ①
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
b0 All
be 0
ENCO D0 D1 K3
X1
b15 D0 b0
0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0
7 6 5 4 ③ 2 1
被忽视
b15 D1 4 ② ①
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
0
All be 0 b0
⚫ If many bits in the source ID are 1, ignore the low bits. If source ID are all 0, don’t execute
the instructions.
⚫ When drive input is OFF, the instruction is not executed, encode output don’t change.
⚫ When n=8, if encode instruction’s “S” is bit unit, it’s point number is 2^8=256
1. Summary
Transform the ASCII to hex numbers.
Low bit coding [ENCOL]
2. Operands
Operands Function Data Type
S Soft element address need coding 16bit,BIN;bit
D Soft element address to save coding result 16bit,BIN
n The soft element quantity to save result 16bit,BIN
D ● ● ● ● ● ●
n ●
Bit
Operands System
X Y M S T C Dn.m
S ● ● ● ● ● ●
b15 D10 4 ② ①
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
b0 All
be 0
b15 D0 b0
0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0
0 7 6 5 4 ③ 2 1
被忽视
b15 D1 4 ② ①
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
b0
All be 0
⚫ If many bits in the source ID are 1, ignore the high bits. If source ID are all 0, don’t
execute the instructions。
⚫ When drive input is OFF, the instruction is not executed, encode output don’t
change
⚫ When n=8, if encode instruction’s is bS·it unit, it’s point number is 2^8=256
4- .Floating Operation
9
1. Summary
Float Compare [ECMP]
2. Operands
Operands Function Data Type
S1 Soft element address need compare 32 bits, BIN
S2 Soft element address need compare 32 bits, BIN
D Compare result bit
S1· S2· D·
X0
ECMP D10 D20 M0
The status of the destination device will be kept even if the ECMP instruction is deactivated.
➢ The binary float data of S1 is compared to S2. The result is indicated by 3 bit devices
specified with the head address entered as D
➢ If a constant K or H used as source data, the value is converted to floating point before
the addition operation.
X0
(K500) : (D101,D100)→M10,M11,M12 Binary converts
Binary floating
to floating
1. Summary
Float Zone Compare [EZCP]
2. Operands
Operands Function Data Type
S1 Soft element address need compare 32 bits, BIN
S2 Upper limit of compare data 32 bits, BIN
S3 Lower limit of compare data 32 bits, BIN
D The compare result soft element address bit
D FD ED TD CD DX DY DM DS K /H ID
S1 ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ●
S3 ● ● ● ● ● ● ●
Bit
Operands System
X Y M S T C Dn..m
D ● ● ●
Compare a float range with a float value...
Description S1· S2· S3· D·
X0
EZCP D10 D20 D0 M3
The status of the destination device will be kept even if the EZCP instruction is deactivated.
The data of S1 is compared to the data of S2. The result is indicated by 3 bit devices
specified with the head address entered as D.
If a constant K or H used as source data, the value is converted to floating point before
the addition operation.
X0
EZCP K10 K2800 D5 M0
Please set S1<S2, when S2>S1, see S2 as the same with S1 and compare them
1. Summary
Float Add [EADD]
2. Operands
Operands Function Data Type
S1 Soft element address need to add 32 bits, BIN
S2 Soft element address need to add 32 bits, BIN
D Result address 32 bits, BIN
3. Suitable soft components
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ●
D ● ● ● ●
S1· S2· D·
X0
X1
EADD D100 K1234 D110
➢ The same device may be used as a source and as the destination. If this is the case then, on
continuous operation of the EADD instruction, the result of the previous operation will be used
as a new source value and a new result calculated. This will happen every program scan unless
the pulse modifier or an interlock program is used.
-9-4.Float Sub [ESUB]
4
1. Summary
Float Sub [ESUB]
2. Operands
Operands Function Data Type
S1 Soft element address need to subtract 32 bits, BIN
S2 Soft element address need to subtract 32 bits, BIN
D Result address 32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ●
D ● ● ● ●
S1· S2 · D·
X0
The floating point value of S2 is subtracted from the floating point value of S1 and the
result stored in destination device D.
If a constant K or H used as source data, the value is converted to floating point before the
addition operation。
X1
The same device may be used as a source and as the destination. If this is the case then,
on continuous operation of the EADD instruction, the result of the previous operation
will be used as a new source value and a new result calculated. This will happen every
program scan unless the pulse modifier or an interlock program is used.
4-9-5.
1. Summary
Float Mul[EMUL]
2. Operands
Operands Function Data Type
S1 Soft element address need to multiply 32 bits, BIN
S2 Soft element address need to multiply 32 bits, BIN
D Result address 32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ●
D ● ● ● ●
S1· S2 · D·
Description
EMUL D10 D20 D50
X0
1. Summary
Binary Floating Binary Floating Binary Floating
The floating value of S1 is multiplied with the floating value point value of S2. The result
of the multiplication is stored at D as a floating value
If a constant K or H used as source data, the value is converted to floating point before
the addition operation.
X1
2. Operands
Operands Function Data Type
S1 Soft element address need to divide 32 bits, BIN
S2 Soft element address need to divide 32 bits, BIN
D Result address 32 bits, BIN
1. Summary
word
Operands System Constant Module
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ● ● ●
S2 ● ● ● ● ● ● ●
D ● ● ● ●
S1· S2 · D·
Description
EDIV D10 D20 D50
X0
The floating point value of S1 is divided by the floating point value of S2. The
result of the division is stored in D as a floating point value. No remainder is
calculated.
If a constant K or H used as source data, the value is converted to floating point
before the addition operation
X1
1. Summary
Float Square Root [ESQR]
2. Operands
Operands Function Data Type
S The soft element address need to do square root 32 bits, BIN
D The result address 32 bits, BIN
Word
Operands System Constant Module
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ●
S· D·
Description X0(D11,D10) →(D21,D20)
ESQR D10 D20
Binary Floating Binary Floating
A square root is performed on the floating point value in S the result is stored in D ⚫ If
a constant K or H used as source data, the value is converted to floating point before the addition
operation.
1. Summary
X1
(K1024) → (D111,D110)
Binary converts to Floating Binary Floating
Sine [SIN]
Float Sine[SIN]
2. Operands
Operands Function Data Type
S The soft element address need to do sine 32 bits, BIN
D The result address 32 bits, BIN
S ● ● ● ● ● ● ●
D ● ● ● ●
.
4-9-10
1. Summary
3. Suitable soft components
S· D·
X0 SIN D50 D60
Description
(D51,D50) → (D61,D60)SIN
⚫ This instruction performs the mathematical SIN operation on the floating point value in S
(angle RAD). The result is stored in D.
S·
SIN value
D61 D60
Binary Floating
Cosine [SIN]
Float Cosine[COS]
1. Summary
Execution Normally ON/OFF, Suitable XC2.XC3.XC5.XCM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S Soft element address need to do cos 32 bits, BIN
D Result address 32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ●
S· D·
X0
➢ This instruction performs the mathematical COS operation on the floating point value in S
(angle RAD). The result is stored in D
1. Summary
D· D61 D60 COS value
Binary Floating
4-9-10.TAN [TAN]
1. Summary
TAN [TAN]
2. Operands
Operands Function Data Type
S Soft element address need to do tan 32bit,BIN
D Result address 32bit,BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ●
S· D·
X0
(D51,D50)RAD → (D61,D60)TAN
⚫ This instruction performs the mathematical TAN operation on the floating point value in S. The
result is stored in D.
RAD value (angle×π/180)
S· D51 D50 Assign the binary floating value
TAN value
D·
D61 D60
Binary Floating
1. Summary
ASIN [ASIN]
2. Operands
Operands Function Data Type
S Soft element address need to do arcsin 32 bits, BIN
D Result address 32 bits, BIN
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ●
S· D·
X0
(D51,D50)ASIN → (D61,D60)RAD
⚫ This instruction performs the mathematical ASIN operation on the floating point value in S.
The result is stored in D.
D·
D61 D60 RAD value (angle×π/180)
Assign the binary floating value
1. Summary
ACOS [ACOS]
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ● ● ●
D ● ● ● ●
S· D·
X0
Floating
⚫ Calculate the arcos value(radian), save the result in the target address
1. Summary
ATAN [ATAN]
2. Operands
Operands Function Data Type
S Soft element address need to do arctan 32 bit, BIN
D Result address 32 bit, BIN
S ● ● ● ● ● ● ●
D ● ● ● ●
S· D·
X0
(D51,D50)ATAN → (D61,D60)RAD
⚫ Calculate the arctan value ( radian), save the result in the target address
※1: To use the instructions, The Model should be equipped with RTC function;
2. Operands
Operands Function Data Type
D Register to save clock data 16 bits, BIN
D ● ● ●
D·
Functions
TRD D0
and Actions
X0
The current time and date of the real time clock are read and stored in the 7 data devices
specified by the head address D.
2. Operands
Operands Function Data Type
S Write the clock data to the register 16 bits, BIN
S ● ● ● ● ● ● ● ●
S·
The 7 data devices specified with the head
Functions
TWR D0
and Actions
X0
address S are used to set a new current value of
the real time clock.
➢ Write the set clock data into PLC’s real time clock.
In order to write real time clock, the 7 data devices specified with the head address S · should be
pre-set.
After executing TWR instruction, the time in real time clock will immediately change to be the
new set time. So, when setting the time it is a good idea to set the source data to a time a number
of minutes ahead and then drive the instruction when the real time reaches this value.
5 High Speed Counter (HSC)
In this chapter we tell high speed counter’s functions, including high speed count model, wiring method,
read/write HSC value, reset etc.
5-1.FUNCTIONS SUMMARY
5-9.HSC EXAMPLES
5-10.HSC INTERRUPTION
Read HSCR S D
HSCR 5-6-1
HSC
Write HSCW S D
HSCW 5-6-2
HSC
HSC
24 Cn D Kn
s ( )
egments
OUT HSC 5-10
Interrupti
on
RST C
HSC
RST 3-13
Reset
5 High Speed Counter (HSC)
5- .Functions Summary
1
XC series PLC has HSC (High Speed Counter) function which is independent with the scan
cycle. Via choosing different counter, test the high speed input signals with detect sensors and rotary
encoders. The highest testing frequency can reach 80 KHz.
5- .HSC Mode
2
XC series high speed counters function has three count modes: Increment Mode, Pulse + Direction
Mode and AB phase Mode;
Increment Mode
Under this mode, count and input the pulse signal, the count value increase at each pulse’s rising edge;
5 High Speed Counter (HSC)
Under this mode, the pulse signal and direction signal are all inputted, the count value increase or
decrease with the direction signal’s status. When the count signal is OFF, the count input’s rising
edge carry on plus count; When the count signal is ON, the count input’s rising edge carry on minus
count;
AB Phase Mode
Under this mode, the HSC value increase or decrease according to two differential signal (A phase
and B phase). According to the multiplication, we have 1-time frequency and 4-time frequency two
modes, but the default count mode is 4-time mode.
5 High Speed Counter (HSC)
➢ 4-time Frequency
5- .HSC Range
3
HSC’s count range is: K-2,147,483,648 ~ K+2,147,483,647. If the count value overflows this range, then
up flow or down flow appears;
For “up flow”, it means the count value jumps from K+2,147,483,647 to be K-2,147,483,648, and
then continue to count; for “down flow”, it means the count value jumps from K-2,147,483,648 to
be K+2,147,483,647 then continue to count.
5 High Speed Counter (HSC)
For the counter’s pulse input wiring, things differ with different PLC model and counter model; several
typical input wiring are shown below: (take XC3-48 as the example):
Normally, X0 and X1 can accept 80 KHz frequency under single phase mode and AB phase mode.
Other terminals can accept only 10 KHz under single phase mode, 5 KHz under AB phase mode. X
can use as normal input terminals when they are not used as high speed input. The detailed
assignment is shown as below:
XC2 series PLC
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63
C634
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2
Max.F 80K 10K 10K 10K 80K 10K 80K 5K
80K
4-times
F 1/4 1
Count
√ √ √ √ √ √ √
Interrupt
X000 U U A
X001 U Dir B
X002
X003 U U A
X004 Dir B
X005
X006 U
X007 U
X010
X011
X012
*1: XC2-16: C600, C602, C620, C630 max frequency is 10 KHz.
*2: XC2-14: the max frequency is 10 KHz, 80 KHz needs to order.
XC3-14 PLC
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
*Max.F 10K 10K 5K 5K
10K 10K 10K 10K 10K
4-times 1 1/4
F
5 High Speed Counter (HSC)
Count
√ √ √ √ √ √
Interrupt
X000 U U A
X001 Dir B
X002 U
X003 U
X004 Dir B
X005 U U A
X006 U
* C600, C620, C630 can be 80 KHz, 80 KHz, 50 KHz for special order of customer.
XC3-19AR-E
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
Max.F 10K 5K 5K
10K 10K 10K 10K 10K
4-times
F 1 1/4
Count
√ √ √ √ √ √
Interrupt
X000 U U A
X001 Dir B
X002 U U A
X003 Dir B
X004 U
X005 U
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
Max.F 80K 10K 10K 10K 10K 80K 10K 10K 80K 5K 5K
80K
4-times
F 1/4 1 4
5 High Speed Counter (HSC)
Count
Interrupt √ √ √ √ √ √ √ √
X000 U U A
X001 U Dir B
X002
X003 U U A
X004 Dir B
X005
X006 U U A
X007 Dir B
X010
X011 U
X012 U
*XC5-48, XC5-60: the max frequency of C622, C632 is 80 KHz, 50 KHz.
XC3-48, 60 PLC
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
Max.F 10K 10K 80K 50K
80K 80K 80K 50K
4-times
F 1 1/4
Count
√ √ √ √ √ √
Interrupt
X000 U U A
X001 Dir B
X002 U U A
X003 Dir B
X004 U
X005 U
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
5 High Speed Counter (HSC)
Count
√ √ √ √
Interrupt
X000 U U A
X001 Dir B
X002
X003 U
X004
X005
X006
XCM-24/32T3-E
AB Phase
Increment Pulse+Dir Input Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
Max.F 80K 10K 50K 10K
80K 10K 10K 10K
4-times 1/4 1
F
Count
Interrupt √ √ √ √ √ √
X000 U U A
X001 Dir B
X002
X003 U U A
X004 Dir B
X005
X006 U
X007 U
* X7 cannot be used together with Y0.
XCM-60T-E
AB Phase
Increment Pulse+Dir Input Mode
5 High Speed Counter (HSC)
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C62 C62 C62 C62 C62 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0 2 4
Max.F 80K 50K
80K 10K 10K 10K 10K 10K
4-times
F 1/4 1/4 1/4
Count
Interrupt √ √ √ √ √ √ √ √
X000 U U A
X001 U Dir B
X002
X003
X004
X005
X006 U A
X007 B
X010 U A
X011 B
XCC-24/32T-E
Increment AB Phase Mode
C60 C60 C60 C60 C60 C61 C61 C61 C61 C61 C63 C63 C63 C63 C63
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8
Max.F 50K 50K 10K 10K
80K 80K 80K 10K 10K 50K
4-times
F 1/4 1/4 1/4 1/4 1/4
Count
Interrupt √ √ √ √ √ √ √ √ √ √
X000 U A
X001 B
X002 U A
X003 B
X004 U A
X005 B
X006 U A
X007 B
X010 U A
X011 B
5 High Speed Counter (HSC)
All high speed counters support read instruction [HSCR] and write instruction [HSCW], but users need
to use hardware V3.1c and above.
1、Instruction Summary
Read HSC value to the specified register;
Read from HSC [HSCR]/ write to HSC [HSCW]
2、Operands
Operands Function Type
S Specify HSC code 32 bits, BIN
D Specify the read/written register 32 bits, BIN
S ●
D ●
S· D·
M0
5 High Speed Counter (HSC)
When the activate condition is true, read the HSC value in C630 (DWORD) into D10 (DWORD)
Instruction HSCR read the HSC value into the specified register, improve HSC
value
’s precision.
Note: For hardware version larger than 3.1, please use HSCR to move the high speed counter value
to the register. DMOV instruction cannot be used.
Sample Program:
M8000 C630 K99999999
( )
D10 K1000 Y0
D ( S )
D20 K1000
D
1、Instruction Summary
Write the specified register value into HSC;
Write HSC value [HSCW]
2、operands
Operands Function Type
5 High Speed Counter (HSC)
S ●
D ●
S· D·
M0
HSCW C630 D20
⚫ When the activate condition is true, write the value in D20 (DWORD) into C630 (DWORD), the
original value is replaced;
➢ We suggest the users to apply high speed counter only with HSCR and HSCW, not with other
instructions like DMOV, LD>, DMUL etc. and users must run after converting HSC to be
other registers.
Sample program:
M0
HSCW C630 K2000
M0 C600 K2000
( )
M1
↑ C600
( R )
In the above graph, when M0 is ON, C600 starts to count the input pulse on X0; when
M1 changes from OFF to be ON, reset C600, and clear the count value
5 High Speed Counter (HSC)
About AB phase counter, modify the frequency multiplication value via setting FLASH data register
FD8241, FD8242, FD8243. If the value is 1, it is 1-time frequency, if it is 4; it is 4-time frequency.
Register Function Set Value Meaning
1 1-time frequency
FD8241 Frequency multiplication of C630
4 4-time frequency
1 1-time frequency
FD8242 Frequency multiplication of C632
4 4-time frequency
1 1-time frequency
FD8243 Frequency multiplication of C634
4 4-time frequency
5- .HSC Example
9
➢ When normally ON coil M8000 is ON, set the value of C600, the set value is
K888888888, read the HSC value (DWORD) into data register D0 (DWORD).
➢ If the value in C600 is smaller than value in D2, set the output coil Y0 ON; If the
value in C600 equals or be larger than value in D2, and smaller than value in D4, set
the output coil Y1 ON; If the value in C600 equals or be larger than value in D4, set
the output coil Y2 ON;
➢ When the rising edge of M1 is coming, reset HSC C600 and stop counting.
5 High Speed Counter (HSC)
M8 C630 K999999
( )
M8000
HSCR C630 D0
D0 K3000
Y2
D≥ ( )
M9 C630
( R )
➢ When M8 is ON, C630 starts to count immediately. Count input via X000 (B
Phase)、X001 (A Phase)
M4 C620 K999999
( )
M5 C620
↑ ( R )
➢ When M4 is ON, C620 starts the HSC with the OFF →ON of X000; Judge the
count direction according to the input X001 status (OFF or ON). If X001 is OFF,
it’s increment count; if X001 is ON, it’s decrement count;
➢ When the rising edge of M5 is coming, reset HSC C620 and stop counting.
➢ When the count value exceeds K3000, output coil Y2 is ON; ➢ When comes the
rising edge of M9, reset HSC C630
M8002 C630
HSCR C630 D0
D0 K0 D0 K100 Y0
D≥ D< ( )
D0 K100 D0 K200
5 High Speed Counter (HSC)
D≥ D< ( Y1 ) ( R
D0 K200
)
D≥ ( Y2 )
➢ When the rising edge of initial positive pulse coil M8002 comes, i.e. each scan cycle
starts, HSC C630 reset and clear the count value.
➢ When set coil M8000 ON, C630 starts to count, the count value is set to be K8888888.
➢ If the count value is greater than K0 but smaller than K100, the output coil Y0 set ON;
If the count value is greater than K100 but smaller than K200, the output coil Y1 set
ON; If the count value is greater thanK200, the output coil Y2 set ON;
To XC series PLC, each HSC channels has 24 segments 32-bit pre-set value. When the HSC
difference value equals the correspond 24-segment pre-set value, then interruption occurs according
to the interruption tag;
To use this function, please use hardware V3.1c or above;
M0 C600 D4000
M1
↑
K20000
( )
C600
( R )
As shown in the above graph, data register D4000 is the start ID of 24-segment pre-set value area.
Behind it, save each pre-set value in DWORD form. Please pay attention when using HSC:
⚫ If certain pre-set value is 0, it means count interruption end at this segment;
⚫ Set the interruption pre-set value but not write the correspond interruption program is not allowed;
⚫ 24-segment interruption of HSC occurs in order. If the first segment interruption doesn't happen,
then the second segment interruption will not happen;
⚫ 24-segment pre-set value can be specified to be relative value or absolute value. Meantime, users
can specify the value to be loop or not. But the loop mode can't be used together with absolute
value. (Please refer to special coil M8190~M8209, M8270~M8287).
Counter Interruption
Counter
tag InterruptionCounter
tag Interruption tag
C600 C620
I1001~I1024 I2001~I2024 C630 I2501~I2524
C602 C622
I1101~I1124 I2101~I2124 C632 I2601~I2624
C604 I1201~I1224
C624 I2201~I2224 C634 I2701~I2724
C606 I1301~I1324
C626 I2301~I2324 C636 I2801~I2824
C608 I1401~I1424
C628 I2401~I2424 C638 I2901~I2924
C610 I1501~I1524
C612 I1601~I1624
C614 I1701~I1724
C616 I1801~I1824
C618 I1901~I1924
HSC 24-segment pre-set value is the difference value, the count value equals the counter's
current value plus the preset value, generate the interruption. N interruption tags correspond with
N interruption preset values. The (N+1) preset value is 0;
E.g. 1, the current value is C630 is 0, the first preset value is 10000, the preset value in segment 2
is -5000, and the present value in segment 3 is 20000. When start to count, the counter's current
value is 10000, generate first interruption I2501; When start to count, the counter's current value is
5000, generate first interruption I2502; When start to count, the counter's current value is 25000,
generate first interruption I2503.
5 High Speed Counter (HSC)
I2501
C600= K0+K10000=K10000
I2502
C600= K10000+(K-5000)=K5000
I2503
C600= K5000+K20000=K25000
E.g. 2, the current value is C630 is 10000, the first preset value is 10000, the preset value in segment
2 is 5000, and the preset value in segment 3 is 20000. When start to count, the counter's current
value is 20000, generate first interruption I2501; When start to count, the counter's current value is
25000, generate first interruption I2502;When start to count, the counter's current value is 45000,
generate first interruption I2503.
I2501
C600= K10000+K10000=K20000
I2502
C600= K20000+K5000=K25000
I2503
C600= K25000+K20000=K45000
Via setting the special auxiliary relays, users can set the HSC interruption to be unicycle mode or
continuous loop mode. The loop mode is only suitable with the relative count. The detailed
assignment is show below:
ID HSC ID Setting
M8270 24 segments HSC interruption loop (C600)
M8271 24 segments HSC interruption loop (C602)
M8272 24 segments HSC interruption loop (C604)
M8273 24 segments HSC interruption loop (C606)
M8274 24 segments HSC interruption loop (C608)
OFF: single loop mode
M8275 24 segments HSC interruption loop (C610) ON: continuous loop mode
M8276 24 segments HSC interruption loop (C612)
M8277 24 segments HSC interruption loop (C614)
M8278 24 segments HSC interruption loop (C616)
M8279 24 segments HSC interruption loop (C618)
M8280 24 segments HSC interruption loop (C620)
M8281 24 segments HSC interruption loop (C622)
M8282 24 segments HSC interruption loop (C624)
M8283 24 segments HSC interruption loop (C626)
M8284 24 segments HSC interruption loop (C628)
M8285 24 segments HSC interruption loop (C630)
M8286 24 segments HSC interruption loop (C632)
M8287 24 segments HSC interruption loop (C634)
E.g.1: when M0 is ON, C630 starts counting from D4000. When it reaches the present value, the
interruption is produced. When the rising edge of M1 is coming, clear the C630.
5 High Speed Counter (HSC)
M8000
DMOV K10000 D4000
DMOV K0 D4004
FEND
I2501
M8000
INC D0
IRET
I2502
M8000
INC D1
IRET
Below is PLC program: Y2 represents forward output signal; Y3 represents backward output
signal; Y4 represents output signal of speed 1; C340: Back-forth time’s accumulation counter;
C630: AB phase HSC;
5 High Speed Counter (HSC)
6 PULSE OUTPUT
In this chapter we will tell the pulse function of XC series PLC. The content includes pulse output
instructions, input/output wiring, notes, and relate coils and registers etc.
6-1.Functions Summary
6-3.Output Wiring
6-4.Notes
6-5.Sample Programs
Mnemo Chap
Function Circuit And Soft Device
nic ter
PULSE OUTPUT
Unidirecti
onal
ration
pulse
PLSY output 6-2-1
without
ACC/DE
C time
change PLSY S1 S2 D
Variable
frequency
PLSF 6-2-2
pulse
output PLSF S D
Ration
pulse
output
PLSR with 6-2-3
ACC/DE
C
speed PLSR S1 S2 S3 D
PLSNE Pulse
XT/ Section
PLSNT Switch PLSNT S 6-2-4
Refresh
Pulse
PLSMV Nr. 6-2-6
immediate
ly PLSMV S D
Original
ZRN 6-2-7
Return ZRN S1 S2 S3 D
Relative
DRVI Position 6-2-8
Control DRVI S1 S2 S3 D1 D2
6 Pulse Output
Absolute
DRVA Position 6-2-9
Control DRVA S1 S2 S3 D1 D2
Absolute
Position
multi-
PLSA 6-2-10
section
pulse
control PLSA S1 S2 D
Relative M0
S1· D 1· D 2·
position PTO D0 Y0 Y1
multi-
PTO 6-2-11
section
pulse
control
Absolute M0
S1· D 1· D2 ·
position PTOA D0 Y0 Y1
multi-
PTOA 6-2-12
section
pulse
control
S1· S 2·
M0
PSTOP Y0 K1
PSTOP Pulse stop 6-2-13
Variable
frequency
single- PTF D0 Y0 Y1 M0
PTF section 6-2-14
S1· D1· D2 ·
pulse
output
6- .Functions Summary
1
Generally, XC3 and XC5 series PLC are equipped with 2CH pulse output function. Via different
instructions, users can realize unidirectional pulse output without ACC/DEC speed; unidirectional
pulse output with ACC/DEC speed; multi-segments, positive/negative output etc., the output
frequency can reach 200K Hz.
6 Pulse Output
※1: To use pulse output, please choose PLC with transistor output, like XC3-14T-E or XC3-60RT-
E etc.
※2: XC5 series 32I/O PLC has 4CH (Y0, Y1, Y2, Y3) pulse output function.
※3: XCM series 32/24 have 4 CH pulse output; XCC series has 5 CH pulse output; XCM-60 has
10 CH pulse output.
※4: Pulse output terminal Y1 cannot be used together with expansion BD.
6-2-1. Unidirectional ration pulse output without ACC/DEC time change [PLSY]
1、Instruction Summary
Instruction to generate ration pulse with the specified frequency;
Unidirectional ration pulse output without ACC/DEC time change [PLSY]
16 bits PLSY 32 bits DPLSY
instruction instruction
Execution Normally ON/OFF coil Suitable XC2, XC3, XC5, XCM, XCC
condition models
Hardware - Software -
requirement requirements
2、Operands
6 Pulse Output
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ● ●
X Y M S T C Dn.m
D ●
M8170
RST M0
M8170
RST M0
Output Mode
M0
0 T1 T2 t
M8170
Example
M8002
DMOV K1000 D0
1000
DMOV K20000 D2
20000
M0
DPLSY D0 D2 Y0
1000 20000 OFF
M8170
RST M0
Items to Note
If the control object is stepping/servo motor, we recommend users not use this instruction, to avoid
the motor losing synchronism. PLSR is available.
2、Operands
Operands Function Type
S Specify the frequency or register ID 16 bits/32 bits, BIN
D Specify pulse output port bit
PLSF D0 Y0
M0
Frequency range: 5Hz~32767Hz (when the set frequency is lower than 5Hz, output 5Hz) ⚫
With the changing of setting frequency in D0, the output pulse frequency changes at Y0
Accumulate pulse number in register D8170 (DWord)
DPLSF D0 Y0
M0
Frequency range: 5Hz~200KHz (when the set frequency is lower than 5Hz, output 5Hz) ⚫
Pulse can only be output at Y0 or Y1.
6 Pulse Output
With the changing of setting frequency in D0, the output pulse frequency changes at Y0
Accumulate pulse number in register D8170 (DWord)
There is no acceleration/deceleration time when the frequency changed
When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency continuous pulse output.
Output Mode
M0
f
Set
frequency
0 T1 T2 t
2、Operands
Operands Function Type
S Specify the frequency or register ID 16 bits/32 bits, BIN
6 Pulse Output
⚫ Frequency range: 5Hz~32767Hz (when the set frequency is lower than 5Hz, output 5Hz) ⚫
Pulse can only be output at Y0 or Y1.
⚫ The negative/positive of pulse frequency decides the pulse direction ( direction port output
when the frequency is positive)
⚫ The direction output can control the rotation direction of motor (CW/CCW)
⚫ With the changing of setting frequency in D0, the output pulse frequency changes at Y0
⚫ Accumulate pulse number in register D8170 (DWord)
⚫ There is no acceleration/deceleration time when the frequency changed
⚫ When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency continuous pulse output.
DPLSF D0 Y0 Y2
M0
6 Pulse Output
⚫ Frequency range: 5Hz~200KHz (when the set frequency is lower than 5Hz, output 5Hz) ⚫
Pulse can only be output at Y0 or Y1.
⚫ The negative/positive of pulse frequency decides the pulse direction ( direction port output
when the frequency is positive)
⚫ The direction output can control the rotation direction of motor (CW/CCW)
⚫ With the changing of setting frequency in D0, the output pulse frequency changes at Y0
⚫ Accumulate pulse number in register D8170 (DWord)
⚫ There is no acceleration/deceleration time when the frequency changed
⚫ When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency continuous pulse output.
Output Mode
M0
Set frequency
(+)
T3 T4
0 T1 T2 t
Set frequency
(-)
2、Operands
Operands Function Type
S1 Specify the frequency or register ID 16 bits/32 bits, BIN
S2 Specify pulse quantity or register ID 16 bits/32 bits, BIN
D Specify pulse output port bit
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
Bit
S2 ● ● ● ● ●
D1 ●
⚫ Frequency range: 5Hz~32767Hz (when the set frequency is lower than 5Hz, output 5Hz)
⚫ Pulse quantity range: K0~K32767
⚫ Pulse can only be output at Y0 or Y1
⚫ With the changing of setting frequency in D0, the output pulse frequency changes at Y0
⚫ When the pulse frequency is 0Hz, the pulse output end
⚫ Accumulate pulse number in register D8170 (DWord)
⚫ There is no acceleration/deceleration time when the frequency changed
⚫ When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency limited quantity pulse output.
6 Pulse Output
⚫ When M0 is ON, PLSF output the pulse at Y0 with frequency D0 (word), pulse quantity D2
(word). M8170 is ON when the pulse is outputting. The pulse stops output when the pulse
quantity reaches the limit value. And the M8170 is off, M0 is off.
⚫ Frequency range: 5Hz~200KHz (when the set frequency is lower than 5Hz, output 5Hz)
⚫ Pulse quantity range: K0~K2147483647
⚫ Pulse can only be output at Y0 or Y1
⚫ With the changing of setting frequency in D0, the output pulse frequency changes at Y0
⚫ When the pulse frequency is 0Hz, the pulse output end
⚫ Accumulate pulse number in register D8170 (DWord)
⚫ There is no acceleration/deceleration time when the frequency changed
⚫ When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency limited quantity pulse output.
⚫ When M0 is ON, PLSF output the pulse at Y0 with frequency D0 (Dword), pulse quantity D2
(Dword). M8170 is ON when the pulse is outputting. The pulse stops output when the pulse
quantity reaches the limit value. And the M8170 is off, M0 is off.
Output Mode
M0
f When the pulse quantity
reaches the limited value,
Set
the pulse stop output
frequency
0 T1 T2 t
M8170
Mode4: changeable frequency limited quantity pulse output PLSF (with direction) 1、Instruction
Summary
6 Pulse Output
2、Operands
Operands Function Type
S1 Specify the frequency or register ID 16 bits/32 bits, BIN
S2 Specify pulse quantity or register ID 16 bits/32 bits, BIN
D1 Specify pulse output port bit
D2 Specify pulse direction output port bit
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
Bit
S2 ● ● ● ● ●
X Y M S T
C
D1 ●
D2 ●
6 Pulse Output
⚫ Frequency range: 5Hz~32767Hz (when the set frequency is lower than 5Hz, output 5Hz)
⚫ Pulse quantity range: K0~K32767
⚫ Pulse can only be output at Y0 or Y1
⚫ The negative/positive of pulse frequency decides the pulse direction ( direction port output
when the frequency is positive)
⚫ The direction output can control the rotation direction of motor (CW/CCW)
⚫ With the changing of setting frequency in D0, the output pulse frequency changes at Y0
⚫ When the pulse frequency is 0Hz, the pulse output end
⚫ Accumulate pulse number in register D8170 (DWord)
⚫ There is no acceleration/deceleration time when the frequency changed
⚫ When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency limited quantity pulse output.
⚫ When M0 is ON, PLSF output the pulse at Y0 with frequency D0 (word), pulse quantity D2
(word). M8170 is ON when the pulse is outputting. The pulse stops output when the pulse
quantity reaches the limit value. And the M8170 is off, M0 is off.
⚫ Frequency range: 5Hz~200KHz (when the set frequency is lower than 5Hz, output 5Hz)
⚫ Pulse quantity range: K0~K2147483647
⚫ Pulse can only be output at Y0 or Y1
⚫ With the changing of setting frequency in D0, the output pulse frequency changes at Y0
⚫ When the pulse frequency is 0Hz, the pulse output end
⚫ Accumulate pulse number in register D8170 (DWord)
⚫ There is no acceleration/deceleration time when the frequency changed
⚫ When the condition is on, it output the pulse with changeable frequency until the condition is
off. It is fit for changeable frequency limited quantity pulse output.
⚫ When M0 is ON, PLSF output the pulse at Y0 with frequency D0 (Dword), pulse quantity D2
(Dword). M8170 is ON when the pulse is outputting. The pulse stops output when the pulse
quantity reaches the limit value. And the M8170 is off, M0 is off.
6 Pulse Output
Output Mode
Continuous output pulse with the set frequency and limited pulse quantity
M0
T3 T4
0 T1 T2 t
Set frequency
( -)
M 8170
PLSR/DPLSR instruction has two control modes. Below we will introduce one by one;
2、Operands
Operands Function Type
S1 Specify the soft component’s start ID of the segmented pulse 16 bit/ 32 bit, BIN
parameters
6 Pulse Output
Wor
d operands system constant module
D F E TD CD DX D DM DS K /H ID QD
D D Y
S1 ● ● ● ●
S2 ● ● ● ● ●
Bit
operands system
X Y M S T C Dn.m
D ●
M8170
RST M0
S1 · S2· D·
M0
DPLSR D0 D100 Y0
M8170
RST M0
⚫ The parameters’ address is a section starts from Dn or FDn. In the above example (16bit
instruction form): D0 set the first segment pulse’s highest frequency, D1 set the first segment’s
pulse number , D2 set the second segment pulse’s highest frequency, D3 set the second
segment’s pulse number , …… if the set value in Dn, Dn+1 is 0, this represents the end of
segment, the segment number is not limited.
⚫ For 32 bit instruction DPLSR, D0, D1 set the first segment pulse’s highest frequency, D2, D3
set the first segment ’s pulse number, D4, D5 set the second segment pulse’s highest frequency,
D6, D7 set the second segment’s pulse number……
⚫ Acceleration/deceleration time is the time from the start to the first segment ’s highest
frequency. Meantime, it defines the slope of all segment’s frequency to time. In this way the
following acceleration/deceleration will perform according to this slope.
⚫ Pulse can be output at only Y000 or Y001
⚫ Frequency range: 0~ 32767Hz (16 bits instruction), 0~200KHz (32 bits instruction)
⚫ Acceleration/deceleration time : 0~65535 ms
Note: the address of pulse segment must be continuous and the pulse frequency and quantity of
segment N+1 must be 0. Acceleration/deceleration time address cannot behind segment N.
M0
M8170
Send 6 segments of pulse, the pulse frequency and quantity please see below table:
Example
Use 32-bit instruction DPLSR, the address is shown as the following table:
Name Pulse Frequency address Pulse quantity pulse quantity
frequency(Hz) (Dword) address (Dword)
Segment 1 1000 D1, D0 2000 D3, D2
Segment 2 200 D5, D4 1000 D7, D6
Segment 3 3000 D9, D8 6000 D11, D10
Segment 4 800 D13, D12 1600 D15, D14
Segment 5 100 D17, D16 800 D19, D18
Segment 6 1200 D21, D20 3000 D23, D22
Acceleration/ 100ms D51, D0
deceleration
time
Note: the 4 registers behind segment 6 must be 0 (D27, D26, D25, D24), which means the pulse
output end; for 16 bits instruction, D25, D24 must be 0.
6 Pulse Output
2、Operands
Operands Function Type
S1 Specify the soft component’s start ID of the segmented pulse 16 bit/ 32 bit,
parameters BIN
S2 Specify acceleration/deceleration time or soft component’s ID 16 bit/ 32 bit,
BIN
D1 Specify the pulse output port Bit
D2 Specify the pulse output direction’s port Bit
M8170
RST M0
⚫ The parameters’ address is a section starts from Dn or FDn. In the above example: D0 set the
first segment pulse’s highest frequency, D1 set the first segment’s pulse number,D2 set the
second segment pulse’s highest frequency, D3 set the second segment’s pulse number, …… if
the set value in Dn, Dn+1 is 0, this represents the end of segment, the segment number is not
limited.
⚫ For 32 bit instruction DPLSR, D0, D1 set the first segment pulse’s highest frequency, D2, D3
set the first segment’s pulse number, D4, D5 set the second segment pulse’s highest frequency,
D6, D7 set the second segment’s pulse number……
6 Pulse Output
⚫ Acceleration/deceleration time is the time from the start to the first segment’s highest
frequency. Meantime, it defines the slope of all segment’s frequency to time. In this way the
following acceleration/deceleration will perform according to this slope.
⚫ Pulse can be output at only Y0 or Y1
⚫ Pulse direction output terminal Y can be specified freely. E.g.: if in S1 (the first segment) the
pulse number is positive, Y output is ON; if the pulse number is negative, Y output is OFF;
Note: the pulse direction is decided by the pulse number’s nature (positive or negative) of the
first segment.
⚫ Frequency range: 0~32767Hz (16 bits), 0~200KHz (32 bits)
⚫ Pulse number range: 0~K32,767 (16 bits instruction), 0~K2,147,483,647 (32 bits instruction)
⚫ Acceleration/deceleration time : below 65535 ms
M0
M8170
6 segments pulse output. The pulse frequency and quantity are shown in the
Example following table:
Use 32bits instruction DPLSR, the address is shown as the following table:
Name Pulse frequency Frequency address Pulse quantity Pulse quantity
(Hz) (Dword) address (Dword)
Segment 1 1000 D1, D0 2000 D3, D2
deceleration
time
Note: the 4 registers behind segment 6 must be 0 (D27, D26, D25, D24), which means the pulse
output end; for 16 bits instruction, D25, D24 must be 0.
6 Pulse Output
1、Instruction Summary
Enter the next segment of pulse output;
Pulse segment switch [PLSNEXT]/[PLSNT]
2、Operands
Operands Function Type
D Specify the pulse output port Bit
If the pulse output reaches the highest frequency at the current segment, and output steadily
at this frequency; when M1 changes from OFF to ON, then enter the next pulse output with the
acceleration/deceleration time; (this instruction is suitable for multi-segment pulse output)
6 Pulse Output
Example
The object needs to move from A to B to C. The speed of the three segments is different. The position
of A, B and C is uncertain. We can use DPLSR and PLSNEXT to make this program. We can use
proximity switch in position A, B, C. Connect the proximity to PLC terminal X1, X2, X3. Pulse
frequency terminal is Y0, pulse direction terminal is Y2.
M8002
DMOV K1000 D0
DMOV K99999999 D2
DMOV K3000 D4
DMOV K999999999 D6
DMOV K2000 D8
FMOV K0 D12 K4
X0
PLSNEXT Y0
X1
X2
Diagram:
M0
f
3000Hz
2000Hz
1000Hz
0 A X0 B X1 C X2
1、Instruction Summary
Stop pulse output immediately;
Pulse stop [STOP]
2、Operands
Operands Function Type
D Specify the port to stop pulse output Bit
D
M1
STOP Y0
M8170
RST M0
⚫ When M0 changes from OFF to be ON, PLSR output pulse at Y0. D0 specify the frequency,
D1 specify the pulse number, D100 specify the acceleration/deceleration time; when the output
pulse number reaches the set value, stop outputting the pulse; on the rising edge of M1, STOP
instruction stops outputting the pulse at Y0;
⚫ When STOP works, the pulse will stop at once even the M0 is not off.
6 Pulse Output
Set
frequency
0 t
M0
M1
M 8170
1、Instruction Summary
Refresh the pulse number at the port;
Refresh the pulse number at the port [PLSMV]
2、Operands
Operands Function Type
S Specify the pulse number or soft components’ ID 32bit, BIN
D Specify the port to refresh the pulse Bit
Word
operands system constant module
D FD ED TD CD DX DY DM DS K /H ID QD
S ● ● ● ● ●
Bit
6 Pulse Output
operands system
X Y M S T C Dn.m
D ●
FEND
I0000
S D
M 8000
PLSMV K0 Y0
IRET
⚫ When the working table is moving backward, it gets the origin signal X2, execute the
external interruption, PLSMV command run immediately, not effected by the scan
cycle. Refresh the pulse number from Y0 and send to D8170;
⚫ This instruction is used to clear the accumulation difference caused in pulse control; ⚫
PLSMV instruction is only for PLSR and DPLSR.
1、Instruction Summary
Back to the Origin
Back to the Origin [ZRN]
6 Pulse Output
2、Operands
Operands Function Type
S1 Specify the backward speed or soft components’ ID 16/32bit, BIN
S2 Specify the creeping speed or soft components’ ID 16/32 bit, BIN
S3 Specify the soft components’ ID of the close point’s signal Bit
D Specify the pulse output port Bit
Word
operands system constant module
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ● ●
operands system
Bit
X Y M S T C Dn.m
S3 ● ●
D ●
6 Pulse Output
M0
⚫ Pulse output address: Y0 or Y1 only; XC5 series is Y0~Y3, 3 axis is Y0~Y2, 10 axis is
Y0~Y11.
⚫ S1 and S2 direction is same and the absolute value of S1 is greater than S2;
⚫ After driving the instruction, move to signal X3 with origin returning speed S1;
⚫ When the closed point signal turns from OFF to be ON, decrease the speed to be S2;
⚫ When the closed point signal X3 turns from OFF to ON, accelerate from origin returning speed
to creeping speed S2.
⚫ When the closed point signal X3 turns from ON to be OFF, after one scanning period, write to
registers (Y0:[D8171,D8170]=0,Y1:[D8174,D8173]=0) when stopping pulse output;
⚫ No acceleration/deceleration time when the instruction works at the beginning, the pulse
frequency changes from 0Hz to S1 suddenly
⚫ The decrease time can be specified by D8230~D8239; please refer to chapter 6-6 for details;
1、Summary
High precision back to the origin
Back to the origin [ZRN]
Execution Normally ON/OFF coil Suitable XC2, XC3, XC5, XCM, XCC
condition models
2、Operand
Operand Function Type
S0 Soft element head address of origin back data block 32 bits, BIN
S1 Soft element address of limit signal bit
S2 Soft element address of origin auxiliary signal bit
S3 Soft element address of origin signal (external bit
interruption)
S 0· S 1· S2· S3 S4· D1 D2
ZRN D0 X0 X1 X2 X3 Y0 Y1
M0
Description:
⚫ Move towards the origin with speed VH.
⚫ If it encounters origin auxiliary signal S2, it will decelerate to speed VL with the slope K (note:
if it encounters the origin when decelerating from VH to VL, please modify the pulse slope or
origin position to avoid it).
⚫ Keep forward with the current speed VL.
⚫ Decelerate to 0 with the slope K after touching the origin.
⚫ Start to delay (delay time is FD8209, unit is ms). It accelerates to creep speed with the slope K
after delaying.
⚫ Move in reverse direction with creep speed.
⚫ Stop origin returning when it leaves the origin with creep speed.
Note: in this mode, please keep the origin limit switch ON during the process (from touching the
origin limit switch at speed VL to stop origin returning)
Mode2:
6 Pulse Output
Description:
⚫ Move towards origin with speed VH.
⚫ If it encounters origin auxiliary signal S2, decelerate to speed VL with slope K.
⚫ Move forward at speed VL.
⚫ Decelerate to 0 with slope K when encountering the origin.
⚫ Start to delay (the delay time is FD8209, unit is ms). Accelerate to creep speed with the slope
K.
⚫ Move in reverse direction at creep speed.
⚫ Stop Z phase counting when leaving the origin at creep speed.
⚫ Stop origin returning when Z phase cumulative value is equal to setting value.
⚫ Change the pulses (D8170) to setting value.
Note: in this mode, please keep the origin limit switch ON during the process (from touching the
origin limit switch at speed VL to stop origin returning)
Mode1:
6 Pulse Output
Description:
⚫ Move towards origin at speed VH, when touching the limit switch, it decelerate to 0 with slope
K.
⚫ Start to delay (delay time is FD8209, the unit is ms). Accelerate to speed VH with slope K after
delaying.
⚫ Run at speed VH.
⚫ Decelerate to 0 with slope K when encountering origin.
⚫ Accelerate to speed VL with slope K and move towards origin.
⚫ Decelerate to 0 with slope K when touching the origin.
⚫ Start to delay (delay time is FD8209, the unit is ms). Accelerate to creep speed with slope K.
⚫ Stop after leaving the origin at creep speed.
Note: in this mode, please keep the origin limit switch ON during the process (from touching the
origin limit switch at speed VL to stop origin returning)
6 Pulse Output
Description:
⚫ Move towards origin at speed VH, decelerate to 0 with slope K when touching the limit signal.
⚫ Start to delay (delay time is FD8209, the unit is ms). Accelerate to speed VH with slope K after
delaying.
⚫ Run at speed VH.
⚫ Decelerate to 0 with slope K when encountering the origin.
⚫ Accelerate to speed VL with slope K and move toward origin.
⚫ Decelerate to 0 with slope K when touching the origin.
⚫ Start to delay (delay time is FD8209, the unit is ms). Accelerate to creep speed with slope K
after delaying.
⚫ Start to count Z phase signal after leaving origin at creep speed.
⚫ Stop origin returning when cumulative value of Z phase signal is equal to setting value.
⚫ Change the pulses to setting value. (D8170)
Note: in this mode, please keep the origin limit switch ON during the process (from touching the
origin limit switch at speed VL to stop origin returning)
1、Instruction Summary
Relative position single-segment pulse control;
Relative position single-segment pulse control [DRVI]
Hardware - Software -
requirement requirement
2、Operands
Operands Function Type
S1 Specify the output pulse value or soft components ID 16/32bit, BIN
S2 Specify the output pulse frequency or soft components ID 16/32 bit, BIN
D1 Specify the pulse output port Bit
D2 Specify the pulse output direction port Bit
M0
⚫ Pulse output ID: only Y0 or Y1; XC5 series is Y0~Y3, 3 axis is Y0~Y2, 10 axis is Y0~Y11
⚫ Pulse output direction can specify any Y;
⚫ Acceleration/deceleration time is specified by D8230 (single word)
⚫ The relative drive form means: move from the current position (the distance from current
position to target position);
⚫ Confirm the value of current position registers before executing the instruction (D8171,
D8170[Y0]/ D8174, D8173[Y1] ……)
Example
The current position of X axis is (100, 0), it will move to target position (3000, 0) at the speed of
1000Hz, pulse output terminal is Y0, direction terminal is Y4. The distance between current position
and target position is 2900=3000-100. The DRVI executing diagram is shown as below:
Program:
M8002
DMOV K2900 D0
DMOV K1000 D2
M0
DDRVI D0 D2 Y0 Y4
M8170 M0
R
6 Pulse Output
1、Instruction Summary
Absolute position single-segment pulse control
Absolute position single-segment pulse control [DRVA]
2、Operands
Operands Function Type
S1 Specify the output pulse value or soft components ID 16/32bit, BIN
S2 Specify the output pulse frequency or soft components ID 16/32 bit, BIN
D1 Specify the pulse output port Bit
D2 Specify the pulse output direction port Bit
Word
operands system constant module
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ● ●
Bit
operands system
X Y M S T C Dn.m
D1 ●
D2 ●
6 Pulse Output
M0
M0
⚫ Pulse output ID: only Y0 or Y1; XC5 series is Y0~Y3, 3 axis is Y0~Y2, 10 axis is Y0~Y11
⚫ Pulse output direction can specify any Y;
⚫ Acceleration/deceleration time is specified by D8230 (single word)
⚫ The relative drive form means: move from the origin position (the position from origin to target
position);
⚫ Confirm the value of current position registers (D8171,
D8170[Y0]/ D8174,
D8173[Y1] ……)
Example
6 Pulse Output
The current position of X axis is (100, 0), it will move to target position (3000, 0) at the speed of
1000Hz, pulse output terminal is Y0, direction terminal is Y4. The distance between origin and
target position is 3000. The DRVA executing diagram is shown as below:
Y
Program:
M 002
DMOV K 3000 D0
DMOV K 1000 D2
M0
DDRVA D 0 D2 Y0 Y4
M 8170
M0
R
PLSA/DPLSA has two control modes, below we will introduce one by one;
1、Instruction Summary
Generate absolute position segmented pulse with the specified frequency, acceleration/deceleration
time and pulse direction;
Absolute position multi-segment pulse control [PLSA]
2、Operands
Operands Function Type
S1 Specify the soft component’s number to output the pulse 16/32bit, BIN
parameters
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ●
S2 ● ● ● ● K
Bit
operands system
X Y M S T C Dn.m
D1 ●
M8170
RST M0
M8170
RST M0
⚫ The parameters’ address is a section starts from Dn or FDn. In the above example: D0 set the
first segment pulse’s highest frequency、D1 set the first segment’s absolute position,D2 set
the second segment pulse’s highest frequency、D3 set the second segment’s absolute position
,…… if the set value in Dn、Dn+1 is 0, this represents the end of segment, we can set 24
segments in total;
⚫ For 32 bits instruction DPLSA, D0, D1 set the first segment pulse highest frequency, D2,D3
set the first segment pulse quantity, D4, D5 set the second segment pulse highest frequency,
6 Pulse Output
D6,D7 set the second segment pulse quantity……. If the setting value of Dn, Dn+1, Dn+2,
Dn+3 are 0, it means the end of the segment. It can set 24 segments in total.
⚫ Acceleration/deceleration time is the time from the start to the first segment’s highest
frequency. Meantime, it defines the slope of all segment’s frequency to time. In this way the
following acceleration/deceleration will perform according to this slope.
⚫ Pulse can be output at only Y0 or Y1; XC5 series is Y0~Y3, 3 axis is Y0~Y2, 10 axis is
Y0~Y11;
⚫ Frequency range: 0~32767Hz (16 bits instruction), 0~200KHz (32 bits instruction)
⚫ Pulse number range: K0~K32,767 (16 bits instruction), K0~K2,147,483,647 (32 bits
instruction)
⚫ Confirm the value in current position registers (D8171,
D8170[Y0]/ D8174,
D8173[Y1] ……)
Note: if the segment quantity is n, the address of the segments must be continuous, and the pulse
frequency and quantity of n+1 segment must be 0. It means the pulse output end. The address of
acceleration/deceleration time cannot follow the segment n.
Example
Note: the 4 registers after segment 6 must be 0. (D27, D26, D25, D24).It means the pulse output
end. For 16 bits instruction PLSA, 2 registers after segment 6 must be 0.
F Hz
3000
1200
1000
800
200
100
0 2000 3000 9000 10600 11400 14400
Program:
6 Pulse Output
1、Instruction Summary
Generate absolute position pulse with the specified frequency, acceleration/deceleration time and
pulse direction;
Absolute position multi-segment pulse control [PLSA]
2、Operands
Operands Function Type
S1 Specify the soft component’s number to output the pulse 16/32bit, BIN
parameters
M8170
RST M0
M8170
RST M0
⚫ The parameters’ address is a section starts from Dn or FDn. In the above example: D0 set the
first segment pulse’s highest frequency、D1 set the first segment’s absolute position,D2 set
the second segment pulse’s highest frequency、D3 set the second segment’s absolute position
,…… if the set value in Dn、Dn+1 is 0, this represents the end of segment, we can set 24
segments in total;
6 Pulse Output
⚫ For 32 bits instruction DPLSA. The parameters’ address is a section starts from Dn or FDn. In
the above example: D0,D1 set the first segment pulse’s highest frequency、D2,D3 set the first
segment’s absolute position,D4,D5 set the second segment pulse’s highest frequency、
D6,D7 set the second segment’s absolute position , …… if the set value in
Dn,Dn+1,Dn+2,Dn+3 is 0, this represents the end of segment, we can set 24 segments in total;
⚫ Acceleration/deceleration time is the time from the start to the first segment’s highest
frequency. Meantime, it defines the slope of all segment’s frequency to time. In this way the
following acceleration/deceleration will perform according to this slope.
⚫ Pulse can be output at only Y0 or Y1, XC5 series is Y0~Y3, 3 axis is Y0~Y2, 10 axis is
Y0~Y11.
⚫ Frequency range: 0~32767Hz (16 bits instruction), 0~200KHz (32 bits instruction)
⚫ Pulse number range: K0~K32,767 (16 bits instruction), K0~K2,147,483,647 (32 bits
instruction)
⚫ Confirm the value in current position registers (D8171,
D8170[Y0]/ D8174,
D8173[Y1] ……)
⚫ The Y port to output the pulse direction can be set freely;
Note: when PLSA and DPLSA have several segments, the direction of these segments must be the
same.
Example
Output 6 segments of pulse through instruction DPLSA. The pulse terminal is Y0, direction terminal
is Y2.
Note: the 4 registers after segment 6 must be 0. (D27、D26、D25、D24). It means the pulse output
end. For 16 bits instruction PLSA, the 2 registers after segment 6 must be 0.
F Hz
3000
1200
1000
800
200
100
0 2000 3000 9000 10600 11400 14400
6 Pulse Output
Program:
1、Summary
Produce relative position multi-section pulse as setting parameters.
Relative position multi-section pulse control [PTO]
2、Operand
Operands Function Type
6 Pulse Output
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ●
Operand System
Bit
X Y M S T C Dn.m
S2 ●
D1 ●
D2 ●
《with direction》
S1· D 1· D2 ·
M0
PTO D0 Y0 Y1
⚫ S1+6 :Pulse falling slope, which is decreasing frequency per second. 0 means urgent stop.
Continuous output 9 sections of pulses, the pulse output terminal is Y0, pulse
Example direction terminal is Y2, the start frequency and end frequency please see the
following table:
Frequency
Hz Section 5
8000
Section 6
Section 4
6000
Section 7
Section 3
3200
Section 2 Section 8
1500
1000
Section 1 Section 9
0 T1 T2 T3 T4 T5 T6 T7 T8 T9 t
Ladder chart:
M0
PTO D4000 Y0 Y2
Set the parameters through PTO config . Please find it in XCPpro software.
6 Pulse Output
Note:
(1) PTO parameters will occupy the registers of D4000~D4205, please don’t use these registers
for other purpose.
⚫ If user has not set the 0 pulse section, the instruction will not be executed.
⚫ If the external signal is produced in zero pulse section, it will switch to the next section (if there
is no next section, stop the pulse output).
⚫ If the external signal is produced in non-zero pulse section, it will run the rest pulses with the
set slope (S1+6 parameter); if the rest pulses is larger than the pulse quantity of frequency
falling section, it will run a smooth section and then the falling section.
⚫ S1+6 are the urgent stop slope when running PSTOP instruction.
⚫ Cannot support absolute position instruction, cannot support instruction with direction.
6 Pulse Output
⚫ The instruction will be executed at the rising edge; if it is normally close signal, the instruction
will be executed repeatedly.
➢ External interruption signal is produced in non-zero pulse section, rest pulses Ss is larger than
falling pulses Sn.
When encountering the external interruption signal, it runs the smooth section with the current
frequency Sm=Ss-Sn, then the falling section Sn.
Ss is pulses of rest section.
Sn is pulses of frequency falling section when encountering external interruption signal.
Sm is pulses of smooth section when encountering the external interruption signal. S6
is the pulses of section 6
➢ The external interruption signal is produced in the non-zero pulse section. The rest pulses Ss is
smaller than falling section pulses Sn.
6 Pulse Output
When encountering the external interruption signal, it runs the falling section with the slope K. When
Ss= S6+S7, it stops outputting the pulses.
Ss is the pulses of rest section.
S6 is the pulses of section 6.
S7 is the pulses of section 7.
Sn is the pulses of falling section when encountering the external interruption signal.
S1+6=0, the pulse will stop after running the smooth section.
Sm=S6+S7+S8
➢ The external interruption signal is produced in non-zero pulse section, rest pulses Ss is smaller
than falling section pulses Sn.
➢ If encountering the external interruption signal, it runs the falling pulses with slope K, when
Ss= S6+S7, it stop outputting the pulses.
Ss is the rest section pulses.
S6 is the pulses of section 6.
S7 is the pulses of section 7.
Sn is the falling section pulses when encountering the external interruption signal.
6 Pulse Output
1、Summary
Section to produce pulse instructions of absolute position according to specified parameters
Absolute position multi-section pulse control [PTOA]
2、Operands
Operands Function Type
S1 Specify the soft component’s start ID of the output 32bits,BIN
pulse parameters
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ●
operands System
Bit
X Y M S T C Dn.m
D1 ●
D2 ●
《With direction》
S1· D 1· D2 ·
M0
PTOA D0 Y0 Y1
The parameters address and functions are shown as below (the parameter is 32 bits, two bytes):
⚫ S1 :Total section N, range is 1~255
⚫ S1+2 :reserved
⚫ S1+4 :The direction(0 is positive,1 is negative) of unlimited pulse section (zero pulse
section)
⚫ S1+6 : Pulse descending slope, decreasing frequency per second, 0 means urgent stop
⚫ The pulse direction of section 1 is decided by current pulse quantity and cumulative pulse
quantity, other section directions are decided by current pulse quantity and last section pulse
quantity;
⚫ Occupied registers size: [(N*3+4)+(N*3+4)+(N*4+5)]*2;
⚫ The toggle condition to execute the pulse is rising edge, if the signal is closed signal the pulse
will execute repeatedly.
The pulse output terminal is Y0, direction terminal is Y2; The start, end frequency,
Example pulse absolute position is shown in below table:
Name Start Frequency(Hz) End Frequency(Hz) Absolute pulse quantity of each section
Section 1 1000 1500 3000
Section 2 1500 3200 6200
Section 3 3200 6000 8200
Section 4 6000 8000 18200
Section 5 8000 8000 36200
Section 6 8000 6000 46200
Section 7 6000 3200 48200
Section 8 3200 1500 51400
Section 9 1500 1000 54400
6 Pulse Output
Frequency
Hz Section 5
8000
Section 6
Section 4
6000
Section 7
Section 3
3200
Section 2 Section 8
1500
1000
Section 1 Section 9
0 T1 T2 T3 T4 T5 T6 T7 T8 T9 t
Ladder chart:
M0
PTOA D 4000 Y0 Y2
Fast configure the parameters through the PTO config function in XCPpro software:
6 Pulse Output
Caution: because the pulse instruction occupy the register address D4000~D5205, these register
addresses can’t be used for other purpose.
1、Summary
Pulse stop instruction, execute with PTO instruction.
Pulse Stop [PSTOP]
2、Operands
Operands Function Type
S1 Specify pulse stop output port bit
S2 Specify pulse stop mode data decimal,K
S2 ●
operands System
Bit
X Y M S T C Dn.m
S1 ●
S1· S 2·
Description M0
PSTOP Y0 K1
0
T
M0
6 Pulse Output
When M0 is ON, the solid line is urgent stop (K1), dotted line is slow stop.
1、Summary
To produce the variable frequency pulses as set parameters:
Variable frequency single section pulse output [PTF]
2、Operands
Operands Function Type
S1 Specify the soft component start ID of the pulse 32 bits,BIN
parameters
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ●● ● ●
X Y M S T C Dn.m
D1 ●
D2 ●
6 Pulse Output
《Without directions》
S1· D1·
PTF D0 Y0
M0
《With directions》
D 1· D2 ·
S1·
PTF D0 Y0 Y1
M0
The parameters are shown as below (the parameters is 32 bits, two bytes):
⚫ S1 :Pulse frequency
⚫ S1+2 : Rising and falling frequency of pulse, which is increasing/decreasing frequency per
second
⚫ Pulse quantity in current section and cumulative pulses are not refreshed. ⚫ Current pulse
frequency is a target for every scanning period
V1
Slope K
V0
Slope K
Slope K
(A) The increasing pulses are 0 in unit time(S1+2 = 0) Pulse frequency will
change as the slope K:
(B) The increase frequency quantity in unit time is not 0(he parameter of
S1+2 is not 0)
1)The pulse is in a smooth section when user set a new frequency, then the frequency will
change to setting frequency through with the setting slope, please see the following
diagram:
6 Pulse Output
2)The pulse is in non-smooth section when user set a new frequency, then the frequency
will change to setting frequency with setting slope (current setting frequency>last setting
frequency, current setting frequency will be the target), please see the following diagram:
Before the frequency reaches V0, user set the new target frequency V1 (V1>V0), then the
frequency will turn to V1 according to the slope.
3)The pulse is in non-smooth section, when user set the new frequency, then change to
setting frequency with the setting slope (Current setting frequency<last setting frequency,
current setting frequency<current frequency), please see the following diagram:
Before the frequency reaches V0, user set the new target frequency V1 (V1<V0, V1<current
frequency), it will go to the decreasing section until V1, the slope is the same to the increasing
section.
6 Pulse Output
6-3.Output Wiring
Y0 Y1 Y2
COM0 COM1 COM2
Below is the graph to show the output terminals and stepping driver wiring:
6- .Notes
4
6 Pulse Output
During ACC/DEC, each step time is 5ms, this time is fixed and not changeable. ⚫ The
minimum step frequency (each step’s rising/falling time) is 10Hz. If the frequency is lower than
10Hz, calculate as 10Hz; the maximum step frequency is 15Hz. If the frequency is larger than 15Hz,
calculate as 15Hz;
In case of frequency larger than 200Hz, please make sure each segment’s pulse number no
less than 10, if the set value is less than 10, send as 200Hz;
频率的跳变
⚫ When outputting the segmented pulse, if the current segment’s pulse has been set out, while
meantime it doesn’t reach the highest frequency, then from the current segment to the next
pulse output segment, pulse jump appears, see graph above;
⚫ To avoid frequency jump, please set suitable acceleration/deceleration time.
In one main program, users can’t write two or more pulse output instructions with one
output port Y;
The below sample is wrong;
6 Pulse Output
PLSR D0 D100 Y0
M0
M0
PLSR D0 D100 Y0
M1
PLSR D200 D1000 Y0
(2)in STL
M10
S0
S
STL S0
M0
PLSR D0 D100 Y0
M1
PLSR D200 D1000 Y0
STLE
(3)in subprogram
6 Pulse Output
M10
CALL P0
FEND
P0
M0
PLSR D0 D100 Y0
M1
PLSR D200 D1000 Y0
SRET
END
STL S0
M1
PLSR D200 D1000 Y0
STLE
FEND
P0
M1
PLSR D200 D1000 Y0
SRET
END
6 Pulse Output
The correct programming method when it needs to write more than one pulse output instructions:
Method 1: use STL, each STL only write one pulse output instruction Example:
M0 S0
0 (S)
M1
S1
4 (S)
8 STL S0
M2
DPLSR D0 D30 Y0 Y2
10
M8170 M2
17 (R)
S0
(R)
23 STLE
24 STL S1
M3
26 DPLSF D100 Y0 Y2
M8170 M3
32 (R)
S1
(R)
38
STLE
Note: the two STL cannot work at the same time! (M2 and M3 cannot be ON at the same time)
Method2: if the same instruction needs to work in many places of the program, user can write one
instruction in the main program, and put its parameter registers in STL.
6 Pulse Output
Method3: use sequence block. BLOCK can support multi-instruction sequential working. Please
refer to chapter 10.
6 Pulse Output
6- .Sample Programs
5
M8170
Program:
M0
0 PLSR D0 D30 Y0 Y2
M1
7 PLSNEXT Y0
M8170 M0
11 ( R )
Note: register D0, D1, D2, D3 set the frequency and pulse quantity of segment 1 and 2. D30 set the
acceleration/deceleration time, reset register D4, D5.
X000
FRQM K20 D0 K1 X003
PLSF D0 Y0
M8170 PULSE_1 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8171 sending” When overflow, Flag is on
M8173 PULSE_2 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8174 sending” When overflow, Flag is on
M8176 PULSE_3 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8177 sending” When overflow, Flag is on
M8179 PULSE_4 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8180 sending” When overflow, Flag is on
M8219 Neglect the alarm or not When flag is 1, stop sending alarm
Note: for frequency rising time of absolution/relative positioning instruction, the register setting
value should meet the following formula:
For example: instruction DRVA K300080 K3000 Y0 Y4, rising time is 100ms. Then
register D8230 (Dword) = 3=[100(ms)×3000(Hz)] ÷100K(Hz).
6 Pulse Output
7 Communication Function
7 Communication Function
This chapter mainly includes: basic concept of communication, Modbus communication, free
communication and CAN-bus communication;
7-1.Summary
7-2.Modbus Communication
7-3.Free Communication
7-4.CAN Communication
Relative Instructions:
7 Communication Function
MODBUS Communication
Coil 7-2-
COLR
Read COLR S1 S2 S3 D1 D2 3
Input
INPR S1 S2 S3 D1 D2 7-2-
INPR coil
3
read
Singl
COL 7-2-
e coil
W COLW D1 D2 S1 S2 3
write
Multi
MCL 7-2-
-coil
W MCLW D1 D2 D3 S1 S2 3
write
Regis
REGR S1 S2 S3 D1 D2 7-2-
REGR ter
3
read
Input
7-2-
INRR regist
3
er
read INRR S1 S2 S3 D1 D2
Singl
e
REG 7-2-
W regist 3
er
write REGW D1 D2 S1 S2
Multi
-
MRG 7-2-
regist
W 3
er
write MRGW D1 D2 D3 S1 S2
Free Communication
Recei
7-3-
RCV ve
RCV S1 S2 n 2
data
7 Communication Function
CAN-bus Communication
Read
CREG CREGR S1 S2 S3 D 7-4-
regist
R 4
er
Write D1 D2 D3 S
CREG CREGW
7-4-
regist
W 4
er
7- .Summary
1
XC2-PLC, XC3-PLC, XC5-PLC main units can fulfill your requirement on communication
and network. They not only support simple network (Modbus protocol、free communication
protocol), but also support those complicate network. XC2-PLC, XC3-PLC, XC5-PLC offer
communication access, with which you can communicate with the devices (such as printer,
instruments etc.) that have their own communication protocol.
XC2-PLC, XC3-PLC, XC5-PLC all support Modbus protocol 、 free protocol these
communication function, XC5-PLC also have CANbus function.
-1-1.COM port
7
COM Port
There are 2 COM ports (Port1、Port2) on XC3 series PLC basic units, while there are 3 COM ports
on XC5 series PLC main units. Besides the same COM ports (COM1、COM2), they have also
CAN COM port.
7 Communication Function
COM 1 (Port1) is the programming port; it can be used to download the program and connect with
the other devices. The parameters (baud rate, data bit etc.) of this COM port are fixed, can’t be re-
set.
Note:
PLC hardware version less than v3.1: port 1 parameters cannot be changed, otherwise port
1 cannot connect to PC
PLC hardware version higher than v3.2: port 1 parameters cannot be changed. But user can
stop the PLC when start, and then initialize the PLC.
COM 2 (Port2) is communication port; it can be used to download program and connect with
other devices. The parameters (baud rate, data bit etc.) of this COM port can be changed via
software.
Via BD cards, XC series PLC can expand port 3. These COM ports can be RS232 and RS485.
1. RS232 Port
Note:
1. Port 1 support RS232.
⚫ COM1 Pin Definition:
COM2 Pin Definition:
2:PRG 4
1 2 4:RxD 5:
:RxD 5: 1 2 TxD
3 4 5 TxD 6: 3 4 5 8:GND
6 8 8
7 VCC 6
7
8:GND
2. RS485 port:
About RS485 port, A is “+” signal、B is “-“ signal.
7 Communication Function
The A, B terminals (RS485) on XC series PLC is the same port to Port 2. These two ports cannot
be used at the same time. (The same to Port 3). Please use twisted pair cable for RS485. (See below
diagram). But shielded twisted pair cable is better and the single-ended connect to the ground.
Send Receive
Interference signal
Receive Send
3. CAN port:
CAN port can be applied to CANBUS communication. The pin terminals are “CAN+”, “CAN-“
For the detailed CAN communication functions, please refer to chapter 7-4 CAN bus function.
7-1-2.Communication Parameters
Communication Parameters
Parameters Setting
COM 2 FD8221 Communication format Baud rate, data bit, stop bit, parity
Unit: ms , if set to be 0, it means no
FD8222 ASC timeout judgment time timeout waiting
Unit: ms , if set to be 0, it means no
FD8223 Reply timeout judgment time timeout waiting
FD8224 Start symbol High 8 bits invalid
FD8225 End symbol High 8 bits invalid
8/16 bits cushion, with/without
start bit, with/without stop bit
FD8226 Free format setting
FD8231 Communication format Baud rate, data bit, stop bit, parity
Unit: ms , if set to be 0, it means no
FD8232 ASC timeout judgment time timeout waiting
※1: The PLC will be off line after changing the communication parameters, use “stop when reboot”
function to keep PLC online;
※2: After modifying the data with special FLASH data registers, the new data will get into effect after
reboot;
1:7bits
Baud rate:
0:No parity data
Please see
1:Odd parity
below table
2:Even parity
0: 8 bits communication
Reserved
1: 16 bits communication
Note: user doesn’t have to calculate the FD value to set the communication parameter.
Please set the parameters in XCPpro software.
After changing the parameters, please restart the PLC to make it effective.
7- .MODBUS Communication
2
7-2-1.Function
Master and slave: in RS485 network, there are one maser and several slaves at one time (see below
diagram). The master station can read and write any slave stations. Two slave stations
cannot communicate with each other. Master station communicates with slave station
through Modbus instructions. Slave station has no program but only response the master
station. (wiring: connect all the RS485 +, connect all the RS485-)
Master
Slave 1 Slave 3
Slave 2
Master Slave
There is dotted line in the diagram. It means any PLC can be master station when the entire PLC in
the network don’t send data. But more than one PLC will send data at one time, the communication
will fail. It is not recommended to use.
7-2-2.Address
For the soft component’s number in PLC which corresponds with Modbus address number, please see
the following table:
Coil address: (Modbus ID prefix is “0x”)
Bit ID ModbusID Modbus ID
( decimal K) (Hex. H)
M0~M7999 0~7999 0~1F3F
X0~X1037 16384~16927 4000~421F
Y0~Y1037 18432~18975 4800~4A1F
S0~S1023 20480~21503 5000~53FF
M8000~M8511 24576~25087 6000~61FF
T0~T618 25600~26218 6400~666A
C0~C634 27648~28282 6C00~6E7A
⚫ The address is used when PLC uses Modbus-RTU protocol. The host machine is PLC, HMI
or SCADA.
⚫ If the host machine is PLC, please write the program as Modbus-RTU protocol. If the host
machine is HMI or SCADA, there are two conditions. Condition one: with Xinje driver such
as Xinje HMI. Please write the program with PLC soft components (Y0, M0, D0…). Condition
two: without Xinje driver. Please choose Modbus-RTU protocol, the address is as the above
table.
※1: Bit soft components X, Y are in Octal form, others are in decimal form.
For example: X10 modbus address is not K16394 but K16392.
Y100 modbus address is K18496.
Note: octal has no Y8/Y9 and Y80/Y90.
00H: all the Xinje XC series PLC broadcast ---- slave stations don’t response.
01H: communicate with address 01H PLC
0FH: communicate with address 0FH PLC
10H: communicate with address 10H PLC……….the max address is FEH (254) 3.
Function and DATA
Function code Function Modbus instruction
01H Read coil COLR
02H Read input coil INRR
03H Read register REGR
04H Read input register INRR
05H Write coil COLW
06H Write register REGW
10H Write multi-register MRGW
0FH Write multi-coil MCLW
If 2 pieces of XINJE XC series PLC communicate with each other, write K5000 to D2.
M0
REGW K 1 H0002 K5000 K2
M0 is trigger condition. If the communication is failure, the instruction will try twice again. If the third
time communication is failure, the communication ends.
The relationship between REGW and Modbus RTU protocol (other instructions are the same)
REGW Function code 06H
K1 Station no.
H0002 Modbus address
K5000 Data contents 1388H
K2 PLC serial port
The complete communication data are : 01H 06H 00H 02H 13H 88H (system take the CRC
checking automatically)
If monitor the serial port data by serial port debugging tool, the data are: 01 06 00 02 13 88 25 5C
Note: the instruction doesn’t distinguish decimal, hex, binary, hex, octal, etc. For example, B10000, K16
and H10 are the same value, so the following instructions are the same.
REGW K1 B111110100 D1 K2
REGW K1 K500 D1 K2
REGW K1 H1F4 D1 K2
7-2-4.Communication Instructions
Modbus instructions include coil read/write, register read/write; below, we describe these instructions in
details:
The operand definition in the instruction:
1. Remote communication station and serial port number
For example, one PLC connects 3 inverters. PLC needs to write and read the parameters of inverter.
The inverter station no. is 1, 2, and 3. So the remote communication station no. is 1, 2, and 3.
For example, local coil is M0, write the M0 state to remote coil.
1、Instruction Summary
Read the specified station’s specified coil status to the local PLC;
Coil read [COLR]
2、Operands
Operands Function Type
S1 Specify the remote communication station 16bits, BIN
S2 Specify the remote coil first address 16bits, BIN
S3 Specify the coil quantity 16bits, BIN
D1 Specify the local coil first address bit
D2 Specify the serial port no. 16bits, BIN
X0
1、Instruction
Read the specified station’s specified input coils into local coils:
Input coil read [INPR]
2、Operands
Operands Function Type
S1 Specify the remote communication station 16bits, BIN
S2 Specify the remote coil first address 16bits, BIN
S3 Specify the coil quantity 16bits, BIN
D1 Specify the local coil first address bit
D2 Specify the serial port no. 16bits, BIN
Word
Operands System constant module
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ● ●
S3 ● ● ● ● ●
D2 K
Bit
Operands System
X Y M S T C Dn.m
D1 ● ● ● ● ● ●
X0
1、summary
Write the local coil status to the specified station’s specified coil;
Single coil write [COLW]
2、Operands
Operands Function Type
D1 Specify the remote communication station 16bits, BIN
D2 Specify the remote coil first address 16bits, BIN
S1 Specify the local coil first address bit
S2 Specify the serial port no. 16bits, BIN
D2 ● ● ● ● ●
S2 K
Bit
Operands System
X Y M S T C Dn.m
S1 ● ● ● ● ● ●
D1 · D2· S1· S2 ·
Function
COLW K1 K500 M1 K2
X0
⚫ Write the single coil, Modbus function code is 05H
⚫ Serial port: K1~K3
1、Summary
Write the local multi-coil status into the specified station’s specified coil;
Multi-coil write [MCLW]
2、Operands
Operands Function Type
D1 Specify the remote communication station 16bits, BIN
D2 Specify the remote coil first address 16bits, BIN
D3 Specify the coil quantity 16bits, BIN
S1 Specify the local coil first address bit
S2 Specify the serial port no. 16bits, BIN
D2 ● ● ● ● ●
D3 ● ● ● ● ●
S2 K
Bit
Operands System
X Y M S T C Dn.m
S1 ● ● ● ● ● ●
D1· D2· D3 · S1 · S2 ·
X0
1、Summary
Read the specified station’s specified register to the local register;
Register read [REGR]
Hardware - Software -
Requirement Requirement
2、Operands
Operands Function Type
S1 Specify the remote communication station 16bits, BIN
S2 Specify the remote register first address 16bits, BIN
S3 Specify the register quantity 16bits, BIN
D1 Specify the local register first address bit
D2 Specify the serial port no. 16bits, BIN
S2 ● ● ● ● ●
S3 ● ● ● ● ●
D1 ●
D2 K
X0
1、Summary
Read the specified station’s specified input register to the local register
Read Input Register [INRR]
S2 ● ● ● ● ●
S3 ● ● ● ● ●
D1 ●
D2 K
S1 · S2· S3· D1 ·
Function D2·
INRR K1 K500 K3 D1 K2
X0
1、summary
Instruction to write the local specified register into the specified station’s specified register;
Single register write [REGW]
16 bits REGW 32 bits -
instruction instruction
Execution Normally ON/OFF、rising edge Suitable XC2, XC3, XC5, XCM,
Condition Models XCC
Hardware - Software -
Requirement Requirement
2、Operands
Operands Function Type
D1 Specify the remote communication station 16bits, BIN
D2 Specify the remote register first address 16bits, BIN
S1 Specify the local register first address 16bits, BIN
S2 Specify the serial port no. 16bits, BIN
D2 ● ● ● ● ●
S1 ●
S2 K
D1 · D2· S1· S2 ·
Function
REGW K1 K500 D1 K2
X0
2、Operands
Operands Function Type
D1 Specify the remote communication station 16bits, BIN
D2 Specify the remote register first address 16bits, BIN
D3 Specify the register quantity 16bits, BIN
S1 Specify the local register first address 16bits, BIN
S2 Specify the serial port no. 16bits, BIN
D2 ● ● ● ● ●
S1 ●
S2 K
D1 · D2 · D3· S1 · S2·
Function X0
MRGW K1 K500 K3 D1 K2
⚫ Wiring method
There are two wiring methods:
A、RS232 wiring method
Note:
(1) COM2 with *1 only show the RS232 pins. The RS485 pins are external terminal, which is not
listed.
(2) XC series PLC RS232 cannot support full-duplex; it only can communicate in single direction.
(3) The communication distance of RS232 is not far (about 13m). RS485 can be further.
Application:
One XC series PLC connects 3 XC series PLCs. 3 slave PLCs follow the master’s action. Master
PLC Y0 ON, slave Y0 ON. Master PLC Y0 OFF, slave PLC Y0 OFF. But the action of 3 slave
PLCs cannot be very synchronous.
Method 1 program
There are 3 STL in the program. Every STL is communication program of one slave. If one STL
communication is successful, it jumps to the next STL. If not, it tries twice. If three times all fail,
M8137 is ON and jump to the next STL. (This program uses serial port 2, if it is other serial port,
please see appendix 1 for communication flag bit)
COLW K2 H4800 Y0 K2
H4800 slave Y 0 modbus address
K2:serial port 2
SBLOCKE
M8000 is always ON coil, the master will keep on writing the Y0 state to slave Y0. (Please refer to
chapter 10 for BLOCK function).
Y0
Broadcast station is 0, all the slaves will response but not reply.
Broadcast cannot read.
When master Y0 state changes, it broadcasts the state to all the slaves. The synchronization is better than
method 1 and 2.
7-3-1.Communication mode
Free format communication transfer data in the form of data block, each block can transfer 128 bytes at
most.
Free format communication mode
Free format is free protocol communication. Now many devices support RS232 or RS485, but the
communication protocol is different. For example, XINJE PLC is Modbus protocol, some
temperature controllers use special protocol. If PLC needs to read temperature, it can send data
according to the temperature controller protocol.
Note:
⚫ Port1, Port2 or Port3 can support free format communication, but free format usually needs to change
the serial port parameters. Port 1 parameter cannot be changed, so it is not recommended to use port
1.
⚫ In free format mode, FD8220 (port 2) or FD8230 (port 3) should set to be 255 (FF)
⚫ Baud Rate: 300bps~115.2Kbps
⚫ Data Format
Data Bit: 7bits, 8bits
Parity: Odd, Even, No Check
Stop bit: 1 bit, 2 bits
⚫ Start bit: 1 bit Stop bit: 1 bit
User can set a start/stop bit, then PLC will automatically add this start/stop bit when sending data;
remove this start/stop bit when receiving data.
Start bit and stop bit can be seemed as header and frame end. If slave station has started and stop
bit, they can be set in software or protocol.
⚫ Communication Format: 8 bits, 16 bits
If choose 8 bits buffer format to communicate, in the communication process, the high bytes are
invalid, PLC only use the low bytes to send and receive data.
If choose 16 bits buffer format to communicate, when PLC is sending data, PLC will send low
bytes before sending higher bytes
7-3-2.Suitable condition
7-3-3.Instruction form
1、Summary
Write the local specified data to the specified station’s specified ID;
Send data [SEND]
2、Operands
Operands Function Type
S1 Specify the start address of local sending data 16bits, BIN
S2 Specify the send character quantity or soft component 16bits, BIN
address
S2 ● ● ● ● ●
n ● K
S1· S 2· n
Function M0
SEND D10 D100 K2
1、Summary
Write the specified station’s data to the local specified ID;
Receive data [RCV]
2、Operands
Operands Function Type
S1 Specify the start address of local receiving data 16bits, BIN
S2 Specify the receive characters quantity or soft component 16bits, BIN
address
S1· S2· n
Function M1
RCV D20 D200 K2
※1: If you require PLC to receive but not send, or receive before send, you need to set the communication
timeout to 0ms
1、Summary
Release the serial port
Receive data [RCVST]
2、Operands
Operands Function Type
n Specify the serial port no. 16bits, BIN
n
Function M0
RCVST K2
M0
M8134
M8135
Receive
data start data
3-4.Free format communication application
7-
Here we use the example in chapter 7-3-2 (XINJE PLC and temperature controller) to explain the
application.
Operation:
1. Connect all the hardware wires.
2. Set the PLC serial port parameters as the controller communication parameters. (PLC station no.
is 255 in free format communication). Please restart the PLC after setting the parameters.
3. Make the program as the protocol in chapter 7-3-2.
Read temperature send data: : R T CR
: ---- start
R ---- read
T ---- temperature
CR ---- enter, end
MOV H52 D1
D1 R ascii 0
code
MOV H54 D2
D2 T ascii 0
code
MOV H0D D3
D1 CR ascii 0
code
SEND D0 K4 K2
D0 : ascii 0
code
M0 M8132
RCV D10 K4 K2
0
D10 receive start
If it needs to use STL, please refer to Modbus example program. Switch the STL by serial port
communication sign bit.
Program:
M8000
SBLOCK read temperature
SEND
RCV
SBLOCKE
When the PLC communicate with other device, please use serial port debug tool to monitor the data.
Then make the free format protocol as the data format in the tool. This method can save time and
easy to do.
XC5 series PLC support CANbus bus function. Below we will give some basic concept on CANbus;
Sub address 00
120R 120R
CAN (Controller Area Network) belongs to industrial area bus category. Compared with common
communication bus, CAN bus data communication has performance of outstanding dependability、
real time ability and flexibility.
CAN controller works under multi-master format. In the network, each node can send data to bus
according to the bus visit priority. These characters enable each node in CAN bus network to have
stronger data communication real time performance, and easy to construct redundant structure,
improve the system’s dependability and flexibility.
In CANBUS network, any node can initiatively send message at any time to any other node,
no master and no slave. Flexibility communication, it’s easy to compose multi-device backup
system, distributing format monitor, control system. To fulfill different real time requirement, the
nodes can be divided to be different priority level. With non-destroy bus adjudication technology,
when two nodes send message to the network at the same time, the low level priority node
initiatively stop data sending, while high level priority node can continue transferring data without
any influence. So there is function of node to node, node to multi-node, bureau broadcasting
sending/receiving data. Each frame’s valid byte number is 8, so the transfer time is short, the
probability ratio is low.
7-4-2.External Wiring
120R
00 01
There are two forms of CAN bus network: one is instructions communication format; the other
is internal protocol communication format. These two forms can work at the same time ➢
Instructions communication format
This format means, in the local PLC program, via CAN-bus instructions, execute bit or word
reading/writing with the specified remote PLC. ➢ Internal protocol communication format
This format means, via setting of special register, via configure table format, realize allude
with each other among PLC’s certain soft component’s space. In this way, PLC can share the
source in CAN-bus network.
7-4-4.CAN-bus Instructions
1、Instruction Description
Function: Read the specified station’s specified coil status into the local specified coil.
Read Coil [CCOLR]
16 bits CCOLR 32 bits -
instruction instruction
Execution Normally ON/OFF, rising Suitable XC5, XCC
Condition edge activates Models
Hardware - Software -
Requirement Requirement
2、Operands
Operands Function Type
S1 Specify remote communication station no. or soft component’s 16bits, BIN
address;
S2 Specify the remote coil’s start address or soft component’s address; 16bits, BIN
S3 Specify the coil quantity or soft component’s address; 16bits, BIN
D Specify the local receive coil’s start address bit
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ● ●
S3 ● ● ● ● ●
Bit
Operands System
X Y M S T C Dn.m
D ● ● ● ● ● ●
S2· D· S1· S3·
X0
Function CCOLR K 20 M 20 K2 K4
⚫ Execute CCOLR instruction when X0 changes from OFF to ON; read the four coils data of remote
station 2, coil’s start address K20 to local coils M20~M23.
➢ Write the Coil [CCOLW]
1、Summary
Write the local specified multi-coils status into the specified station’s specified coils;
Write the coil [CCOLW]
2、Operands
Operands Function Type
D1 Specify remote communication station no. or soft 16 bit, BIN
component’s number;
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ● ●
S3 ● ● ● ● ●
Bit
Operands System
X Y M S T C Dn.m
D ● ● ● ● ● ●
D2 · S· D1· D3·
Function X0
CCOLW K 20 M 20 K2 K4
⚫ Execute CCOLW instruction when X0 changes from OFF to ON; write the local M20~M23 to the
remote station no.2, coil’s start address K20, coil quantity is 4.
1、Summary
Read the specified station’s specified register to the local specified register;
Read register [CREGR]
2、Operands
Operands Function Type
D1 Specify remote communication station no. or soft component’s 16bits, BIN
number;
D2 Specify the remote register’s start address or soft component’s 16bits, BIN
number;
S1· S2 · S3· D·
X0
Function CREGR K2 K 20 K4 D 20
⚫ Execute CREGR instruction when X0 changes from OFF to ON; read the remote station no.2, coil’s
start address K20 (4 coils) to the local D20~D23
1、Summary
Write the specified local input register to the specified station’s specified register;
Write the register [CREGW]
2、Operands
Operands Function Type
D1 Specify remote communication station no. or soft 16bits, BIN
component’s number;
S2 ● ● ● ● ●
S3 ● ● ● ● ●
D ● ● ●
⚫ Execute CREGW instruction when X0 changes from OFF to ON; write the local D20~D23 to the
remote station no.2, coil’s start address K20.
Function
Communication Setting
Item Function Description
FD8350 CAN communication mode 0 represents not use; 1 represents internal protocol
FD8351 CAN baud rate See CAN baud rate setting table
FD8352 Self CAN station no. For CAN protocol using (the default value is 1)
The set value’s unit is ms, represents “send every ms”
Configured sending if set to be 0, it means send every cycle, the default value is
FD8354
frequency 5ms
Status Flag
If set to be 1, then
recover after error
happens;
Automatically If set to be 1, then CAN
M8242 recover the control stops working
after CAN bus error after error happens;
The default value is 1,
this flag is not
power-off retentive
Baud Rate Setting
Register Status
0: no error
2: initialize error
D8240 CAN error information 30: bus error
31: error alarm
32: data overflow
1、Instructions Summary
Write the specified data from the unit to a specified address (data transfer in one unit)
CAN Sending [CSEND]
2、Operands
Operands Function Type
S1 specify the ID of sending data package 16bits, BIN
S2 specify the local sending data or soft component 16bits, BIN
locally
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ● ●
S2 ● ● ● ●
S3 ● ● ● ● ●
Word type
Functions and Actions
M0
CSEND D10 D0 D20
⚫ The ID of sending data package is specified by D10, the data number is specified by D20, the first
ID is in D0;
⚫ 8 bits data transfer: the transferred data is: D0L、D1L、D2L、D3L(D0L means the low byte of
D0)
⚫ 16 bits data transfer: the transferred data is: D0L、D0H、D1L、D1H (D0H means the high byte
of D0)
⚫ Standard Frame: the valid bits of the data package ID number that is specified by D10 is the low
11 bits, the left bits are invalid;
⚫ The expansion frame: the valid bits of the data package ID number that is specified by D10 is the
low 29 bits, the left bits are invalid;
⚫ The maximum data bits specified by D20 is 8, if exceeds 8, the instruction will send only 8 bits;
Word D FD ED TD CD DX DY DM DS K /H ID QD
Type
S1 ● ● ● ●
S2 ● ● ● ●
S3 ● ● ● ●
S4 ●
⚫ The 32 bits memory combined by [D1, D0] (D0 is low byte, D1 is high byte) is
used to stock ID number of the received data package. The received data length is stored in D20.
The data content is stored in registers start from D10. D30 specifies the received ID filter code; if
the received data doesn’t fit the filter codes, then it will keep the RECV status;
⚫ ID filter code: D30 specifies the start address of ID filter codes; the instruction specifies two
groups of filter codes, occupy D30~D37;
Filter Memory Description Example
Code
The D31, D30 D30 low bytes, D31 high D30=0xFFFF, D31=0x0000, then
first bytes, they compose a 32 bits the mask code is 0x0000FFFF
mask code
group D30=0x1234, D31=0x0000, then
D33, D32 D32 low bytes, D33 high bytes, filter value is 0x00001234
they compose a 32 bits If ID and 0x0000FFFF equals
filter value 0x00001234, the pass the first group
of filter. If the ID pass any of two
The D35, D34 D34 low bytes, D35 high groups, the allow the reception
first bytes, they compose a 32 bits
mask code
group
D37, D36 D36 low bytes, D37 high bytes,
they compose a 32 bits
filter value
⚫ Standard/ expansion frame: the setting of FD8358 has no effect to reception. If the data frame
fulfills ID mask codes, the standard frame and the expansion frames can be all received. When
receive the standard frame, the ID bits is 11, but will still occupy the 32 bits memory combined
by [D1,D0]
⚫ 8 bits data transfer: the transfer data is: D0L、D1L、D2L、D3L……(D0L means the low byte
of D0)
⚫ 16 bits data transfer: the transfer data is: D0L、D0H、D1L、D1H……(D0H means the high
byte of D0)
CAN accept
FD8359 timeout time for free format using, unit: ms
3. System D8000
ID Function Description
0: no error
2: initializing error
D8240 CAN error information 30: CAN bus error
31: error alarm
32: data overflow
data package number sent both XC-CAN and FREE modes are
D8242 every second valid
Note: when D8240 is not zero, please try the follow operations:
1. Check the wiring
2. Decrease baud rate or increase sending frequency
Applications
Example 1: instruction communication
PLC station 1 and PLC station 2 communicate with each other through CAN instructions.
Program: (1) M0 is ON, send D100 of PLC station 1 to D20 of PLC station 2 (Y0 and Y2 is ON)
(2) M4 is ON, send D4000 of PLC station 2 to D0 of PLC station 1.
Ladder chart:
PLC station 1:
Set CAN baud rate = 1000 K, sending frequency =5, CAN station no .1, master station no . 1022
Write these parameters in PLC , cut off and power on the power again
M8002
MOV K5 D100
M0 M8013
CREGW K 2 K20 K1 D100
M4
CREGR K 2 K4000 K1 D0
PLC station 2:
Set CAN baud rate =1000 K, sending frequency =5, CAN station no .2, master station no . 1022
Write these parameters in PLC and cut off and power on the PLC again
M8000
MOV D 20 DY0
MOV K 10 D4000
M0
( S)
M0 Y0
( )
M800
M8013
0
CSEND K 100 D4000 K4
PLC station 2:
Receive data package ID100, and save in address starts from D4000 (4 bytes)
M0
CRECV D0 D4000 D20 D30
MOV K4 D20
M 8000
MOV K100 D0
8 PID Control Function
In this chapter, we mainly introduce the applications of PID instructions for XC series PLC basic
units, including: call the instructions, set the parameters, items to notice, sample programs etc.
8- 6.Application Outlines
PID instruction and auto tune function are added into XC series PLC basic units (Version 3.0 and
above). Via auto tune method, users can get the best sampling time and PID parameters and improve
the control precision.
The previous versions can not support PID function on basic units unless they extend analog
module or BD cards. PID instruction has brought many facilities to the users.
⚫ The output can be data form D and on-off quantity Y, user can choose them freely when
program.
⚫ Via auto tune, users can get the best sampling time and PID parameters and improve the
control precision.
⚫ User can choose positive or negative action via software setting. The former is used to
heating control; the latter is used to cooling control.
⚫ PID control separates the basic units with the expansions; this improves the flexibility of
this function.
⚫ A new PID algorithm-critical oscillation is added in v3.3 and higher version of PLC.
Critical oscillation method: the PID auto tune will start at any temperature.
8- .Instruction Forms
2
16 PID 32 bits -
bit instruction
s
instruction
Executing Normally ON/normally closed Suitable XC2, XC3, XC5, XCM, XCC
Condition coil activates Models
Hardware V3.0 or above Software V3.0 or above
Condition V3.3a and above (critical Condition V3.3f and above (critical
oscillation) oscillation)
2、Operands
Operands Usage Type
S1 set the address of the target value (SV) 16bits, BIN
S2 set the address of the tested value (PV) 16 bits, BIN
S3 set the start address of the control parameters 16 bits, BIN
D the address of the operation result (MV) or output port 16 bits, BIN; bit
3、Suitable soft components
S1 ● ●
S2 ● ●
S3 ●
Bit
D ● ●
Type
Operands System
X Y M S T C Dn.m
D ● ● ● ● ●
Functions
and
Actions
8 PID Control Function
D0 S 1· S2 · S3 · D·
X0
PID D10 D4000 D100
S 1· S2 · S3 · D·
X0
PID D0 D10 D4000 Y0
⚫ S3~ S3+ 43 will be
occupied by this instruction, so please don’t use them as the common data registers.
⚫ This instruction executes when each sampling time interval comes.
⚫ To the operation result D, the data registers are used to store PID output values; the output
points are used to output the occupy space ratio in the form of ON/OFF.
⚫ PID control rules are shown as below:
+
Proportion
+
u c (t) r
Integral Be controlled (t) + e
(t)
object (t)
-
+
Differential
8- .Parameters Setting
3
Users can call PID instruction in XCP Pro software directly and set the parameters in the window
(see graph below), for the details please refer to XCPPro user manual. Users can also write the
parameters into the specified registers by MOV instructions before PID operation.
8 PID Control Function
V3.3f and higher version software can choose auto tune mode: step response or critical oscillation.
For PID control instruction’s relative parameters ID, please refer to the below table:
ID Function Description Memo
S3 sampling time 32 bits without sign Unit: ms
S3+1 sampling time 32 bits without sign Unit: ms
S3+2 mode setting bit0:
0: Negative action; 1 positive action;
bit1~bit6 not usable bit7:
0: Manual PID; 1: auto tune PID bit8:
1: auto tune successful flag
8 PID Control Function
S3+9 PID auto tune 0: enable overshoot (valid when using step
overshoot permission 1:not overshoot response method)
8-3-2.Parameters Description
⚫ Movement Direction:
➢ Positive movement: the output value MV will increase with the increasing of the detected value
PV, usually used for cooling control.
➢ Negative movement: the output value MV will decrease with the increasing of the detected
value PV, usually used for heating control.
⚫ Mode Setting
➢ Common Mode:
The parameter’s register zone is from S3 to S3+43, S3 to S3+11 needs to be set by users.
S3+12 to S3+43+12 are occupied by the system, users can’t use them.
➢ Advanced Mode
The parameter’s register zone is from S3 to S3+43, S3 to (S3+11) and (S3+40) to (S3+43) need
to be set by users. (S3+12) to (S3+39) are occupied by the system, users can’t use them.
⚫ Sample Time [S3]
The system collected the current value according to the certain time interval and compared
them with the output value. This time interval is the sample time T. There is no requirement
for T during AD output. T should be larger than one PLC scan period during port output. T
value should be chosen among 100~1000 times of PLC scan periods.
⚫ PID Operation Zone [S3+6]
PID control is entirely opened at the beginning and close to the target value with the highest
speed (the defaulted value is 4095), when it entered into the PID computation range, parameters
Kp, Ti, TD will be effective. See graph below:
If the target value is 100, PID operation zone is 10, and then the real PID’s operation zone is from
90 to 110.
⚫ Death Region [S3+7]
If the detected value changed slightly for a long time, and PID control is still in working mode,
then it belongs to meanless control. Via setting the control death region, we can overcome this
condition. See graph below:
8 PID Control Function
Suppose: we set the death region value to be 10. Then in the above graph, the difference is only 2
comparing the current value with the last value. It will not do PID control. The difference is 13
(more than death region 10) comparing the current value with the next value, this difference value
is larger than control death region value; it will do the PID control with 135.
If users do not know how to set the PID parameters, they can choose auto tune mode which can find
the best control parameters (sampling time, proportion gain Kp, integral time Ti, differential time
TD) automatically.
⚫ Auto tune mode is suitable for these objects: temperature, pressure; not suitable for liquid
level and flow.
⚫ For step response method: Users can set the sampling cycle to be 0 at the beginning of the
auto tune process then modify the value manually in terms of practical needs after the auto tune
process is completed.
⚫ For step response method: Before doing auto tune, the system should be under the non-
control steady state. Take the temperature for example; the detected temperature should be the same
to the environment temperature.
⚫ For critical oscillation method: user needs to set the sampling time at the beginning of the
auto tune process. Reference value: for slow response system, 1000ms. For high response system,
10-100ms.
⚫ For critical oscillation method: the system can start the auto tune at any state. For
temperature object, the current temperature doesn’t need to be same to ambient temperature.
⚫ Two different method and PID control diagram:
(1) Step response method
Make sure current temperature is equal to ambient temperature
output
D0
+ DIFF
D0
Setting value
D0
- DIFF
D0
+ DIFF
D0
Setting value
D0
- DIFF
To enter the auto tune mode, please set bit7 of (S3+ 2) to be 1 and turn on PID working condition.
※1: if users have no experience, please use the defaulted value 10, set PID sampling time (control
period) to be 0ms then start the auto tune.
If set 1, overshooting is not permitted. For these objectives which have strict safety demand such as
pressure vessel, set [S3+ 9] to be 1 to prevent from detected value seriously over the target value.
In this process, if [S3+ 2] bit8 changes from 0 to 1, it means the auto tune is successful and the
optimal parameters are got; if [S3+ 2] is always 0 until [S3+ 2] bit7 changes from 1 to 0, it means
the auto tune is completed but the parameters are not the best and need to be modified by users.
⚫ Every adjustment percent of current target value at auto tune process finishing transition
stage [S3+10]
If doing PID control after auto tune, small range of overshooting may be occurred. It is better to
decrease this parameter to control the overshooting. But response delay may occur if this value is
too small. The defaulted value is 100% which means the parameter is not effective. The
Cutline Explanation:
Current target value adjustment percent is 2/3 (S3 + 10 = 67%), the original temperature of the
system is 0 Cº , target temperature is 100 Cº , and the current target temperature adjustment situation
is shown as below:
Next current target value = current target value + (final target value – current target value) × 2/3;
So the changing sequence of current target is 66 ºC, 88 ºC, 96 ºC, 98 ºC, 99 ºC, 100 ºC.
℃
100 Target value
96 Current target 3
88 Current target 2
66 Current target 1
⚫ The stay times of the current target value in auto tune process finishing transition stage [S3+11]
This parameter is valid only when [S3+9] is 1;
If entering into PID control directly after auto tune, small range of overshoot may occur. It is good
for preventing the overshoot if increasing this parameter properly. But it will cause response lag if
this value is too large. The default value is 15 times. The recommended range is from 5 to 20.
8- .Advanced Mode
5
Users can set some parameters in advanced mode in order to get the better effect of PID control.
Enter into the advanced mode, please set [S3+2] bit 15 to be 1, or set it in the XCP Pro software.
➢ Input Filter constant
It will smooth the sampling value. The default value is 0% which means no filter.
➢ Differential Gain
The low pass filtering process will relax the sharp change of the output value. The default value is
50%; the relaxing effect will be more obviously if increasing this value. Users do not need to change
it.
➢ Upper-limit and lower-limit value
8 PID Control Function
Users can choose the analog output range via setting this value.
Default value: lower- limit output= 0
Upper -limit= 4095
8- .Application Outlines
6
➢ Under the circumstances of continuous output, the system whose effect ability will die down
with the change of the feedback value can do self-study, such as temperature or pressure. It is
not suitable for flux or liquid level.
➢ Under the condition of overshoot permission, the system will get the optimal PID parameters
from self-study.
➢ Under the condition of overshoot not allowed, the PID parameters got from self-study is up to
the target value, it means that different target value will produce different PID parameters
which are not the optimal parameters of the system and for reference only.
➢ If the self-study is not available, users can set the PID parameters according to practical
experience. Users need to modify the parameters when debugging. Below are some
experience values of the control system for your reference:
➢ Temperature system:
P (%) 2000 ~ 6000, I (minutes) 3 ~ 10, D (minutes) 0.5 ~ 3
➢ Flux system: P (%) 4000 ~ 10000, I (minutes) 0.1 ~ 1
➢ Pressure system: P (%) 3000 ~ 7000, I (minutes) 0.4 ~ 3
➢ Liquid level system: P (%) 2000 ~ 8000, I (minutes) 1 ~ 5
8- .Application
7
9 C Function Block
In this chapter, we focus on C language function block’s specifications, edition, instruction calling,
application points etc. we also attach the common Function list.
9-1.Functions Summary
9-2.Instrument Form
9-3.Operation Steps
9-6.Example Program
9-7.Application Points
9-8.Function List
10 Sequence Block
9- .Summary
1
This is the new added function in XCPPro software. This function enables the customers to write
program via C language in XCPPo; and call the C program at any necessary place. This function
supports most of C language functions, strength the program’s security. As users can call the
function at many places and call different functions, this function increase the programmer’s
efficiency greatly.
9- .Instruction Format
2
1、Instruction Summary
Call the C language Func Block at the specified place
Call the C language Func Block [NAME_C]
2、Operands
Operands Function Type
S1 name of C Func Block, defined by the user String
S2 Correspond with the start ID of word W in C language 16 bits, BIN
Function
S3 Correspond with the start ID of word B in C language Function 16 bits, BIN
Word
D FD ED TD CD DX DY DM DS K /H ID QD
S2 ●
10 Sequence Block
Bit
Operands System
X Y M S T C Dn.m
S3 ●
NAME_C D0 M0
X0
⚫ The name is composed by numbers, letters and underlines, the first character can’t be
numbers, and the name’s length shouldn’t longer than 8 ASC.
⚫ The name can’t be same with PLC’s self instructions like LD, ADD, SUB, PLSR etc. ⚫
The name can’t be same with the func blocks exist in current PLC;
9- .Operation Steps
3
1、Open PLC edit tool, in the left “Project” toolbar, choose “Func Block”, right click it and choose
“Add New Func Block”
10 Sequence Block
3、After new create the Func Block, you can see the edit interface as shown below:
10 Sequence Block
⚫ Parameters’ transfer format: if call the Func Block in ladder, the transferred D and M is the start
ID of W and B. Take the above graph as the example, start with D0 and M0, then W[0] is D0,
W[10] is D10, B[0 is M0, B[10]is M10. If in the ladder the used parameters are D100, M100,
then W[0] is D100, B[0]is M100. So, word and bit component’s start address is defined in
PLC program by the user.
⚫ Parameter W: represent Word soft component, use in the form of data group. E.g. W [0] =1; W
[1] =W [2] +W [3]; in the program, use according to standard C language rules.
⚫ Parameter B: represent Bit soft component, use in the form of data group. Support SET and
RESET. I.g: B[0]=1;B[1]=0; And assignment, for example B[0]=B[1]。
⚫ Double-word operation: add D in front of W, e.g. DW[10]=100000, it means assignment to the
double-word W[10]W[11]
⚫ Floating Operation: Support the definition of floating variable in the function, and execute
floating operation;
⚫ Function Library: In Func Block, users can use the Functions and Variables in function library
directly. For the Functions and Variables in function library, see the list in Appendix.
⚫ The other data type supported:
BOOL; //BOOL Quantity
INT8U; //8 bits unsigned integral INT8S;
//8 bits signed integral
INT16U //16 bits unsigned integral INT16S
//8 bits signed integral
INT32U //32 bits unsigned integral INT32S
//32 bits signed integral
FP32; //Single precision Floating
FP64; // Double precision
Floating ⚫ Predefined Marco #define true 1
#define false 0
#define TRUE 1
10 Sequence Block
#define FALSE 0
1、Export
(1) Function: export the function as the file, then other PLC program can import to use;
2、Import
Function; Import the exist Func Block file, to use in the PLC program;
10 Sequence Block
Choose the Func Block, right click “Import Func Block from Disk”, choose the correct file, and
then click OK.
Example: Add D0 and D1 in PLC’s registers, and then assign the value to D2;
(1) In “Project” toolbar, new create a Func Block, here we name the Func Block as ADD_2, then edit
C language program;
(2) Click compile after edition
According to the information shown in the output blank, we can search and modify the
grammar error in C language program. Here we can see that in the program there is no “;” sign
behind W [2] =W [0] +W [1];
Compile the program again after modify the program. In the information list, we can confirm that
there is no grammar error in the program;
10 Sequence Block
(3) Write PLC program, assign value 10 and 20 into registers D0, D1 separately, then call Func Block
ADD_2, see graph below:
(4) Download program into PLC, run PLC and set M0.
(5) From Free Monitor in he toolbar, we can see that D2 changes to be 30, it means the assignment is
successful;
Free Monitor
9- .Program Example
6
10 Sequence Block
If PLC needs to do complicated calculation (including plus and minus calculation), the calculation
will be used for many times, C language function is easy to use.
Example 1:
Calculation a=b/c+b*c+(c-3)*d. Method
1: use ladder chart:
⚫ Get the result of c-3
⚫ Get the result of three multiplication equations
⚫ Get the sum
Ladder chart only support two original operands, it needs many steps to get the result.
M8000
SUB D2 K3 D10
2 -1
D2:C
D10:C-3
MUL D1 D2 D14
4 2 8
D1:B
D2:C
D14:B*C
DIV D1 D2 D16
4 2 2
D1:B
D2:C
D16:B/C
Note:
1. The result of MUL is Dword, the result is stored in D14~D15.
2. The result of DIV has quotient D16 and remainder D17. If D17 has value, the calculation
precision will decrease. Please use float format to ensure the precision.
3. D16 quotient is word value, in plus calculation all the data should be changed to Dword. The
final result is stored in D22~D23.
Ladder chart:
输出值
PID 运算范围
目标值
PID 全开区
时间 t
C program:
Example 2:
Calculate CRC parity value via Func Block ➢
CRC calculation rules:
(1) Set 16 bits register (CRC register) = FFFF H
⚫ XOR (Exclusive OR) 8 bits information with the low byte of the 16 bits CRC register.
⚫ Right shift 1 bit of CRC register, fill 0 in the highest bit.
⚫ Check the right shifted value, if it is 0, save the new value from step3 into CRC register; if it is
not 0, XOR the CRC register value with A001 H and save the result into the CRC register.
⚫ Repeat step3&4 until all the 8 bits have been calculated.
⚫ Repeat step2~5, then calculate the next 8 bits information. Until all the information has been
calculated, the result will be the CRC parity code in CRC register.
MOV H12 D1
MOV H34 D2
MOV H56 D3
MOV H78 D4
MOV H90 D5
M8002
CRC _CHECK D0 M0
⚫ Download to PLC, then RUN PLC, set M0, via Free Monitor, we can find that values in D6 and
D7 are the highest and lowest bit of CRC parity value;
10 Sequence Block
9- .Application Points
7
⚫ When upload the PLC program in which there are some Func Blocks, the Func Blocks can’t be
uploaded, there will be an error say: There is an unknown instruction;
⚫ In one Func Block file, you can write many functions, they can be call each other;
⚫ Each Func Block files is independent, they can’t call each other;
⚫ Func Block files can call C language library functions in form of floating, arithmetic like sin,
For example: click TEL10, the function name will show on the project bar:
9- .Function Table
8
char * strcat(char *s1, const char *s2); Connect string ct behind string s
Return the first word c position in
char * strchr(const char *s, int c); string s
int strcmp(const char *s1, const char *s2); Compare string s1 and s2
char * strcpy(char *s1, const char *s2); Copy string s1 to string s2
double exp(double x); float expf(float x); Exponent (e^x) of a nature data
double fabs(double x); float fabsf(float x); Absolute value of parameter x
Return the largets dounble integral
which is smaller or equals with x
double floor(double x); float floorf(float x);
double ldexp(double x, int float ldexpf(float x, int exp); X multipy the (two to the power of
exp); n) is x*2^n.
10 Sequence block
This chapter will introduce the sequence block instruction and the application.
Block instruction:
Block
Stop
SBSTO the SBSTOP S1 S2 10-6-
P BLOC 1
K
Contin
ue
SBGOO runnin SBGOON S1 S2 10-6-
N g the 1
BLOC
K
10 Sequence Block
10-1-1.BLOCK summarization
Sequence block, which is also called block, is a program block can realize certain function. Block
is a special flow, all the instructions run in order; this is the difference from other flows.
BLOCK starts from SBLOCK and ends by SBLOCKE, you can write program between them. If
there are many pulse output instructions (or other instructions), they will run one after one according
to the condition. After one pulse outputting over then the next pulse will output. The construction
of the block is as the following:
User’s program
Communication
Frequency inverter
Wait instruction
Instruction list
SBLOCKE
10 Sequence Block
BLOCK start
※1: The BLOCK quantity can up to 100 for XC series PLC, XC3-14 BLOCK quantity is 30.
To optimize the editing method of pulse and communication instruction in the process
In former program, XC series PLC can not support many pulse or communication instructions in one
process, but BLOCK can support this and the instructions will run in sequence.
STL S0
STL S0
M0 M0
PLSR D0 D2 D4 Y0 PLSR D 0 D2 D4 Y0
PLSR D0 D2 D4 Y0 STLE
Former
STLE
STL S1
M1
PLSR D 0 D2 D4 Y0
STLE
M0
SBLOCK Sequence block1
After DPLSR D 0 D2 D4 Y0
using
block
DPLSR D6 D 8 D 10 Y 0
SBLOCKE
STL S0
STL S 0
M0
M0
COLR K1 K500 K3 M1 K2
COLR K 1 K 500 K3 M 1 K2
STLE
10 Sequence Block
M0
SBLOCK communication
COLR K1 K500 K3 M1 K2
After
using COLR K2 K500 K3 M1 K2
block
SBLOCKE
Note: when the trigger condition of BLOCK is normal ON coil, the BLOCK will execute one by one
from up to down circular until the condition is OFF.
When the trigger condition of BLOCK is rising edge, the BLOCK will execute once from up to down.
In one program file, it can call many BLOCK; the following is the method to add BLOCK in the
program.
Open XCPpro software; right click the sequence block in the project bar:
You can edit the program in this window. Upwards and downwards are used to change the
position of the instruction in the block.
There is an “Insert” choice on the bottom left of the window, when selecting it, the add button
will become insert:
If you want to move the block to other position, you have to select the former block and delete
it.
You can select the whole block and delete it. If you want to delete the block forever, please
right click the block you want to delete in the project bar and select “delete sequence block”. After
this operation, you can not call this block anymore.
10 Sequence Block
10-3-2.Pulse item
Set the pulse output frequency, numbers, output terminals, accelerate/decelerate time and so on.
Then add the pulse instruction in the block:
10-3-3.Modbus item
Open the modbus item window:
Select the modbus instructions, set the address and com port, then software will build an
instruction.
10-3-4.Wait item
Users only have to set the parameters in below window; the PLC will communicate with the
frequency inverter.
10 Sequence Block
There are four areas in the window, the following will introduce one by one:
(A) Inverter station number and serial number
Set the station number of the frequency inverter and the PLC serial port:
There are two methods to set the data. Const data is to set the value directly. Reg is to set the
value via register.
10 Sequence Block
Besides, it needs to set the communication parameters. Click “serial port config”:
10 Sequence Block
1. If there are many blocks, they run as the normal program. The block is running when the
condition is ON.
(A) The condition is normal ON, normal OFF coil
M1
SBLOCK Sequence block 1
M2
SBLOCK Sequence block 2
M3
SBLOCK Sequence block 3
10 Sequence Block
M1
M2
M3
M3
When M1, M2, M3 is from OFF to ON, all these blocks will run once.
2. The instructions in the block run in sequence according to the scanning time. They run one
after another when the condition is ON. (A) Without SKIP condition
M0 Y0
( )
M1 Y1
( )
M2
DPLSR D 0 D 2 D 4 Y0
DPLSR D 0 D 2 D 4 Y1
Inverter Config
SBLOCKE
10 Sequence Block
Scanning period 1 Scanning period 2 Scanning period 3 Scanning period 4 Scanning period 5
M2
BLOCK condition is
PLS Y0 PLS Y1 Inverter config
OFF and all the
sequence instructions
BLOCK running
M1 Y1
( )
M2
SBLOCK Sequence block1
M3
DPLSR D 0 D 2 D 4 Y0
M4
DPLSR D 0 D 2 D 4 Y1
M5
Inverter config
SBLOCKE
Explanation:
A) When M2 is ON, block 1 is running.
B) All the instructions run in sequence in the block.
C) M3, M4, M5 are the sign of SKIP, when they are ON, this instruction will not run.
D) When M3 is OFF, if no other instructions use this Y0 pulse , DPLSR D0 D2 D4 Y0 will
run; if not, the DPLSR D0 D2 D4 Y0 will run after it is released by other instructions.
E) After “DPLSR D0 D2 D4 Y0” is over, check M4. If M4 is OFF, check “DPLSR D0 D2 D4
Y1”, if M4 is ON, check M5. If M5 is OFF, “inverter config” will run.
10 Sequence Block
M0 M0
M1 M1
DPLSR D 0 D 2 D4 Y0 DPLSR D 0 D 2 D4 Y0
SBLOCKE SBLOCKE
M2 M2
SBLOCK Sequence block2
SBLOCK Sequence block2
SBLOCKE SBLOCKE
2. Do not use the same pulse output terminal in BLOCK and main program.
NO(×) YES(√)
M0 M0
DPLSR D 0 D 2 D4 Y 0 DPLSR D 0 D 2 D4 Y 1
M2 M2
SBLOCK Sequence block1 SBLOCK Sequence block1
SBLOCKE SBLOCKE
3. There only can be one SKIP condition for one BLOCK instruction.
NO(×) YES(√)
10 Sequence Block
M0 M0
SBLOCK Sequence block1 SBLOCK Sequence block1
M1 M2 M1
DPLSR D 0 D 2 D4 Y0 DPLSR D 0 D 2 D4 Y0
SBLOCKE SBLOCKE
4. The SKIP condition only can use M, X, can not use other coil or register.
NO(×) YES(√)
M0 M0
T0 X0
DPLSR D 0 D 2 D4 Y0 DPLSR D 0 D2 D4 Y0
M2[D 10] M2
DPLSR D 0 D2 D 4 Y 1 DPLSR D 0 D2 D 4 Y 1
SBLOCKE SBLOCKE
M0
SBLOCK Sequence block1
M1 M0
SBLOCK Sequence block1
HSCR C600 D 0
M2 M1
M3 M2
PWM K100 D0 Y1 DPLSR D 0 D2 D 4 Y 1
SBLOCKE SBLOCKE
7. BLOCK is not recommended to put in the STL. Because if one STL ends, but the BLOCK
doesn’t end, big problem will happen.
NO(×) YES(√)
10-6-1.Instruction explanation
1、Summarization
Stop the instructions running in the block
[SBSTOP]
2、Operand
Operand Function Type
S1 The number of the BLOCK 16 bits, BIN
S2 The mode to stop the BLOCK 16 bits, BIN
3、Suitable component
10 Sequence Block
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ●
S2 K
SBSTOP K1 K0
M↑1
K1 K0
0 t
1、Summarization
This instruction is opposite to BSTOP. To continue running the BLOCK.
[SBGOON]
2、Operand
Operand Function Type
S1 The number of the BLOCK 16 bits, BIN
S2 The mode to continue running the BLOCK 16 bits, BIN
10 Sequence Block
3、Suitable component
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ●
S2 K
Word Comp
onent
Function
S1· S2·
SBGOON K1 K0
M3
↑
⚫ S2 is the mode to continue running the BLOCK. Operand: K0, K1. K0: continue
running the instructions in the BLOCK. For example, if pulse outputting stopped last
time, SBGOON will continue outputting the rest pulse. K1: continue running the
BLOCK, but abandon the instructions have not finished last time. Such as the pulse
output instruction, if the pulse has not finished last time,
SBGOON will not continue outputting this pulse but go to the next instruction in the
BLOCK.
Scanning period1 Scanning period 2 Scanning period 3 Scanning period 4 Scanning period 5
Condition M0
Condition
ConditionMM
22
Condition M4
M4
PLS Y0
PLS Y0
When M0 is from OFF→ON, run “DSPLSR D0 D2 D4 Y0” in the BLOCK to output the pulse;
when M2 is from OFF→ON, the BLOCK stops running, pulse outputting stops at once; when M4
is from OFF→ON, abandon the rest pulse.
2. SBSTOP (K1 K1) + SBGOON (K1 K0)
When M0 is from OFF→ON, run “DSPLSR D0 D2 D4 Y0” in the BLOCK to output the pulse;
when M2 is from OFF→ON, the BLOCK stops running, the pulse outputting stops at once; when
M4 is from OFF→ON, output the rest pulses.
Scanning period 1 Scanning period 2 Scanning period 3 Scanning period 4 Scanning period 5
Condition M0
Condition M1
Condition M4
PLS Y0
When M0 is from OFF→ON, run “DSPLSR D0 D2 D4 Y0” in the BLOCK to output the pulse;
when M1 is from OFF→ON, stop the BLOCK, the pulse will stop slowly with slope, when M4 is
from OFF→ON, abandon the rest pulses.
Scanning period 1 Scanning period 2 Scanning period 3 Scanning period 4 Scanning period 5
Condition M0
Condition M1
Condition M3
PLS Y0
PLS Y0
When M0 is from OFF→ON, run “DSPLSR D0 D2 D4 Y0” in the BLOCK to output the pulse;
when M1 is from OFF→ON, stop running the BLOCK, the pulse will stop slowly with slope; when
M3 is from OFF→ON, output the rest pulses.
Please note that though the SBSTOP stops the pulse with slope, there maybe still some pulses; in
this case, if run SBGOON K1 again, it will output the rest of the pulses.
Scanning period 1 Scanning period 2 Scanning period 3 Scanning period 4 Scanning period 5
M8630
…….. …….
D8630
…….. …….
8.Program example
10-
Example 1:
This example is used in the tracking system. The process is like this:
Output some pulses and prohibit the exterior interruption.
Continue outputting the pulse but at low speed, and open the exterior interruption. When checked
the exterior cursor signal, stop the pulse outputting and machine running.
Ladder chart:
10 Sequence Block
RST M8050
Notes:
M8050: prohibit the exterior interruption
10 Sequence Block
Example 2:
One PLC (master station no.1) communicates with 3 PLCs (slave station no. 2, 3, 4) via serial port
2 RS485. Master PLC needs to read the D0 value of 3 PLCs. Then store the value in master PLC
D100~D102.
M8000
SBLOCK read slave value
REGR K 4 K0 K1 D102 K2
Communicate with slave station 4
SBLOCKE
M8000 is normal ON coil, the master PLC can real-time communicate with slave PLCs.
11 Special Function Instructions
In this chapter, we mainly introduce PWM pulse width modulation, frequency detect, precise time, interruption
etc;
11-2.Frequency Detect
11-3.Precise Time
11-4.Interruption
11 Special Function Instructions
Instructions List
Frequenc FRQM S1 D S2 S3
FRQM y 11-2
Detection
Time
STR D1 D2
Precise
STR 11-3
Time
Read
STRR S
STRR Precise 11-3
Time
Register
Stop STRS S
STRS Precise 11-3
Time
Interruption
Enable
EI Interrupti EI 11-4-1
on
Disable
DI Interrupti DI 11-4-1
on
11 Special Function Instructions
Interrupti IRET
IRET 11-4-1
on Return
1、Instruction’s Summary
Instruction to realize PWM pulse width modulation
PWM pulse width modulation [PWM]
hardware - software -
requirement requirement
2、Operands
Operands Function Type
S1 specify the occupy ratio value or soft component’s ID number 16 bits, BIN
S2 specify the output frequency or soft component’s ID number 16 bits, BIN
D specify the pulse output port bit
11 Special Function Instructions
X0
PWM output use the unit of 0.1Hz, so when set (S2) frequency, the set value is 10 times of
the actual frequency (i.e. 10f). E.g.:to set the frequency as 72 KHz, and then set value in
(S2) is 720000.
When X000 is ON, output PWM wave;When X000 is OFF, stop output. PMW output
T0
2.Frequency Testing
11-
1、Instruction’s Summary
Instruction to realize frequency testing
frequency testing [FRQM]
hardware - software -
requirement requirement
2、Operands
D FD ED TD CD DX DY DM DS K /H ID QD
S1 ● ● ● ●
S2 ●
D ● ● ●
Operands System
Bit
X Y M S T C Dn.m
S3 ●
11 Special Function Instructions
S1: sampling pulse quantity: the number to calculate the pulse frequency, this parameter can be changed as
the frequency (generally, the higher the frequency the larger the pulse quantity)
D: tested result, the unit is Hz.
S2: Frequency division choice. Range: K1 or K2;
Whatever K1 or K2, the effect is the same. Testing frequency range is 1~200 KHz. ⚫ The
testing precision will change when the frequency increasing. 1~80 KHz, precision is 100%;
80~200 KHz, precision is 99.5%.
When X0 is ON, FRQM will test 20 pulses from X3 every scan cycle. Calculate the
frequency’s value and save into D100. Test repeat. If the tested frequency’s value is
smaller than the test range, then return the test value is 0.
3.Precise Time
11-
1、Instruction List
Type X terminal
XC2 14/16/24/32/48/60 X1
XC3 24/32/42 X1
XC5 48/60 X1
XCM 60 X1
11 Special Function Instructions
hardware - software -
requirement requirements
2、Operands
Operands Function Type
D Timer Number bit
D1 Timer Number bit
D2 specify timer’s value or soft component’s ID 16 bits, BIN
number
11 Special Function Instructions
X0
T600
100ms 100ms
D·
X0
STRR T600
M0
When X0 changes from OFF to ON, move the current precise time value into TD600 immediately, it will
not be affected by the scan cycle;
When M0 changes from OFF to ON, execute STRS instruction immediately, stop precise time and refresh
the count value in TD600. It will not be affected by the scan cycle;
When the precise time reaches the count value, it will generate an interruption tag, interruption subprogram
will be executed.
Start the precise time in precise time interruption;
Every precise timer has its own interruption tag, see table below:
X0
STR T600 K100
When X0 changes from OFF to ON, T600 will start timing.
When time accumulates to 100ms, set ON T600; meantime,
generate an interruption, the program jumps to interruption
tag I3001 and execute the subprogram.
M0
RST T600
FEND
I3001
IRET
T618 I3010
4.Interruption
11-
XC series PLC are equipped with interruption function. The interruption function includes
external interruption and time interruption. Via interruption function we can dispose some special
programs. This function is not affected by the scan cycle.
11-4-1.External Interruption
Subprogram
Input interrupt
XC3-14
Pointer No. Disable the
Input interruption
Rising Falling instruction
Terminal
Interruption Interruption
XC2-24/32/48/60、XC3-24/32/42、XC5-24/32/48/60 XC3-48/60、XC3-19AR-E
XCM-60
Input Pointer No.
Terminal Disable the interruption instruction
Rising Interruption Falling Interruption
X2 I0000 I0001 M8050
X3 I0100 I0101 M8051
X4 I0200 I0201 M8052
X5 I0300 I0301 M8053
XCC-24
XCC-32
Interruption Instruction
Pointer No.
Input Terminal Disable the interruption instruction Enable
Rising Interruption Falling Interruption Interruption [EI]
X14 I0000 I0001 M8050 、 Disable
Interruption [DI]
X15 I0100 I0101 M8051
、 Interruption
Return [IRET]
Pointer No.
Input Terminal Disable the interruption instruction
Rising Interruption Falling Interruption
X14 I0000 I0001 M8050
X15 I0100 I0101 M8051
X16 I0200 I0201 M8052
X17 I0300 I0301 M8053
11 Special Function Instructions
11-4-2.Time Interruption
In the condition of main program’s execution cycle long, if you need to handle a
special program; or during the sequential scanning, a special program needs to
be executed at every certain time, time interruption function is required. This
function is not affected by PLC’s scan cycle, every Nm, execute time interruption
subroutine.
X0
Y0
FEND
I4010
M8000
INC D0
IRET
11 Special Function Instructions
Interruption No
EI
Interruption Allowed
FEND
I4010
Interruption Program
IRET
Interruption Forbidden
EI
M0
Interruption
M8056 Allowed
FEND
I4020
Interruption
Program
IRET
END
⚫ The first 3CH interruptions are equipped
with special relays (M8056~M8059) to
forbid interrupt
11 Special Function
Instructions
In this chapter, we make some samples about pulse output instruction, Modbus communication
instructions and free format communication instructions etc.
Ladder Program:
M0
0 DMOV K100000 D0
DMOV K24000 D2
DMOV K10000 D4
DMOV K8000 D6
FMOV K0 D8 K4
M1
( S )
M1 M0
28 ( R )
M8170 M1
32 ( R )
M1
36 DPLSR D0 D20 Y0 Y2
Explanation:
When PLC changes from STOP to RUN, set ON M0, set the high frequency parameter D0, D2, low
frequency parameter D4, D6, speed up/down time D20, clear D8~D11, set ON M1, set OFF M0.
The motor rotates at high frequency for 3 turns, set ON M8170; then the motor rotates at low
frequency for 1 turn, set OFF M8170, set OFF M1.
frequency
100000
10000
0 High frequency 3
Low frequency 1 turn t
turns
2. MODBUS COMMUNICATION SAMPLES
12-
Operation:
(1) Write content in D10~D14 to D10~D14 of slave station 2;
(2) Read D15~D19 of the slave station 2 to D15~D19 of the mater station; anyhow, write
the first five registers’ content to the slaves, the left five registers are used to store the content
from the
slaves;
(3) Slave station 3 and 4 are similar; Soft
component’s comments:
D0: communication station number
D1: offset
M2: station 2 communication error
M3: station 3 communication error
M4: station 4 communication error
M8137: COM2 communication error end
signal
M8138: COM2 communication correct end signal
Ladder chart
S0: write the target station
S1: read the target station
S2: judge the communication status
S3: offset the communication address
T200: communication interval 1
T201: communication interval 2
D20: plus one for write error times
D21: plus one for read error times
Program Explanation:
When PLC turns from STOP to RUN, M8002 gets a scan cycle. S0 flow open, write the master’s
D10~D14 to slave 2 D10~D14. If the communication is successful, it goes to the next flow; if not,
it will try three times then go to the S1 flow. It delays for a while then read D15~D19 of station 2.
The method is similar to S0 flow. Then go to S2 flow. If the communication is failed, set ON M23.
Then it goes to S3 flow. S3 flow will judge the station no, if the no. is less than 4, the station no.
will plus 1, offset value plus 10; if not, the station no. will start again from 2.
Set the first inverter’s station no. to 1; set the second inverter’s station no. to 2; store the frequency
in D1000 and D2000. Communicate with inverter via serial port.
M8000
SBLOCK write frequency
SBLOCKE
Program Description:
Use BLOCK to make the program. The two Modbus instructions will be executed from up to down.
1、Interface Specifications
DH107/DH108 series instruments use asynchronous serial communication interface, the interface
level fits RS232C or RS485 standard. The data format is: 1 start bit, 8 data bits, no parity, one/two
stop bit. The baud rate can be 1200~ 19200 bits/s.
D17
Program Description:
The above program is written according to DH instrument’s communication protocol, the soft
component’s functions are listed below:
Relationship of received (RCV) data (data returned by the instrument) and the registers:
D20 D21 D22 D23 D24 D25 D26 D27 D28 D29
PV PV SV SV Output Alarm Read/write Read/write CRC CRC
low high low high value status low bytes high bytes low high
bytes bytes bytes bytes bytes bytes
So, if write data string according to the communication objects’ protocol, use SEND and RCV
commands from free format communication, user will get the communication with the objects.
Appendix special soft device list
Here we mainly introduce the functions of special soft device, data register and FlashROM, and introduce the
address of expansion. Users can scan fast.
PC Status (M8000-M8003)
ID Function Description
Clock (M8011-M8014)
ID Function Description
5ms
50ms
0.5s
30s
Flag (M8020-M8029)
ID Function Description
M8023
M8029
PC Mode (M8030-M8038)
ID Function Description
M8034 All output forbidden Set PC’s all external contacts to be OFF status
ID Function Description
M8041
When shifting the mode, all outputs reset functions
M8045 All output reset forbidden are forbidden
Interruption (M8050-M8059)
ID Function Description
M8050
I000□ Forbid the input interruption 0
M8051
I010□ Forbid the input interruption 1 After executing EI instruction, even the
interruption is allowed, but if M acts at this
M8052 time, the correspond input interruption
I020□ Forbid the input interruption 2 couldn’t act separately
M8053 E.g.:when M8050 is ON, interrupt I000□ is
I030□ Forbid the input interruption 3 forbidden
M8054
I040□ Forbid the input interruption 4
M8055
I050□ Forbid the input interruption 5
M8056
I40□□ Forbid the time interruption 0 After executing EI instruction, even the
M8057 interruption is allowed, but if M acts at this
I41□□ Forbid the time interruption 1 time, the correspond time interruption couldn’t
M8058 act separately
I42□□ Forbid the time interruption 2
M8059 Forbid the interruption Forbid all interruption
ID Function Description
M8072 User program error execution codes or configure table parity error
Communication (M8120-M8148)
ID Function Description
M8120
M8121 Waiting to send via RS232
M8122 “sending by RS232” flag
M8123 “RS232 receiving finish” flag
M8124 RS232 receiving flag
COM1 acceptance ends normally, but the accepted
data number is less than the required number
M8125 “Receive incomplete” flag
M8130
M8131 Waiting to send via RS232
M8132 “sending by RS232” flag
M8133 “RS232 receiving finish” flag
M8134 RS232 receiving flag
COM2
acceptance ends normally, but the accepted
data number is less than the required number
M8135 “Receive incomplete” flag
Counter
ID ID Function Description
M8150 C600 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8151 C602 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8152 C604 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8153 C606 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8154 C608 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8155 C610 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8156 C612 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8157 C614 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8158 C616 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8159 C618 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8160 C620 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8161 C622 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8162 C624 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8163 C626 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8164 C628 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8165 C630 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8166 C632 “Count Interruption Finished” Flag Set flag ON when count interruption finish
Appendix special soft device list
M8167 C634 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8168 C636 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8169 C638 “Count Interruption Finished” Flag Set flag ON when count interruption finish
M8173 PULSE_2 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8174 sending” When overflow, Flag is on
M8176 PULSE_3 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8177 sending” When overflow, Flag is on
M8179 PULSE_4 “sending pulse” flag Being ON when sending the pulse,
overflow flag of “32 bits pulse
M8180 sending” When overflow, Flag is on
Positive/negative count
ID Counter Nr. Function Specification
ID Counter ID Specification
M8270 24 segments HSC interruption loop if set it to be 1, then loop
(C600) executing the interruption; or
else execute only one time
interruption;
24 segments HSC interruption loop
M8271 (C602)
24 segments HSC interruption loop
M8272 (C604)
24 segments HSC interruption loop
M8273 (C606)
24 segments HSC interruption loop
M8274 (C608)
24 segments HSC interruption loop
M8275 (C610)
24 segments HSC interruption loop
M8276 (C612)
24 segments HSC interruption loop
M8277 (C614)
…… ……
24 segments HSC interruption loop
M8279 (C618)
M8280 24 segments HSC interruption loop if set it to be 1, then loop
(C620) executing the interruption; or
else execute only one time
interruption;
24 segments HSC interruption loop
M8281 (C622)
…… ……
24 segments HSC interruption loop
M8284 (C628)
M8285 24 segments HSC interruption loop if set it to be 1, then loop
(C630) executing the interruption; or
else execute only one time
interruption;
…… ……
Appendix special soft device list
ID Function Specification
M8340 Read the expansion error flag (read instruction)
M8341 Write the expansion error flag (write instruction)
ID Function Specification
M8630
…… …… ……
…… …… ……
…… …… ……
Clock (D8010-D8019)
ID Function Specification
Flag (D8021-D8029)
ID Function Specification
Model Low byte
D8021
Series number High byte
Compatible system’s version number Low byte
D8022
System’s version number High byte
Compatible model’s version number Low byte
D8023
Model’s version number High byte
D8024
Model’s information Max 5 characters +“\0”
D8025
Appendix special soft device list
D8026
D8027
D8028 Suitable program software version
D8029
Error check(D8067-D8098)
ID Function Specification
D8067 Operation error code’s Nr. The error of divide zero
D8068 lock the Nr. of error code
D8069
D8070 exceeded scan time Unit 1ms
D8074 Nr. of offset registers D
D8097
D8098
Communication (D8120-D8149)
ID Function specification
D8120
D8121
D8122 the left data RS232 should send
D8123 Data number RS232 received
D8126
7: hardware error
8: CRC Parity error
Com 1
9: station number error
D8127 Communication error code 10: no start code
11: no end code
12: communication time out
0: correct
1: don’t support function ID
Modbus communication error
D8128 2: address error (overrun address)
(the replied message from slaves when
the master send errors) 3: Data error (the number of data)
8: saving data error (rewrite Flash)
Appendix special soft device list
D8129
D8130
D8131
0:correct
1: don’t support function ID
Modbus communication error
D8138 2: address error(overrun address)
(the replied message from slaves when
the master send errors) 3: Data error ( the number of data)
8:saving data error ( rewrite Flash)
D8139
D8140
D8141
D8142 the left data RS232 should send
D8143 Data number RS232 received
D8146
7: hardware error
8: CRC check error
9: station number error
Com 3 D8147 Communication error code 10: no start sign
11: no end sign
12: communication time out
0:correct
1: don’t support function ID
Modbus communication error
D8148 2: address error(overrun address)
(the replied message from slaves when
the master send errors) 3: Data error ( the number of data)
8:saving data error ( rewrite Flash)
D8149
Appendix special soft device list
ID Function Description
D8315 Read the expansion’s error type
D8316 Write the expansion’s error type
Appendix special soft device list
ID Function Description
D8630
…… …… ……
…… …… ……
Diff---QD107 Death--
3CH ID103 - ID107 Y103 QD103 QD108
XC-E4DA
XC-E2DA
XC-E6PT-P/ XC-E6TC-P
Current The first 3CH The last 3CH
CH Nr. temp. Set temp. PID run/stop bit PID value PID value
0CH ID100 QD100 Y100
1CH ID101 QD101 Y101
Kp:QD106 Kp:QD110
2CH ID102 QD102 Y102 Ki:QD107 Ki:QD111
3CH ID103 QD103 Y103 Kd:QD108 Kd:QD112
4CH ID104 QD104 Y104 Diff:QD109 Diff:QD113
XC-E6TCA-P
RELATIVE COMMENTS AND DESCRIPTIONS
PARAMETERS
CH Ch0 Ch1 Ch5
Display temperature
module 1 ID100 ID101 ID10× ID105
(unit: 0.1℃)
Appendix special soft device list
PID output
(X input which returns to module 1 X100 X101 X10× X105
main unit)
Thermocouple’s connecting
status
module 1 X110 X111 X11× X115
(0 is connect, 1 is
disconnect)
Auto tune activate signal, enter auto tune stage if being set to be 1; when
auto turn finish, PID parameters and temperature control cycle value are
Auto tune PID control bit refreshed, reset this bit automatically.
Users can also read its status; 1 represents auto tune processing; 0 represents no atto
tune or auto tune finished
PID parameters If the current PID control can’t fulfill the control requirements, users can also write the
PID parameters according to experience. Modules carry on PID control according to
(P、I、D) the set PID parameters.
The set temperature Control system’s target temperature value. The range is 0~1000℃, the precision is
value(unit: 0.1℃) 0.1℃.
Temperature control cycle Control cycle’s range is 0.5s~200s, the minimum precision is 0.1s. the write value is
(unit: 0.1s) the real temperature control cycle multiply 10. i.e. 0.5s control cycle should write 5,
200s control cycle should write 2000.
Appendix special soft device list
If users think the environment temperature is different with the display temperature, he
can write in the known temperature value. At the moment of value written in, calculate
the temperature difference δ and save.
Calculate the temperature difference value δ=adjust environment temperature value-
sample temperature value. Unit: 0.1℃.
Adjust environment E.g.: under heat balance status, user test the environmental temperature as 60.0℃ with
temperature value mercurial thermometer, the display temperature is 55.0℃ (correspond sample
(unit: 0.1℃) temperature is 550), temperature difference δ=0. at this time, users write this
parameters with 600,temperature difference δ is re-calculated to be 50 (5℃), then the
display temperature = (sample temperature+temperature difference δ)/10 =60℃。
**Note: when users write the adjust temperature value, make sure that the temperature
is same with the environment temperature value. This value is very important, once
it’s wrong, temperature difference δ will be wrong, then effect the display temperature
Auto tune output value The output when auto tune, use % as the unit, 100 represents 100% of full scale
XC-E3AD4PT2DA
PID parameters: Kp、Ki、
AD PID output Kd、control range Diff、
CH Nr. PID run/stop bit Set value
signal value death range Death
DA
CH Nr. signal - - -
-
0CH QD100 - - -
Appendix special soft device list
1CH QD101 - - -
XC-E2AD2PT2DA
RELATIVE COMMENTS AND DESCRIPTIONS
PARAMETERS
CH PT0(0.01℃) PT1(0.01℃) AD0 AD1
Auto tune activate signal, enter auto tune stage if being set to be 1;
when auto turn finish, PID parameters and temperature control cycle value are refreshed,
Auto tune PID control reset this bit automatically.
bit
Users can also read its status; 1 represents auto tune processing; 0 represents no atto tune or
auto tune finished
PID parameters If the current PID control can’t fulfill the control requirements, users can also write the PID
parameters according to experience. Modules carry on PID control according to the set PID
(P、I、D) parameters.
PID operation activates between ±Diff range. In real temperature control environments, if
PID operation range
the temperature is lower than , PID output the max value; if the temperature
(Diff)
(unit: 0.1℃) is higher than , PID output the mini value;
Temperature difference (sample temperature+ Temperature difference δ)/10=display temperature value. Then
temperature display value can equal or close to the real temperature value. This parameter
δ
has sign (negative or positive). Unit is 0.1℃, the default value is 0.
(unit: 0.1℃)
Appendix special soft device list
Temperature control Control cycle’s range is 0.5s~200s, the minimum precision is 0.1s. the write value is the
cycle (unit: 0.1s) real temperature control cycle multiply 10. i.e. 0.5s control cycle should write 5, 200s
control cycle should write 2000.
If users think the environment temperature is different with the display temperature, he can
write in the known temperature value. At the moment of value written in, calculate the
temperature difference δ and save.
Calculate the temperature difference value δ=adjust environment temperature value-
sample temperature value. Unit: 0.1℃.
E.g.: under heat balance status, user test the environmental temperature as 60.0℃ with
Real value
mercurial thermometer, the display temperature is 55.0℃ (correspond sample temperature
(unit: 0.1℃)
is 550), temperature difference δ=0. at this time, users write this parameters with 600,
temperature difference δ is re-calculated to be 50 (5℃), then the display temperature =
(sample temperature+temperature difference δ)/10 =60℃。
**Note: when users write the adjust temperature value, make sure that the temperature is
same with the environment temperature value. This value is very important, once it’s wrong,
temperature difference δ will be wrong, then effect the display temperature
The output when auto tune, use % as the unit, 100 represents 100% of full scale output. 80
Auto tune output value represents 80% of full scale output.
FD8011 X01 corresponds with I** 1 Initial values are all decimal
FD8012 X02 corresponds with I** 2
Appendix special soft device list
…… ……
FD8073 X77 corresponds with I** 63
3、 O mapping
ID Function Initial value Description
FD8074 Y00 corresponds with I** 0 Y0 corresponds with the number of
output image O**
FD8075 Y01 corresponds with I** 1 Initial value are all decimal
FD8076 Y02 corresponds with I** 2
…… ……
FD8137 Y77 corresponds with I** 63
4、 I property
ID function Initial value Description
FD8138 X00 property all be 0 0: positive logic; others:
negative logic
retentive area
6、 Communication
ID Function Initial Description
※1:If you change special FLASH memory, it will take into effect after restart the PLC
Appendix 2 Special function version
requirements
Some special functions have version requirements for PLC hardware and software. Please pay
attention to the following table:
Function Hardware Software
version version
※1: Old version of T-BOX, T-BOX-BD: software v3.0f; new version of T-BOX, T-BOX-BD (made after Oct,
2010): software v3.3f and higher.
Appendix 3 Applied instruction
XC series PLC
Instruction Function Chapter
XC1 XC2 XC3 XC5 XCM XCC
Flow
control
Some functions will occupy the same resource of PLC, especially high speed counter, precise timer,
pulse output and PWM and frequency test. Please do not use these functions at the same time.
High speed counter Pulse PWM Frequency
output test
XC2-14/16/24/32/48/60
T618 - - - Y0 Y0 -
T606 C604 C622 C632 - - -
T610 C600 C620 C630 - - -
T614 - - - Y1 Y1 -
T604 C606 - - - - X6
T616 - - - Y0 - -
T608 C602 - - - - X1
T602 C608 - C630(24-segment) - - X7
T612 - - - Y1 - -
XC3-14
T618 - Y0 Y0 -
T614 C600 C620 C630 - - -
T604 C606 - - - - -
T610 - - - Y1 Y1 -
T612 C602 - - - - X2
T616 - - - Y0 - -
T606 C604 - - - - X3
T608 - - - Y1 - -
XC3-24/32/42, XC5-48/60
T606 - - - Y1 Y1 -
T618 - - - Y0 Y0 -
T610 C604 C622 C632 - - -
T614 C600 C620 C630 - - -
T604 C606 C624 C634 - - -
T608 - - - Y1 - -
T616 - - - Y0 - -
T612 C602 - - - - X1
T602 C608 - C630(24-segment) - - X11
T600 - - - - - X12
XC3-48/60
- - - - - - -
T618 - - - Y0 Y0 -
T614 C600 C620 C630 - - -
T604 C602 C622 C632 - - -
T610 - - - Y1 Y1 -
T612 C604 - - - - X4
T616 - - - Y0 - -
T606 C606 - - - - X5
T600 - - C630(24-segment) - - -
T608 - - - Y1 - -
XC3-19AR-E
T602 - - - - - -
T618 - - - Y0 Y0 -
T614 C600 C620 C630 - - -
T604 C602 C622 C632 - - -
T610 - - - - - -
T612 C604 - - - - X4
T616 - - - Y0 - -
T606 C606 - - - - X5
T600 - - C630(24-segment) - - -
T608 - - - - - -
XC5-24/32、XCM-24/32
T614 - - - Y1 Y1 -
T618 - - - Y0 Y0 -
T610 - - - Y2 Y2 -
T606 C600 C620 C630 - - -
T602 - - - Y3 Y3 -
T612 - - - Y1 - -
T616 - - - Y0 - -
T608 - - - Y2 - -
T604 C602 - C630(24-segment) - - X3
T600 - - - Y3 - -
XCM-60
T614 - - - Y1 Y1 -
T618 - - - Y0 Y0 -
T610 - - - Y2 Y2 -
T606 C600 C620 (24- C630 (24- - X1
segment) segment)
T602 - - - Y3 Y3 -
T612 - - - Y0 - -
T616 - - - Y1 -
T608 - - - Y2 - -
T604 C602 C630 - - -
(24-segment)
T600 Y3 - -
C604 - C632 (24- - -
segment)
C606 - C634 (24- - -
segment)
XCC-24/32
T616 - - - Y4 Y4 -
T618 - - - Y0 Y0 -
T614 - - - Y1 Y1 -
T612 - - - Y2 Y2 -
T610 - - - Y3 Y3 -
T606 - - - Y4 - -
T608 - - - Y0 -
T604 - - - Y1 - -
T602 - - - Y2 - -
T600 - - - Y3 - -
C600 - C630 - -
C602 C632
C604 C634
C606 C636
C608 C638
※1: Any two resources in the same row cannot be used at the same time.
※2: For some models, pulse output terminal Y1 cannot be used together with extension BD board.
Que esse conteúdo tenha agregado valor e conhecimento pra você!
NOSSAS FILIAIS