XDXDM Instruction Manual
XDXDM Instruction Manual
Responsibility declaration
The manual content has been checked carefully, however, mistakes may happen.
We often check the manual and will correct the problems in subsequent version. Welcome to
offer advices to us.
Excuse us that we will not inform you if manual is changed.
Contact information
If you have any problem about products, please contact the agent or Xinje company.
Tel: 0086 510-85134136 85123803
Fax: 0086 510-85111290
Address: Building 7 fourth floor, No.100, Dicui Rd, Wuxi, China.
Code : 214072
1-1.PLC Features
Programming Language
XD3/XDM series PLC support two kinds of program language, instruction and ladder chart,
the two kinds of language can convert to each 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 protect the
user copyright; meanwhile, it limits the downloading, to avoid change program by mistake.
XD3/XDM series added new register FS. (For different XD3/XDM models, please check the
Data monitor in XDPpro software for FS register range, common range is FS0~FS47). FS
value can be modified but cannot be read through Modbus instruction. FS cannot be
compared to register but only constant in XDPpro software. The value cannot be read. FS is
used to protect the user’s copyright. The register D, HD… can replace by FS.
Program comments
When the user program is too long, the comments of program and soft components are
necessary in order to change the program easily later.
Offset Function
Add offset appendix (like X3[D100], M10[D100], D0[D100]) after coils, data registers can
make indirect addressing. For example, when D100=9, X3[D100] =X[3+9]=X14;
M10[D100]=M19, D0[D100]=D9
XD3/XDM series PLC support “Stop PLC when reboot” function. When there is a serious
problem during PLC running, this method can stop all output immediately. Besides, if the
COM port parameters are changed by mistake, this function can help PLC connect to the PC.
Communication Function
XD3/XDM series PLC has many communication modes, such as Modbus-RTU, Modbus-
ASCII.
When the COM port parameters are changed, the new parameters will be valid immediately
without restarting the PLC.
Wait time can be added before Modbus instructions.
1-2.Programming Language
1-2-1.Type
XD3/XDM series PLC support two types of programming language:
Instruction
Make the program with instructions directly, such as “LD”, “AND”, “OUT” etc. This is the
basic input form of the programs, but it’s hard to read and understand;
E.g.: step instruction operand
0 LD X000
1 OR Y005
2 ANI X002
3 OUT Y005
Make sequential control graph with sequential control signal and soft components. This
method is called “Ladder chart”. This method uses coils and contactors to represent sequential
circuit. The ladder chart is easy to understand and can be used to monitor the PLC status
online.
E.g.:
X0 X2
Y5
Y5
1-2-2.Alternation
The two kinds of programming language can be transformed to each other.
Instructio Ladder
1-3.Programming mode
Direct Input
The two kinds of programming language can be input directly in the editing window. The
ladder chart window has hint function which improves the programming efficiency greatly.
Instruction Configuration
Some instruction is complicated to use, like pulse output, PID etc. XDPPro software has the
configuration window for these special instructions. User just needs to input parameters in the
configuration window without remembering complicated instructions. The following window
is multi section pulse output.
For the details of instruction configuration, please refer to XD3/XDM series PLC user manual
【software part】.
2 Soft Component Function
In chapter 1, we briefly introduce the programming language. However, the most important
element in a program is the operands. These elements include the relays and registers. In this
chapter, we will describe the functions and using methods of these relays and registers.
2-1.Summary of the Soft Components
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. Next we will introduce these soft components.
Using notes
There are enough output relays in the PLC. The output relay whose address is more than
output points can be seemed to auxiliary relay.
Data Register D, HD
M2
MOV K5 D0
SM0
MOV D10[D0] D100
Y0[D0]
Timer T, HT/Counter C, HC
For common usage, 16 bits, represent the current value of timer/counter;
For common usage, 32 bits, (combine two continuous 16 bits registers)
To represent them, just use the letter+address method, such as T10, C11, HT10, HC11.
E.g.
X0
TMR T11 K99 K100
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
M1
MOV K3 D0
SM0
MOV DX2[D0] D10
When M0 changes from OFF to ON, the value in the word which is combined by Y0~Y17
equals to 21, i.e. Y0, Y2, Y4 become ON.
Before M1 activates, if D0=0, DX2[D0] represents a word combined by X2~X21.
If M1 changes from OFF to ON, D0=3, then DX2[D0] represents a word combined by
X5~X24
2-2-2.Structure of Bit Soft Components
Bit soft components include X, Y, M, S, T, C, HM, HS, HT, HC. Besides, the bit of the
register also can be used as bit sofst component.
Relay
D5[D1].4
Y1
The soft components range of XDM main unit and extension module:
Range Points
Name
24 32 60 24 32 60
X Input X0~X15 X0~X21 X0~X43 14 18 36
Y Output Y0~Y11 Y0~Y15 Y0~Y27 10 14 24
X10000~10077(#1 expansion module)
X Input ※3 …… 1024
X11700~11777(#16 expansion module)
Y10000~10077(#1 expansion module)
Y Output ※3 …… 1024
Y11700~11777(#16 expansion module)
X Input ※4 X20000~20077(#1 expansion BD) 64
Y Output ※4 Y20000~20077(#1 expansion BD) 64
M M0~M20479 20480
HM Internal register HM0~HM6143※1 6144
※
SM Special register SM0~SM4095 2 4096
S S0~S7999 8000
Flow
HS HS0~HS999※1 1000
T T0~T4095 4096
※
HT Timer HT0~HT1023 1 1024
ET Precise timing ET0~ET39 40
C C0~C4095 4096
HC Counter HC0~HC1023※1 1024
HSC High speed counter HSC0~HSC39 40
D D0~D20479 20480
HD HD0~HD24999※1 25000
SD Data register Special register SD0~SD4095 4096
HSD Special register HSD0~HSD1023※2 1024
FD FlashROM FD0~FD8191 8192
※
SFD register Special register SFD0~SFD4095 2 4096
Special secure
FS FS0~FS255 256
register
Main unit ID0~99 100
ID10000~10099(#1 expansion module)
ID※5 Expansion module …… 1600
ID11500~11599(#16 expansion module)
Expansion BD ID20000~20099(#1 expansion BD) 100
Main unit QD0~99 100
QD10000~10099(#1 expansion module)
QD※
6 Expansion module …… 1600
QD11500~11599(#16 expansion module)
Expansion BD QD20000~20099(#1 expansion BD) 100
Sequence function
block instruction
SEM SEM0~SEM127 128
WAIT special coil
Number List
XD3/XDM series PLC input/output are all in octal form, each series numbers are listed
below:
Range Points
PLC Name
16 24 32 48 60 16 24 32 48 60
X X0~X7 X0~X15 X0~X21 X0~X33 X0~X43 8 14 18 28 36
XD3
Y Y0~Y7 Y0~Y11 Y0~Y15 Y0~Y23 Y0~Y27 8 10 14 20 24
Range Points
PLC Name
24 32 60 24 32 60
X X0~X15 X0~X21 X0~X43 14 18 36
XDM
Y Y0~Y11 Y0~Y15 Y0~Y27 10 14 24
Function
CPU unit
Input Relay X
PLC input terminals are used to recive the external signal. the input relays are optocoupler to
connect PLC and input terminals
The input relays which are not connected with external devices can be seemed to fast internal
relays
Output Relay Y
PLC 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 which are not connected with external devices can be seemed to fast
internal relays
Execution Order
XD3 series
Output Terminal Y
Input Image Area
Input Terminal X
PLC
CPU unit
Program
process Area
Input processing
Before PLC executing the program, read every input terminal’s ON/OFF status to the image
area.
When the program is running, even the input changed, the content in the input image area will
not change until the next scanning period coming.
Output processing
After running 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.
The output contactors will delay the action according to the output soft components reponse.
Number List
The auxiliary relays in XD3/XDM series PLC are all in decimal form, please see the
following table:
Range
PLC Name
Normal Power-off retentive Special
XD3 M000~M7999 HM0-HM959 SM0~SM2047
M
XDM M000~M20479 HM0-HM6143 SM0~SM4095
In PLC, auxiliary relays are used frequently. This type of relay’s coil is same to the output
relay. They are driven by soft components in PLC;
Auxiliary relays M and HM 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 shut down during the running, the relays will be off.
Common usage relays can’t be used for power off retentive, but the zone can be modified;
Address List
Status relays addresses are in form of decimal, the address are shown below:
Range
PLC Name
Normal Power-off retentive
XD3 S000~S1023 HS0~HS127
S
XDM S000~S7999 HS0~HS999
Function
Status relays S and HS are very import in ladder program; they are used together with
instruction “STL” in the flow. The flow can make the program clear and easy to modify.
For common use
After shut off the PLC power, S relays will be OFF
For Power Off Retentive Use
HS relays can keep the ON/OFF status even PLC power is off
The status relays also have countless “normally ON/OFF” contactors. So users can use them
freely in the program
2-7.Timer (T, HT)
Address List
The timer addresses are in the form of decimal; please see the following table:
Range
Series Name
Normal Power-off retentive Precise timing
XD3 T T0~T575 HT0~HT95 ET0~ET31
HT
XDM ET T0~T4095 HT0~HT1023 ET0~ET39
Function
The timers accumulate the 1ms, 10ms, 100ms pulse, the output contactor activates when the
accumulation reaches the set value;
TMR instruction is for common timers. The set value can be constant (K) or data register
(D).
Normal type
X0
TMR T0 K200 K10
If X0 is ON, then T0
T0 Y0 accumulates 10ms pulse based
( )
on the current value; when the
accumulation value reaches the
2s
set value K200, the timer
X0 output activates. I.e. the output
Set
activates 2s later. If X0 is OFF,
Current value the timer resets, the output
value
resets;
Y0
Accumulation type
1. Instruction format
S1 S2 S3
TMR T0 K200 K10 (Not accumulation)
S1 S2 S3
TMR_A T0 K2000 K10 (Accumulation)
Notes
The TMR is not accumulation timer instruction; TMR_A is accumulation timer instruction.
The time unit includes K1, K10 and K100. Please don’t write other time unit otherwise the
timer instruction will not run.
Time value
The time value is stored in register TD. The working mode of timer T0~T575 and HT0~HT95
are 16-bits linear increasing. The time range is from 0 to 32767. When the time value in TD
reaches 32767, the timer will stop timing and keep the status.
X0
MOV T0 D0
X0
MOV TD0 D0
The two instructions are the same. In the first instruction, T0 is seemed to TD0.
Application
Output delay
X0 T2 Y0
X0
Y0 X0
TMR T2 K200 K10 Y0 T2
X0 is ON, output Y0. X0 changes from ON to OFF, delay 2s then cut off Y0.
Twinkle
X0 T2
TMR T1 K20 K10
X0
T1
TMR T2 K10 K10 T1 T2 T1
Y0
Y0
2-8.Counter ( C, HC )
Number list
The counter addresses are in decimal; please see the following table for details:
Series Name Range
Normal Power-off retentive High speed counter
XD3 C C0~C575 HC0~HC95 HSC0~HSC31
HC
XDM HSC C0~C4095 HC0~HC1023 HSC0~HSC39
Function
The soft component will appoint the type of counter: common counter or power-off retentive
counter.
The set value range of 16-bit count-up counter is K1~K32,767 (decimal). K0 and K1 have
the same function. They mean the counter output will act at the first counting.
If the PLC power supply is cut off, common counter value will be reset. The power-off
retentive counter value will be kept.
X10
RST C0
X11
CNT C0 K10
C0 Y0
( )
The counter C0 increases one when the X11 drives once. When C0 value reaches 10, the
output acts. Then X11 drives again, C0 will continue increase one.
If X10 is ON, the C0 and output will be reset.
The counter set value can be constant K or register. For example, if D10 is 123, the set value
is equal to K123.
The set value contains two conditions: 16-bit and 32-bit. The counter types include common
counter (C) and power-off retentive counter (HC).
Count instruction:
16-bit counter:
S1 S2
CNT C0 K200 Count up
S1 S2
CNT_D C1 K-100 Count down
32-bit counter:
S1 S2
DCNT C0 K41000 Count up
S1 S2
DCNT_D C2 K-41100 Count down
Reset instruction:
16-bit counter:
S1
RST C0
32-bit counter:
S1
DRST C0
Count value
The count range is -32768~0. When the count value reaches -32768, the counter stops
working and keeps the state.
The two instructions have the same function. C0 is seemed to register in the first instruction.
X0
CNT C0
K1000
The highest frequency of this instruction is related to the filter parameter and PLC scanning
period. The max frequency it can count will be 500Hz. If the frequency is larger than 500Hz,
please use high speed counter HSC0-HSC30.
SM0
CNT HSC0 K888888
High speed counter HSC0: the frequency input terminal is X0. The high speed counter will
not be affected by input filter response delay time and PLC scanning period. Please refer to
chapter 5 for details.
Address list
The data register of XD3/XDM series PLC is in decimal format. Please see the following
table:
Series Name Range
Normal Power-off retentive Special Special power-off
retentive
XD3 D0~D7999 HD0~HD999 SD0~SD2047 HSD0~HSD499
D
XDM D0~D20479 HD0~HD6143 SD0~SD4095 HSD0~HSD1023
Structure
Data register is used to store data; it includes 16 bits(the higheset bit is sign bit) and 32 bits.
(32 bits contains two registers, the highest bit is sign bit)
16 bits
0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0
b15 b0
Sign bit
0: positive 1: negative
32 bits
D1 16 bits D0 16
High bits Low
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
b31 b0
Sign bit
0: positive 1: negative
Function
Normal type
When write a new value in the register, the former value will be covered.
When PLC changes from RUN to STOP or STOP to RUN, the value in the register will be
cleared.
Retentive type
When PLC changes from RUN to STOP or power off, the value in the register will be
retained.
The retentive register range cannot be changed.
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.
SM2
MOV K0 D0
M2
MOV K5 D0
SM0
MOV D10[D0] D100
Y0[D0]
( )
Example
Data transfer
M0
MOV D0 D10 When M0 is ON, transfer the value of D10 to D0
M0
MOV C10 D0 When M0 is ON, move the value of C10 to D0.
X2
X3
X4
X5
X6
X7
X10
X11
X12
X13
X14
X15
X16
X17
DX0 K0 Y0
( )
2-9-2.Offset application
Application 1:
When M0 is ON, the output from Y1 to Y7 will be ON one by one. D0 is offset address. If
there are many output points, M can replace Y.
SM2
MOV K7 D4000
M0 SM13 Y0[D0]
( R )
INC D0
D0 D4000
> MOV K1 D0
Y0[D0]
( S )
Application 2:
When M0 is ON, read the ID10000 value every second and store in the register starting from
D4000 (amounts is 50 registers). D0 is offset address.
M0 SM13
MOV ID10000 D4000[D0]
INC D0
D0 K50
MOV K1 D0
2-10.Constant
Data process
PLC program should use K, H to process values. K means decimal numbers, H means hex
numbers. Please note the PLC input/output relay use octal address.
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. HA means decimal number 10. It is used to set operand
value of applied instruction.
Constant B
B is used to display binary numbers. B10 means decimal number 2. It is used to set operand
value of applied instruction.
2-11.Programming principle
Sign P and I
P is the program sign for condition and subprogram jump.
I is the program sign for interruption (external interruption, timer interruption, high speed
counter interruption, precise time interruption…).
P and I addresses are in decimal. Please refer to the following table:
Series Sign Address
XD3, XDM P P0~P9999
Address
Model Sign External interruption
Rising Falling Timer interruption
Input
interruption interruption
X2 I0000 I0001
X3 I0100 I0101 There are 20 timer interruptions.
X4 I0200 I0201 From I40** to I59**. “**” means
XD3-16 I
X5 I0300 I0301 the timeof timer interruption, the
X6 I0400 I0401 unit is ms.
X7 I0500 I0501
Address
Model Sign External interruption
Rising Falling Timer interruption
Input
interruption interruption
I X2 I0000 I0001
X3 I0100 I0101
X4 I0200 I0201
X5 I0300 I0301
X6 I0400 I0401 There are 20 timer interruptions.
XD3-
From I40** to I59**. “**” means
24/32/48/ X7 I0500 I0501
the timeof timer interruption, the
60 X10 I0600 I0601 unit is ms.
X11 I0700 I0701
X12 I0800 I0801
X13 I0900 I0901
Range
Model Name External interruption
Rising Falling Timing interruption
Input
interruption interruption
X2 I0000 I0001
X3 I0100 I0101
X4 I0200 I0201
X5 I0300 I0301 There are 20 timer interruptions.
XDM-
X6 I0400 I0401 From I40** to I59**. “**” means
24/32/60T4/ I
X7 I0500 I0501 the time of timer interruption, the
60T10
X10 I0600 I0601 unit is ms.
X11 I0700 I0701
X12 I0800 I0801
X13 I0900 I0901
Sign P
P is usually used in flow; it is used together with CJ (condition jump), CALL (call
subprogram), etc.
Condition Jump CJ
M8002
DMOV K1000 D0
1000
If coil X0 is ON, jump to the program
after P1;
DMOV K20000 D2
If the coil X0 is not ON, do not execute
20000
M0 jump action, but run the original
DPLSY D0 D2 Y0 program;
1000 20000 OFF
M8170
RST M0
program
If X0 is ON, jump to the
Main
subprogram
If the coil is not ON, run the
FEND original program;
P10
After executing the subprogram,
return to the main program;
Subprogram
SRET
The subprogram will start from Pn and finish with SRET. CALL Pn is used to call the
subprogram. n is a integer in the range of 0 to 9999.
Sign I
Tag I is usually used in interruption, including external interruption, time interruption etc. It
often works together 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 time. Use this
interruption in the control which is different from PLC’s operation cycle;
Output
Once all the instructions end, transfers the ON/OFF status of output Y image area to the
output lock memory area. This will be the actual output of the PLC. The output contactors
will act according to the device’s response delay time.
When use batch input/output mode, the drive time and operation cycle of input filter and
output device will also show response delay.
Not accept narrow input pulse signal
PLC’s input ON/OFF time should be longer than its loop time. If consider input filter’s
response delay 10ms, loop time is 10ms,then ON/OFF time needs 20 ms separately. So, up
to 1, 000/(20+20)=25Hz input pulse can’t be processed. But, this condition could be improved
when use PLC’s special function and applied instructions (such as high speed count, input
interruption, input filter adjustment).
When executing dual output (use dual coil), the after one is act in priority.
3 Basic Program Instructions
This chapter introduces the basic instructions and their functions.
Statement
Connect the LD and LDI instructions directly to the left bus bar. It can work with ANB and
be used at the branch start.
OUT instruction can drive the output relays, auxiliary relays, status, timers, and counters. But
this instruction can’t be used for the input relays
For coil T and C, please set constant K or register D when using OUT.
The following table shows the constant K setting range, actual timer constant, program step
relative to OUT instruction (include the setting value).
X0
Y100 LD X0
X1 OUT Y100
M1203 LDI X1
TMR T0 K10 K100 OUT M1203
( )
TMR T0 K10 K100
T0 LD T0
Y1
OUT Y1
Operand: X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
ANI Normal close M0
(and contactor in series
reverse)
Operand: X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
Statements
Use AND and ANI to connect the contactors in series. There is no limit for contactors in
series. They can be used for many times.
Use OUT instruction through other coil is called “follow-on” output (For an example see the
program below: OUT M2 and OUT Y3). Follow-on output can repeat as long as the output
order is correct. There’s no limit for the serial connected contactors and follow-on output
times.
Program
X2 M1
Y2
LD X2
Y2 X3
M2
AND M1
T1 OUT Y2
Y3
LD Y2
ANI X3
OUT M2
AND T1
OUT Y3
Statements
Use the OR and ORI instructions for parallel connection of contactors. To connect a block
that contains more than one contactor connected in series to another circuit block in parallel,
use ORB instruction, which will be described later;
OR and ORI start from the instruction step, parallel connect with the LD and LDI instruction
step introduced before. There is no limit for the parallel connect times.
Program
LD X5
OR X6
OR M11
OUT Y6
LDI Y6
AND M4
OR M12
ANI X7
OR M13
OUT M100
Relationship with ANB
LD ANB LD
The parallel connection with OR, ORI
instructions should connect with LD,
OR LDI instructions in principle. But behind
After ANB the ANB instruction, it’s still ok to add a
OR LD or LDI instruction.
After ANB
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
LDF Initial logical operation M0
(LoaD Falling/trailing edge pulse
Falling
pulse)
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
ANDP Serial connection of Rising edge M0
(AND Pulse) pulse
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
ANDF Serial connection of M0
(AND Falling/trailing edge pulse
Falling
pulse)
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
ORP Parallel connection of Rising
(OR Pulse) edge pulse M0
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
ORF Parallel connection of
(OR Falling Falling/trailing edge pulse M0
pulse)
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
Statements
LDP, ANDP, ORP will be ON for one scanning period when the signal rising pulse is coming
(OFFON)
LDF, ANDF, ORF will be ON for one scanning period when the signal falling pulse is
coming (ONOFF)
Program
X5
M13 LDP X5
X6 ORP X6
SM0 X7 OUT M13
M15 LD M8000
ANDP X7
OUT M15
Devices: X
LDDI Read the normally X0
D
closed contact directly
Devices: X
ANDD Read the status from X0
D
the contact directly
Devices: X
ANDDI Read the normally X0
D
closed contact directly
Devices: X
ORD Read the status from
X0
the contact directly
D
Devices: X
ORDI Read the normally
X0
closed contact directly
D
Devices: X
OUTD Output to the contact Y0
D
directly
Statement
Devices: Y
s
The function of LDD, ANDD, ORD instructions are similar to LD, AND, OR; LDDI,
ANDDI, ORDI instructions are similar to LDI, ANDI, ORI; but if the operand is X, the LDD,
ANDD, ORD commands read the signal from the terminals directly.
OUTD and OUT are output instructions. OUTD will output immediately when the condition
is satisfied, needn't wait for the next scan cycle.
Program
LDD X0
LDDI X2
ORD X2
ANB
OUTD Y0
3-7. [ORB]
Statements
Two or more contactors is called "serial block". If parallel connect the serial block, use LD,
LDI at the branch start point, use ORB at the branch end point;
As the ANB instruction, an ORB instruction is an independent instruction which is not
associated with any soft component.
There are no limits for parallel circuits’ quantity when using ORB for every circuit.
Program
Recommended good programming method:
Non-preferred programming method:
LD X0
LD X0
AND X1 AND X1
LD X2 LD X2
AND X3
AND X3
ORB
LD X4
LD X4 AND X5
AND X5 ORB
ORB
ORB
OUT Y10
OUT Y10
3-8. [ANB]
Statements
Use ANB to serial connects two parallel circuits. Use LD, LDI at the brach start point; use
ANB at the branch end point.
There are no limits for ANB instruction using times.
Program
LD X0
OR X1
LD X2
AND X3
LDI X4
AND X5
ORB
OR X6
ANB
OR X7
OUT Y20
Statements
After the execution of an MCS instruction, the bus line (LD, LDI) moves to a point after the
MCS instruction. An MCR instruction resets this to the original bus line.
MCS, MCR instructions should use in pair.
The bus line can be nesting. Use MCS, MCR instructions between MCS, MCR instructions.
The nesting level increase with the using of MCS instruction. The max nesting level is ten.
When executing MCR instruction, go back to the last level of bus line.
When use flow program, bus line management could only be used in the same flow. When the
flow ends, it must go back to the main bus line.
Program
LD X1
MCS
LD X2
OUT Y0
LD M1
MCS
LD M3
OUT Y1
LD M2
OUT Y2
MCR
MCR
3-10. [ALT]
Coil:
X,Y,M,HM,SM,S,HS,T,HT,C,HC,Dn.m
Statements
The status of the coil is reversed after using ALT (ON to OFF, OFF to ON).
Program
Statements
For using PLS instruction: soft component Y and M will act during the scanning period after
the drive is ON.
For using PLF instruction: soft component Y and M will act during the scanning period after
the drive is OFF.
Program
X0
PLS M0 LD X0
M0 PLS M0
SET Y0 LD M0
SET Y0
----------------------
X1
PLF M1 LD X1
PLF M1
M1 LD M1
RST Y0
RST Y0
3-12. [SET], [RST]
Statements
In the following program, Y0 will keep ON even X10 turns OFF after turning ON. Y0 will
not ON even X11 turns OFF after turning ON. This is the same to S and M.
SET and RST can be used for many times for the same soft component. Any order is allowed,
but the last one is effective.
RST can be used to reset the counter, timer and contactor.
When using SET or RST, it cannot use the same soft component with OUT.
Program
X1 Y0 LD X10
(S)
0 SET Y0
X1 Y0 LD X11
1 (R) RST Y0
LD X12
X1 M50 SET M50
(S)
2 LD X13
X1 M50 RST M50
( R) LD X14
3
S0 SET S0
X1
( S) LD X15
4 RST S0
X1 S0 LD X16
(R) TMR T250 K10 K10
5
X1 LD X17
6 TMR T250 K10 K10 RST T250
X1 T250
7 ( R)
X10
X11
Y0
3-13.【CNT】【CNT_D】【DCNT】【DCNT_D】【RST】for the
counters
Power-off retentive counter will keep the current value and counter coil status when the
power is off.
operand: K, D
TMR Non power-off retentive 10ms
output timer, the drive of coil TMR T0 K10 K10
operand: K, D
TMR Non power-off retentive 1ms
TMR T0 K10 K1
output timer, the drive of coil
operand: K, D
TMR_A Power-off retentive 100ms timer,
output the drive of coil
operand: K, D
operand: K, D
TMR_A Power-off retentive 1ms timer,
TMR_A HT0 K10 K1
output the drive of coil
operand: C, HC, HSC
M0
When M0 is ON, T0 starts to
TMR T0 K10 K10
timing. When T0 reaches K10,
T0
T0 coil is ON. Then T0
Y0
continues timing. When M1 is
M1
RST T0 ON, reset the T0.
Power-off retentive timer will keep the current value and counter coil status when the power
is off.
3-15. [END]
Statements
PLC repeatedly carries 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 repeats 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.)
Devices: None
GROUPE GROUP END GROUPE
Devices: None
Statements
X3 X4
X3 X4
Y0
X0 X2
M0
X3 X4
M1
M0
Y0
M1
Program Flow
CJ Condition jump CJ Pn 4-3-1
Data Compare
LD= LD activates if (S1) = LD= S1 S2 4-4-1
(S2)
LD> LD activates if (S1) > LD> S1 S2 4-4-1
(S2)
LD< LD activates if (S1) =< LD< S1 S2 4-4-1
(S2)
LD<> LD activates if (S1) LD<> S1 S2 4-4-1
≠(S2)
LD<= LD activates if (S1) ≤ LD<= S1 S2 4-4-1
(S2)
LD>= LD activates if (S1) ≥ LD>= S1 S2 4-4-1
(S2)
AND= AND activates if (S1)= AND= S1 S2 4-4-2
(S2)
AND> AND activates if (S1)> AND> S1 S2 4-4-2
(S2)
AND< AND activates if (S1)< AND< S1 S2 4-4-2
(S2)
AND<> AND activates if (S1) ≠ AND<> S1 S2 4-4-2
(S2)
AND<= AND activates if (S1) ≤ AND<= S1 S2 4-4-2
(S2)
AND>= AND activates if (S1) ≥ AND= S1 S2 4-4-2
(S2)
OR= OR activates if (S1)= OR= S1 S2 4-4-3
(S2)
OR> OR activates if (S1)> OR> S1 S2 4-4-3
(S2)
OR< OR activates if (S1)< OR< S1 S2 4-4-3
(S2)
OR<> OR activates if (S1) ≠ OR<> S1 S2 4-4-3
(S2)
OR<= OR activates if (S1) ≤ OR<= S1 S2 4-4-3
(S2)
OR>= OR activates if (S1) ≥ OR>= S1 S2 4-4-3
(S2)
Data Move
CMP Compare the data CMP S1 S D 4-5-1
Compare the data in S1 S2 S D
ZCP ZCP 4-5-2
certain area
MOV Move MOV S D 4-5-3
Decrement
DEC DEC D 4-6-5
Coding
DECO DECO S D n 4-8-8
High bit coding
ENCO ENCO S D n 4-8-9
Low bit coding
ENCOL ENCOL S D n 4-8-10
Binary to Gray code
GRY GRY S D 4-8-11
Gray code to binary
GBIN GBIN S D 4-8-12
Float Point Operation
ECMP Float compare ECMP S1 S2 D 4-9-1
EZCP Float Zone compare EZCP S1 S2 D1 D2 4-9-2
Float Add
EADD EADD S1 S2 D 4-9-3
Float Subtract
ESUB ESUB S1 S2 D 4-9-4
Float Multiplication
EMUL EMUL S1 S2 D 4-9-5
Float division
EDIV EDIV S1 S2 D 4-9-6
Float Square Root
ESQR ESQR S D 4-9-7
Sine
SIN SIN S D 4-9-8
Cosine
COS COS S D 4-9-9
Tangent
TAN TAN S D 4-9-10
Float Sine
ASIN ASIN S D 4-9-11
Float Cosine
ACOS ACOS S D 4-9-12
Float Tangent
ATAN ATAN S D 4-9-13
Clock Operation
Read RTC data
TRD TRD D 4-10-1
Write RTC data
TWR TWR D 4-10-2
In this manual, the applied instructions are described in the following manner.
Summary
ADDITION [ADD]
16 bits ADD 32 bits DADD
Execution Normally ON/OFF, Suitable XD3, XDM
condition Rising/Falling edge Models
Hardware - Software -
requirement requirement
Operands
Operands Function Data Type
S1 Specify the data or register address 16 bits/32 bits, BIN
S2 Specify the data or register address 16 bits/32 bits, BIN
D Specify the register to store the sum result 16 bits/32 bits, BIN
*Note: D includes D, HD. TD includes TD, HTD. CD includes CD, HCD, HSCD, HSD. DM
includes DM, DHM. DS includes DS, DHS. M includes M, HM, SM. S includes S and HS. T
includes T and HT. C includes C and HC.
Description
Two source data make binary addition and the result data store in object address.
The highest bit of each data is positive (0) and negative (1) sign bit. These data will make
addition operation through algebra. Such as 5 + (-8) = -3.
If the result of a calculations is “0”, the “0’ flag acts. If the result exceeds 323,767(16 bits
operation) or 2,147,483,648 (32 bits operation), the carry flag acts. (refer to the next page). If
the result exceeds -323,768 (16 bits operation) or -2,147,483,648 (32 bits operation), the
borrow flag acts (Refer to the next page).
When carry on 32 bits operation, low 16 bits of 32-bit register are assigned, the register
address close to the low 16 bits register will be assigned to high 16 bits of 32-bit register.
Even number is recommended for the low 16 bits register address.
The source and object can be same register address.
In the above example, when X0 is ON, the addition operation will be excuted in each
scanning period.
Related flag
Notes
The assignment of the data
The data register of XD3 series PLC is a single word (16 bit) data register, single word data
only occupy one register which is used to single word instruction. The process range is
decimal –327,68~327,67, or hex 0000~FFFF.
Single word object instruction D(NUM)
Instruction D(NUM) → Object
Double words (32 bit) occupy two data registers; the two registers’ address is continuous. The
process range is: decimal -214,748,364,8~214,748,364,7 or hex 00000000~FFFFFFFF.
Operands
Operands Function Data Type
Pn Jump to the target (with pointer Nr.) P (P0~P9999) Pointer's Nr.
Other Pointer
P I
●
Description
In the below graph, if X0 is ON, jump from the first step to the next step behind P6 tag. If X0
is OFF, do not execute the jump instruction;
X0
CJ P6 In the left graph, Y0 becomes to be dual
X1 Y0 coil output, but when X0=OFF, X1
( )
X2 T246 activates; when X0=ON, X5 activates
(R) CJ can’t jump from one STL to another
X3
TMR T246 K1000 K10 STL;
X4 After driving timer T0~T575,
MOV K3 D0
P6 HT0~HT795 and HSC0~HSC30, if
X0 executes CJ, continue working, the
CJ P7
X5 Y0 output activates.
( ) The Tag must be match when using CJ
P7 instruction.
X6 T246
( R)
Operands
Operands Function Data Type
Pn Jump to the target (with pointer No.) P Pointer's No.
(P0~P9999)
Others Pointer
P I
●
Description
X0
CALL P10
Main Program
FEND
P10
Subroutine
SRET
END
If X0= ON, execute the call instruction and jump to P10. After executing the subroutine,
return the original step via SRET instruction.
Program the tag with FEND instruction (will describe this instruction later)
In the subroutine 9 times call is allowed, so totally there can be 10 nestings.
When calling the subprogram, all the timer, OUT, PLS, PLF of the main program will keep
the status.
All the OUT, PLS, PLF, timer of subprogram will keep the status when subprogram
returning.
Main program
FEND
P10
Subprogram
SRET
END
operands
Operands Function Data Type
Sn Jump to the target flow S Flow No.
Bit System
Operand
X Y M* S* T* C* Dn.m
Sn ●
*Note: M includes M, HM and SM; S includes S, HS; T includes T and HT; C includes C and
HC.
Description
STL and STLE should be used in pairs. STL represents the start of a flow; STLE represents
the end of a flow.
Every flow is independent. They cannot be nesting. There is no need to write the flow as the
order S0, S1, S2… you can make the order. For example, executing S10, then S5, S0.
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 close the current flow S0, open flow S1.
In flow S0, ST S2 open 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. in the
flow.
ST instruction is usually used when a program needs to run many flows at the same time.
After executing SET Sxxx instruction and jump to the next flow, the pulse instructions in the
former flow will be closed. (including one-segment, multi-segment, relative or absolute,
return to the origin)
After executing SET S1, close S0,
open S1.
Example
S0 start
S30 start
The program explanation:
When SM2 is ON, set ON flow S0. When
M0 is ON, set ON flow S10 and S20.
M0 S0
( S )
S0
ZRST S0 S1
STL S0
S0 M1
( S )
SM000
TMR T0 K50 K100
STLE
STL S1
S1
TMR T1 K200 K100
T1 S1
( R)
STLE
STL S2
S2
TMR T2 K400 K100
T2
S2
( R)
STLE
Operands
Operands Function Data Type
S Program’s loop times between FOR and NEXT 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
[Link] instructions must be programmed as a pair. Nesting is allowed, and the nesting
level is 8.
The program after NEXT will not be executed unless the program between FOR and NEXT is
executed for specified times.
Between FOR and 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 FEND, END, or FOR and NEXT
number is not equal, an error will occur.
Between FOR~NEXT, CJ nesting is not allowed. FOR~NEXT must be in pairs in one STL.
Example 1: when M0 is ON, the FOR NEXT starts to sort the numbers in the range of D1 to
D20 from small to large. D21 is offset value. If there are many sortings in the program,
please use C language to save the programming time and scanning time.
SM2
MOV K19 D0
M0
FOR D0
MOV K0 D21
SM0
FOR D0
D1[D21] D2[D21]
XCH D1[D21] D2[D21]
INC D21
NEXT
NEXT
Operands
Operands Function Data Type
None - -
None
Description
Even though [FEND] instruction represents the end of the main program, the function is same
to END to process the output/input, monitor the refresh of the timer, return to program step0.
0
Main program 0 Main program
X11=ON
X11
X11=OFF
X10=OFF
X10
CJ P20 CALL P21
Jump
Main program Main program
FEND
FEND
P20 P21
X10=ON
Main program Main program
I100
FEND
Interruption
program
END
END
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, an error will occur.
In the condition of using many FEND instructions, please make program or subprogram
between the last FEND instruction and END instruction.
2. Operands
Operands Function Data Type
S1 Being compared number address 16/32bits, BIN
S2 Comparand address 16/32 bits, BIN
Description
X1
LD> D200 K-30 SET Y1
M4
Note Items
When the source data’s highest bit (16 bits: b15, 32 bits: b31) is 1, the data is seemed to a
negative number.
The comparison of 32 bits counter should use 32 bits instruction. If using 16 bits instruction,
the program or operation will be error.
Operands
Operands Function Data Type
S1 Being compared number address 16/32bit, BIN
S2 Comparand address 16/32bit, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
16 bits instruction 32 bits Activate Condition Not Activate Condition
instruction
AND= DAND= (S1)= (S2) (S1) ≠ (S2)
AND> DAND> (S1) > (S2) (S1) ≤ (S2)
AND< DAND< (S1) < (S2) (S1) ≥ (S2)
AND<> DAND<> (S1) ≠ (S2) (S1)= (S2)
AND<= DAND<= (S1) ≤ (S2) (S1) > (S2)
AND>= DAND>= (S1) ≥ (S2) (S1) < (S2)
S1· S2·
X0
AND= K100 C0 Y0
X1
AND> K-30 D0 SET Y1
X2
DAND> K68899 D10 M50
M4
Note Items
When the source data’s highest bit (16 bits: b15, 32 bits: b31) is 1, it is seemed to negative
number.
The comparison of 32 bits counter should use 32 bits instruction. If using 16 bits instruction,
the program or operation will be error.
2. Operands
Operands Function Data Type
S1 Being compared number address 16/32 bit,BIN
S2 Comparand address 16/32 bit,BIN
3. Suitable soft components
Description
X0
Y0
S1· S2·
OR= K100 C0
X2 M4
M50
Note Items
When the source data’s highest bit (16 bits: b15, 32 bits: b31) is 1, it is seemed to negative
number.
The comparison of 32 bits counter should use 32 bits instruction. If using 16 bits instruction,
the program or operation will be error.
Example: forbid the outputs when it reaches the certain time. In the below program, when the
date is June 30th, 2012, all the outputs will be disabled. The password 1234 is stored in
(D4000, D4001). When the password is correct, all the outputs are enabled.
LD SM0 //SM0 is always ON coil
TRD D0 //read the RTC (real time clock) value and store in D0~D6
LD>= D2 K30 //RTC date ≥30
AND>= D1 K6 //RTC month ≥6
AND>= D0 K12 //RTC year ≥12
LD>= D1 K7 //or RTC month ≥ 7
AND>= D0 K12 //RTC year ≥ 12
ORB //or
OR>= D0 K13 //RTC year ≥ 13
DAND<> D4000 K1234 //and password ≠1234
SET SM34 //set ON M34, all the outputs are disabled
DLD= D4000 K1234 //password=1234, correct password
RST SM34 //reset M34, all the outputs are enabled
4-5.Data Move Instructions
2. Operands
Operands Function Data Type
S1 Specify the data (to be compared) or soft 16 bit,BIN
component’s address code
S Specify the comparand’s value or soft 16 bit,BIN
component’s address code
D Specify the compare result’s address code bit
Operand System
Bit X Y M* S* T* C* Dn.m
D ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T, HT; C includes C, HC.
Description
S1· S· D
X0
CMP D10 D20 M0
M0
D10 > D20 ON
M1
D10 = D20 ON
M2
D10 < D20 ON
Compare data S1· and S· , show the result in three soft components starting from D·
D· , D· +1, D· +2: the three soft components will show the compare result.
2. Operands
Operands Function Data Type
S1 The low limit of zone 16 bit, BIN
S2 The high limit of zone 16 bit, BIN
S The current data address 16 bit, BIN
D The compare result bit
3. Suitable soft components
Operand System
Bit X Y M* S* T* C* Dn.m
D ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T, HT; C includes C, HC.
Description
D
S1· S2· S·
X0 ·
ZCP D20 D30 D0 M0
M0
D20 D0 M0 ON
M1
D20 D0 D30 M1 ON
M2
D0 D30 M2 ON
2. Operands
Operands Function Data Type
S Specify the source data or register’s address 16 bit/32 bit, BIN
code
D Specify the target soft component’s address 16 bit/32 bit, BIN
code
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
<read the counter or timer current value> <indirect set the timer value>
X1
MOV T0 D20
DMOV D0 D10
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;
Operand System
Bit X Y M* S* T* C* Dn.m
S ● ● ●
D ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T and HT; C includes C and HC.
Description
Move the source data block to the target data block. The data quantity is n.
<word move>
S· D· n
X0
BMOV D5 D10 K3
D5 D10
D6 D11 n=3
D7 D12
<bit move>
S· D· n
X0
BMOV Y5 Y10 K3
Y5 Y10
Y6 Y11 n=3
Y7 Y12
As the following picture, when the data address overlapped, the instruction will do from 1 to
3.
X1
BMOV D10 D9 K3
X2
BMOV D10 D11 K3
①
D10 D9
②
D11 D10
③
D12 D11
③
D10 D11
②
D11 D12
①
D12 D13
2. Operands
Operands Function Data Type
S Specify the source data block or soft component 16 bits, BIN; bit
address
D Specify the target soft components address 16 bits, BIN; bit
n Specify the data quantity 16 bits, BIN;
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T and HT; C includes C and HC.
Description
Move the source data block to target data block, the data quantity is n
S· D· n
X0
PMOV D5 D10 K3
D5 D10
D6 D11 n=3
D7 D12
The function of PMOV and BMOV is mostly the same, but the PMOV execution speed is
faster.
PMOV finish in one scan cycle, when executing PMOV, close all the interruptions.
Mistake may happen if the source address and target address are overlapped.
2. Operands
Operands Function Data Type
S Specify the source data or soft component 16/32 bits, BIN;
address
D Specify the target soft components address 16/32 bits, BIN;
n Specify the move data’s number 16/32 bits, BIN;
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D· n
X0
DFMOV D0 D10 K3
K0 D1
K0 D2
K0 D3
K0 D4
n
K0 D5
K0 D6
K0 D7
K0 D8
K0 D9
D1 D11
D0 D12
n
D1 D13
D0 D14
D1 D15
Operands
Operand Function Type
S Source soft element address 32 bits, BIN
D Destination soft element address 32 bits, BIN
Suitable soft element
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
EMOV K500 D10
2. Operands
Operands Function Data Type
S The data write in the source or save in the soft 16 bits/32 bits, BIN
element
D target soft element 16 bits/32 bits
D1 target soft element start address 16 bits/32 bits
D2 Write in data quantity 16 bits/32 bits, BIN
3. Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D· S· D1· D2·
X1 X2
DFWRT D0 FD0 FWRT D0 FD0 K3
Write value from D0,D1 to FD0,FD1 Write value from D0, D1, D2 to FD0, FD1, FD2
※1: FWRT instruction only can write data into FlashRom register. FlashRom can keep the
data even the power supply is off. It can store the important technical parameters.
※2: Written of FWRT needs a long time, about 150ms, so frequently write-in is not
recommended
※3: The written time of Flashrom is about 1,000,000 times. So we suggest using edge signal
(LDP, LDF etc.) to activate the instruction.
※4: Frequently write-in will damage the FlashRom.
*Notes: M includes M, HM, SM; S includes S and HS; T includes T and HT; C includes
C and HC.
Description
D1· D2·
X0
MSET M10 M120 Set ON M10~M120
When D1· > D2· , will not run Zone set, but set SM409 SD409 = 2
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
3. Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S and HS; T includes T and HT; C includes C and HC.
Description
D1· D2·
X0
ZRST M500 M559 Reset M500~M559
D1· D2·
D1· D2· Are specified as the same type of soft units, and D1· < D2·
When D1· > D2· , only reset the specified soft unit, and set SM409, SD409 = 2.
Other Reset
Instruction
RST can reset one soft component. The operand can be Y, M, HM, S, HS, T, HT, C, HC, TD,
HTD, CD, HCD, D, HD
FMOV can move 0 to these soft components: DX, DY, DM, DS, T(TD), HT(HTD), C(CD),
HC(HCD), D, HD
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S·
X0
SWAP D10
D10
High 8-bit Low 8-bit
4-5-12.Exchange [XCH]
1. Summary
Exchange the data in two soft element
Exchange [XCH]
16 bits XCH 32 bits DXCH
Execution Rising or falling pulse Suitable XD3, XDM
condition edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
D1 The soft element address 16 bits/32 bits, BIN
D2 The soft element address 16 bits/32 bits, BIN
3. Suitable soft component
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
32 bits instruction [DXCH] swaps the dword value D10, D11 and D20, D21.
2. Operands
Operands Function Data Type
Three operands
S1 The add operation data address 16 bit/32 bit, BIN
S2 The add operation data address 16 bit/32bit, BIN
D The result address 16 bit/32bit, BIN
Two operands
D Be Added data and result data address 16 bit/32bit, BIN
S1 Add data address 16 bit/32bit, BIN
3. Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
Two source data do binary addition and send the result to target address. 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 323767 (16 bits
limit) or 2147483647 (32 bits limit), the carry flag acts. (refer to the next page). If the result
exceeds –323768(16 bits limit)or –2147483648 (32 bits limit), the borrow flag acts (refer
to the next page).
When doing 32 bits operation, word device’s low 16 bits are assigned; the device close to the
preceding device’s is the high bits. To avoid ID repetition, we recommend you assign
device’s ID to be even number.
The source and target address can be the same. In the above example, when X0 is ON, the
instruction will be executed in every scanning period.
<Two operands>
D· S1·
X0
ADD D10 D12
D· S1·
X0
ADD D10 D12
Related flag
Flag meaning
Flag Name Function
ON: the calculate result is zero
SM020 Zero
OFF: the calculate result is not zero
ON: the calculate result is over -32768(16 bit) or -
2147483648(32bit)
SM021 Borrow
OFF: the calculate result is less than -32768(16 bit) or -
2147483648(32bit)
ON: the calculate result is over 32768(16 bit) or 2147483648(32bit)
SM022 Carry OFF: the calculate result is less than 32768(16 bit) or
2147483648(32bit)
4-6-2.Subtraction [SUB]
1. Summary
Two numbers do subtraction, store the result
Subtraction [SUB]
16 bits SUB 32 bits DSUB
Execution Normally ON/OFF/rising Suitable XD3, XDM
condition or falling pulse edge Models
Hardware - Software -
requirement requirement
Operands
Operands Function Data Type
Three operands
S1 The sub operation data address 16 bits /32 bits,BIN
S2 The sub operation data address 16 bits /32 bits,BIN
D The result address 16 bits /32 bits,BIN
Two operands
D Be subtracted data and result address 16 bits /32 bits,BIN
S1 Subtract data address 16 bits /32 bits,BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
<Three operands>
S1· S2· D·
X0
SUB D10 D12 D14 (D10) — (D12) → (D14)
S1· appoint the soft unit’s content, subtract the soft unit’s content appointed by S2· 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 setting method of 32 bits operation’s soft units are both the same
with the preceding ADD instruction.
The importance is: in the preceding program, if X0 is ON, SUB operation will be executed
every scan cycle.
Refer to chapter 4-6-1 for flag action and functions.
<Two operands>
D· S1·
X0
SUB D10 D12
4-6-3.Multiplication [MUL]
1. Summary
Multiply two numbers, store the result
Multiplication [MUL]
16 bits MUL 32 bits DMUL
Execution Normally ON/OFF / pulse Suitable XD3, XDM
condition edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S1 The multiplication operation data address 16 bits/32bits,BIN
S2 The multiplication operation data address 16 bits/32bits,BIN
D The result address 16 bits/32bits,BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
<16 bits Operation>
S1· S2· D·
X0 BIN BIN BIN
MUL D0 D2 D4
(D0) × (D2) → (D5, D4)
16 bits 16 bits → 32 bits
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 the above chart: when (D0)=8, (D2)=9, (D5,
D4) =72.
The result’s highest bit is the symbol bit: positive (0), negative (1).
In the above example, when X0 is ON, the instruction will be executed in every scanning
period.
When use 32 bits operation, the result is stored at the destination device in the format of 64
bits.
Even use word device, 64 bits results can’t be monitored.
Please change to floating value operation for this case.
4-6-4.Division [DIV]
1. Summary
Divide two numbers and store the result
Division [DIV]
16 bits DIV 32 bits DDIV
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S1 The divide operation data address 16 bits / 32 bits, BIN
S2 The divide operation data address 16 bits /32 bits, BIN
D The result address 16 bits /32 bits, BIN
3. Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1· appoints the dividend soft component, S2· appoints the divisor soft component, D·
and the next address appoint the soft component of the result and the remainder.
In the above example, if input X0 is ON, devision operation is executed every scan cycle.
The dividend is composed by the device appointed by S1· and the next one. The divisor 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, the instruction will be error.
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
Increase one [INC]
16 bits INC 32 bits DINC
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
Decrease one [DEC]
16 bits DEC 32 bits DDEC
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
D The increase or decrease data address 16 bits / 32bits,BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
<Decrement [DEC]>
D·
X1
DEC D0 (D0) -1 → (D0)
4-6-6.Mean [MEAN]
1. Summary
Get the mean value of data
Mean [MEAN]
16 bits MEAN 32 bits DMEAN
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S The source data start address 16 bits, BIN
D The mean result address 16 bits, BIN
n The data quantity 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D· n
X0
MEAN D0 D10 K3
Store the mean value of source data (source sum divide by source quantity n). give the
remainder .
The n cannot larger than soft component quantity, otherwise there will be error.
4-6-7.Logic AND [WAND], Logic OR[WOR], Logic Exclusive OR [WXOR]
1. Summary
Do logic AND, OR, XOR for data
Logic AND [WAND]
16 bits WAND 32 bits DWAND
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
Logic OR[WOR]
16 bits WOR 32 bits DWOR
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
Logic Exclusive OR [WXOR]
16 bits WXOR 32 bits DWXOR
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S1 The operation data address 16bit/32bit,BIN
S2 The operation data address 16bit/32bit,BIN
D The result address 16bit/32bit,BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
Example 1:
The 16 bits data is composed by X0~X7, and store in D0.
M0
MOV DX0 D0
Transform the state of X0, X1, X2, X3 to 8421 code and store in D0.
M0
WAND DX0 H0F D0
Example 2:
Combine the low 8 bits of D0 and D2 to a word.
X0
WAND D0 HFF D10
SWAP D12
LDP X0
WAND D0 HFF D10 //X0 rising edge
WAND D2 HFF D12 //Logic and, take the low 8 bits of D0 and save in D10
SWAP D12 // Logic and, take the low 8 bits of D2 and save in D12
WOR D10 D12 D20 //swap the low 8 bits and high 8 bits of D12
//combine the low 8 bits of D10 and high 8 bits of D12,
and save in D20
4-6-8.Logic converse [CML]
1. Summary
Logic converse the data
Converse [CML]
16 bits CML 32 bits DCML
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S Source data address 16 bits/32 bits, BIN
D Result address 16 bits/32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
M0
↑ CML D0 DY0
D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Sign (0=positive,
bit 1=negative)
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Y17 Y7 Y6 Y5 Y4
Each data bit in the source device is reversed (1→0, 0→1) and sent to the destination device.
If use constant K in the source device, it can be auto convert to be binary.
This instruction is fit for PLC logical converse output.
X1
M1
The sequential control
X2
M2 M8000 instruction in the left could be
CML DX0 DM0
denoted by the following
X3
M3 CML instruction.
X17
M17
4-6-9.Negative [NEG]
1. Summary
Get the negative data
Negative [NEG]
16 bits NEG 32 bits DNEG
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
D The source data address 16 bits/ 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
D·
M0
NEG D10 (D10) +1 (D10)
Converse each bit of source data (1→0, 0→1), then plus one and store the result in the source
data address.
For example, the source data D10 is 20, when M0 rising edge is coming, D10 become -20.
The following two instructions are the same.
M0
NEG D10
M0
SUB K0 D10 D10
4-7.Shift Instructions
2. Operands
Operands Function Data Type
D The source data address 16bit/32bit,BIN
n Shift left or right times 16bit/32bit,BIN
3. Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
After executing SHL once, the lowest bit is filled with 0, the last bit is stored in carry flag.
After executing SHR once, the highest bit is the same; the last bit is stored in carry flag.
D. n
M0
SHL D0 K4
Move
Highest Lowest
left
bit bit
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
※
Bit n
SM22
Execute once
Highest Lowest
bit bit
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
1 SM22
※
< Arithmetic shift right >
D. n
M1
SHR D0 K4
Move
Highest right Lowest
bit bit
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
※
Bit n
SM22
Execute
Highest once Lowest
bit bit
1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
SM22 0
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
After executing LSL once, the lowest bit is filled with 0; the last bit is stored in carry flag.
LSL meaning and operation are the same to SHL.
After executing LSR once, the highest bit is filled with 0; the last bit is stored in carry flag.
LSR and SHR are different, LSR add 0 in the highest bit when moving, SHR all bits are
moved.
< Logic shift left > < Logic shift right >
D. n D. n
M0 M1
LSL D0 K4 LSR D0 K4
Highest Lowest Highest Lowest
Move left bit Move right bit
bit bit
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
※ ※
N bits N bits
SM22
SM22
After After
Highest executing Lowest Highest executing Lowest
bit once bit bit once bit
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0
SM22 0
1 SM22
※
※
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
When X0 changes from OFF to ON, the value will be cycle moved left or right, the last bit is
stored in carry flag.
1 SM22
※
SM22 0
※
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T, HT; C includes C, HC.
Description
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
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
3. Suitable soft components
Operand System
X Y M* S* T* C* Dn.m
Bit S ● ● ● ● ● ●
D ● ● ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T, HT; C includes C, HC.
Description
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
D25~D22→Overflow
D21~D18→D25~D22
D17~D14→D21~D18
D13~D10→D17~D14
D 3~D 0→D13~D10
2. Operands
Operands Function Data Type
S Source soft element head address 16 bits, BIN
D Target soft element head address 16 bits, BIN
n1 Source data quantity 16 bits, BIN
n2 Shift right times 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
D13~D10→Overflow
D17~D14→D13~D10
D21~D18→D17~D14
D25~D22→D21~D18
D 3~D 0→D25~D22
4-8.Data Convert
2. Operands
Operands Function Data Type
S Source soft element address 16 bits, BIN
D Target soft element address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0 (D0) → (D11, D10)
WTD D0 D10
Single Word Double Word
0 or 1 D0
D11 D10
High bits Low bits
When single word D0 is positive integer, after executing this instruction, the high bit of
double word D10 is 0.
When single word D0 is negative integer, after executing this instruction, the high bit of
double word D10 is 1.
the high bit 0 and 1 is binary value.
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
<16 bits>
S· D·
(D10)
X0 → (D13,D12)
FLT D10 D12
BIN integer Binary float point
Convert BIN integer to binary floating point. As the constant K, H will auto convert by the
floating operation instruction, so this FLT instruction can’t be used.
The inverse transformation instruction is INT.
FLTD can change the 64 bits integer to 32 bits floating value.
X0
FLT D0 D10
D0 is integer 20, after executing the instruction, D10 is floating value 20.
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS; the word combined by bits.
Description
<16 bits>
(D11,D10) → (D20)
S· D·
X0 Binary Float BIN integer
INT D10 D20 Give up the data after the decimal dot
<32 bits>
S· D· (D11,D10) → (D20,D21)
X0
DINT D10 D20 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 device.
Abandon the value behind the decimal point.
The inverse instruction is FLT.
When the result is 0, the flag bit is ON.
When converting, less than 1 and abandon it, zero flag is ON.
The result is over below data, the carry flag is ON.
16 bits operation: -32,768~32,767
32 bits operation: -2,147,483,648~2,147,483,647
X0
INT D0 D10
For example, if D0 is floating value 130.2, after executing INT, D10 value is integer 130.
2. Operands
Operands Function Data Type
S Source soft element address BCD
D Target soft element address 16 bits/32 bits, BIN
3. Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
BIN D10 D0
If source data is not BCD code, SM409 will be ON (Operation error), SD409=4 (error
occurs).
As constant K automatically converts to binary, so it’s not suitable for this instruction.
2. Operands
Operands Function Data Type
S Source soft element address 16 bits, BIN
D Target soft element address BCD code
Description
S· D·
X0
BCD D10 D0
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D· n
X0
ASCI D100 D200 K4
Transform the source Hex data to ASCII code, and store in D· . The transformation chacters
are n.
D· Will store one ASCII code.
n
K1 K2 K3 K4 K5 K6 K7 K8 K9
D
D200 down [C] [B] [A] [0] [4] [3] [2] [1] [8]
D200 up [C] [B] [A] [0] [4] [3] [2] [1]
D201 down [C] [B] [A] [0] [4] [3] [2]
D201 up [C] [B] [A] [0] [4] [3]
D202 down [C] [B] [A] [0] [4]
D202 up [C] [B] [A] [0]
D203 down [C] [B] [A]
D203 up [C] [B]
D204 down [C]
2. Operands
Function Date type
Operands
S Source soft element address ASCII
D Target soft element address 2 bits, HEX
n ASCII Character quantity 16 bits, BIN
Description
S· D· n
X0
HEX D200 D100 K4
Convert the high 8 bits and low 8 bits in source S· to HEX data. Move 4 bits every time
to destination D· . The convert character number is assigned by n.
The convert process is the following:
(S·) ASCII HEX
Code Convert n (D·) D102 D101 D100
D200 down 30H 0 1 ···0H
D200 up 41H A 2 ··0AH
D201 down 42H B Not change to be
3 ·0ABH
D201 up 43H C 0
4 0ABC
D202 down 31H 1 H
D202 up 32H 2 5 ···0H ABC1
D203 down 33H 3 H
D203 up 34H 4 6 ··0AH BC12H
D204 down 35H 5 7 ·0ABH C123H
8 0ABC 1234H
H
9 ···0H ABC1H 2345H
n=k4
D200 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0
D201 0 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0
D100 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0
0 A B C
4-8-8.Coding [DECO]
Summary
Change any data or bit to 1.
Coding [DECO]
16 bits DECO 32 bits -
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S The source data address 16 bits, BIN
D The decode result head address 16 bits, BIN
n The decoding soft element bit quantity 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T and HT; C includes C and HC.
Description
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 third bit (M13) is 1. If the source is all
0, M10 is 1.
When n=0, no operation, beyond n=0~16, don’t execute the instruction.
When n=16, if decoding command D· is soft unit, it’s point is 216=65536.
When drive input is OFF, instructions are not executed, the decoding output keep on the state.
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.
2. Operands
Operands Function Data Type
S Coding data address 16 bits, BIN
D Coding result address 16 bits, BIN
n The bit quantity of coding result 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T and HT; C includes C and HC.
Description
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
Ignore the 1 of b1
0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0
7 6 5 4 ③ 2 1 0
被忽视
Ignore
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 address are 1, ignore the low bits. If source addresses 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=16, if encode instruction S· is bit unit, it’s point number is 216=65536.
2. Operands
Operands Function Data Type
S Soft element address need coding 16bit,BIN
D Soft element address to save coding result 16bit,BIN
n The bit quantity of coding result 16bit,BIN
3. Suitable soft components
Operand System
Bit X Y M* S* T* C* Dn.m
S ● ● ● ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S, HS; T includes T and HT; C includes C and HC.
Description
b15 D10 4 ② ①
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
b0
All be 0
aa
b15 D0 b0
0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0
Ignore the 1 of b5
7 6 5 4 ③ 2 1 0
被忽视
Ignore
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 address are 1, ignore the high bits. If source address 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=16, if encode instruction S· is bit unit, it’s point number is 216=65536.
4-8-11.Binary to Gray code [GRY]
1. Summary
Transform the binary data to gray code.
Binary to gray [GRY]
16 bits GRY 32 bits DGRY
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S Soft element address need coding 16bits/32bits, BIN
D Soft element address to save coding result 16bits/32bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
GRY D10 D100
b15 D10 b0
0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1
Each bit of D10 will XOR with the bit on
its left side. As the related gray code, the
left bit will not change (the left bit is 0);
0 0 0 0 0 1 1 0 1 1 1 1 0 0 1 0
the transformation result is stored in
b15 D100 b0 D100.
2. Operands
Operands Function Data Type
S Soft element address need coding 16bits/32bits, BIN
D Soft element address to save coding result 16bits/32bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
GBIN D10 D100
b15 D10 b0
0 0 0 0 0 1 1 0 1 1 1 1 0 0 1 0 From the left second bit of D10, XOR
each bit with the value after decoding,
as the bit value after decoding (the left
0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1
bit will not change). The
b15 D100 b0 transformation value will be stored in
D100.
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
Operand System
Bit X Y M* S* T* C* Dn.m
D ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S and HS; C includes C and HC.
Description
S1· S2· D·
X0
ECMP D10 D20 M0
M0
(D11,D10) > (D21<D20)
Binary Floating Binary Floating
M1
(D11,D10) = (D21<D20)
Binary Floating Binary Floating
M2 (D11,D10) < (D21<D20)
Binary Floating Binary Floating
When X0 is OFF, even ECMP doesn’t run, M0~M2 will keep the
status before X0 is OFF.
The instruction will compare the two source data S1 and S2. The result is stored in three bits
from D.
If a constant K or H used as source data, the value is converted to floating value.
X0
ECMP K500 D100 M10
Operand System
Bit X Y M* S* T* C* Dn.m
D ● ● ●
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S and HS; C includes C and HC.
Description
M3
(D1, D0) < (D11, D10) ON
Binary Floating Binary Floating
M4
(D11, D10) ≤ (D1, D0 ) ≤ (D21, D20) ON
Binary Floating Binary Floating Binary Floating
M5
(D1, D0) > (D21, D20) ON
Binary Floating Binary Floating
Compare the source data S3 to the upper and lower limit value of the range S1~S2.
The result will store in three coils starting from D.
Constant K and H will transform to binary floating value when they are source data.
X0
EZCP K10 K2800 D5 M0
Please set S1≤ S2, when S2< S1, make S2 as the same value to S1.
Note: the compare value must be float numbers, otherwise the result will be error.
2. Operands
Operands Function Data Type
S1 Addition operation data address 32 bits, BIN
S2 Addition operation data address 32 bits, BIN
D Result address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1· S2· D·
X0
EADD D10 D20 D50
X1
EADD D100 K1234 D110
The source data and result address can be the same. Please note that when X0 is ON, the
instruction will be executed in every scanning period.
Note: the add value must be float numbers, otherwise the result will be error.
2. Operands
Operands Function Data Type
S1 Subtraction operation data address 32 bits, BIN
S2 Subtraction operation data address 32 bits, BIN
D Result address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1· S2· D·
X0
ESUB D10 D20 D50
The binary floating value S1 subtract S2, the result is stored in the target address.
If a constant K or H used as source data, the value is converted to floating point before the
subtraction operation.
X1
ESUB K1234 D100 D110
The source data and result address can be the same. Please note that when X0 is ON, the
instruction will be executed in every scanning period.
2. Operands
Operands Function Data Type
S1 Multiplication operation data address 32 bits, BIN
S2 Multiplication operation data address 32 bits, BIN
D Result address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1· S2· D·
X0
EMUL D10 D20 D50
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
multiplication operation.
X1
EMUL K100 D100 D110
Note: the value must be floating numbers, otherwise the result will be error.
4-9-6.Floating Division [EDIV]
1. Summary
Floating Divide [EDIV]
16 bits - 32 bits EDIV
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
2. Operands
Operands Function Data Type
S1 Division operation data address 32 bits, BIN
S2 Division operation data address 32 bits, BIN
D Result address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1· S2· D·
X0
EDIV D10 D20 D50
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.
If a constant K or H used as source data, the value is converted to floating point before the
division operation.
X1
EDIV D100 K100 D110
The source data S2 is 0, the calculation will be error. The instruction will not work.
Note: the value must be floating numbers, otherwise the result will be error.
4-9-7.Float Square Root [ESQR]
1. Summary
Floating Square Root [ESQR]
16 bits - 32 bits ESQR
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware - Software -
requirement requirement
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0 (D11, D10) → (D21, D20)
ESQR D10 D20
Binary Floating Binary Floating
A square root is performed on the floating point value 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
operation.
X1 (K1024) → (D111, D110)
ESQR K1024 D110
Binary converts to Floating Binary Floating
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
SIN D50 D60
This instruction performs the mathematical SIN operation on the floating point value in S
(angle RAD). The result is stored in D.
Note: the value must be floating numbers, otherwise the result will be error.
4-9-9.Cosine [COS]
1. Summary
Floating Cosine [COS]
16 bits - 32 bits COS
Execution Normally ON/OFF, Suitable XD3, XDM
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
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
COS D50 D60
2. Operands
Operands Function Data Type
S Soft element address need to do tan 32bit,BIN
D Result address 32bit,BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
TAN D50 D60
This instruction performs the mathematical TAN operation on the floating point value in S.
The result is stored in D.
S· D51 D50
RAD value (angle× π/180)
Assign the binary floating value
TAN value
D· D61 D60
Binary Floating
4-9-11.ASIN [ASIN]
1. Summary
ASIN [ASIN]
16 bits - 32 bits ASIN
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware Software -
requirement requirement
2. Operands
Operands Function Data Type
S Soft element address need to do arcsin 32 bits, BIN
D Result address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0
ASIN D50 D60
This instruction performs the mathematical ASIN operation on the floating point value in S.
The result is stored in D.
2. Operands
Operands Function Data Type
S Soft element address need to do arccos 32 bits, BIN
D Result address 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0 (D51,D50) ACOS → (D61,D60) RAD
ACOS D50 D60
Binary Floating Binary Floating
Calculate the arcos value(radian), save the result in the target address
S· D51 D50
ACOS value
Binary Floating
RAD value (angle×π/180)
D· D61 D60 Assign the binary floating value
4-9-13.ATAN [ATAN]
1. Summary
ATAN [ATAN]
16 bits - 32 bits ACOS
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware Software -
requirement requirement
2. Operands
Operands Function Data Type
S Soft element address need to do arctan 32 bit, BIN
D Result address 32 bit, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S· D·
X0 (D51,D50) ATAN → (D61,D60) RAD
ATAN D50 D60
Binary Floating Binary Floating
Calculate the arctan value ( radian), save the result in the target address
4-10.RTC Instructions
※1: To use the instructions, The Model should be equipped with RTC function;
4-10-1.Read the clock data [TRD]
1. Instruction Summary
Read the clock data:
Read the clock data: [TRD]
16 bits TRD 32 bits -
Execution Normally ON/OFF, Suitable XD3, XDM
condition rising/falling edge Models
Hardware Software -
requirement requirement
2. Operands
Operands Function Data Type
D Register address to save clock data 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
D·
X0
TRD D0
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.
Read PLC’s real time clock according to the following format.
Read the special data register (SD013~SD019).
The RTC (real time clock) value is in BCD code format (SD013 to SD019). Please choose
hex format to monitor the RTC value in XDPpro software. The value can be transformed to
decimal format by BIN instruction. After reading the RTC by TRD instruction, the value will
show in decimal format.
After reading the RTC by TRD, the value becomes decimal value.
after executing TRD instruction, D0 to D6 are occupied.
2. Operands
Operands Function Data Type
S Write the clock data to the register 16 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S·
X0
TWR D0
SD016 Date
D3 Hour 0-23 SD015 Hour
D4 Minute 0-59 SD014 Minute
D5 Second 0-59 SD013 Second
D6 Week 0 (Sun.)-6 (Sat.) SD019 Week
After executing TWR instruction, the time in real time clock will immediately change to be
the new time. It is a good idea to set the time few minutes late as the current time, and then
drive the instruction when the real time reaches this value.
Note: when choosing secret download program advance mode in XDPpro software, the RTC
only can be changed through TWR instruction.
There is another method to write the RTC. In the XDPpro software, please click the clock
details in project bar on the left. Then click write into the current [Link] PC will auto-write
the current time to the PLC.
2. operand
Operand Function Model
S1 The first clock soft component address 16 bits, BIN
S2 The second clock soft component address 16 bits, BIN
S3 The third clock soft component address 16 bits, BIN
S4 PLC real time clock information first address 16 bits, BIN
D2 The compare result first address bit
Description
X0
TRD D30
M0
D20 D21 D22 > D30 D31 D32
M1
D20 D21 D22 = D30 D31 D32
M2
D20 D21 D22 < D30 D31 D32
TRD will read the present clock information in D30~D36 (year, month, day, hour, minute,
second, week).
X0 from OFF to ON, TCMP worked. Compare the three registers starting from S4 to three
registers S1, S2, S3 (year, month, day). When S1, S2, S3 is larger than S4 clock, M0 is ON.
When S1, S2, S3 is equal to S4 clock, M1 is ON. When S1, S2, S3 is smaller than S4 clock,
M2 is ON.
For example, the present clock is [Link] 7,30,2014 Wednesday. D30=14, D31=7, D32=30,
D33=15, D34=32, D35=49, D36=3. If the setting time is 1,6,2015, D20=15, D21=1, D22=6,
Then M0=ON. If the setting time is 7,31,2014, D20=14, D21=7, D22=31, then M1=ON. If
the setting time is 6,31,2014, D20=14, D21=6, D22=31, then M2=ON.
Note: if S4 is D33, it means hour, minute, second, then S1, S2, S3 mean hour, minute, second.
S4 can start from year, month, day, hour; cannot start from minute, second. The week cannot
compare.
For example:
X0
TRD D30
M0
Y0
M1
Y1
M2
Y2
The present clock is [Link] 7,30,2014 Wednesday. So D30=14, D31=7, D32=30, D33=15,
D34=32, D35=49, D36=3. If the setting time is [Link], D20=15, D21=32, D22=49, so
Y1=ON. If the setting time is [Link], D20=17, D21=32, D22=49, so Y0=ON. If the setting
time is [Link], D20=2, D21=32, D22=5, so Y2=ON.
5 HIGH SPEED COUNTER (HSC)
This chapter will introduce high speed counter’s functions, including high speed count model,
wiring method, read/write HSC value, reset etc.
No 24-segments single
CNT 5-7-1
phase
5-1.Functions Summary
XD3, XDM series PLC has HSC (High Speed Counter) function which will not affect by the
scanning 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.
Count input
COM X1 X3 X5
COM X0 X2 X4 X6
5-2.HSC Mode
XD3, XDM series high speed counter has two working mode: increasing mode and AB phase
mode.
Increasing Mode
Under this mode, the count value increase at each pulse’s rising edge;
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, but the default count mode is 4-time mode.
1-time frequency and 4-time frequency modes are shown below:
1-time Frequency
A phase 1
input 0
B phase 1
input 0
10
9 9
8 8
7 7
6 6
5 5
4 4
3 3
Counter 2 2
current 1 1
value 0 0
4-time Frequency
A phase
input
B phase
input
Counter current
value
5-3.HSC Range
HSC’s count range is: -2,147,483,648 ~ +2,147,483,647. If the count value overflows this
range, then overflow or underflow appears;
Overflow means the count value jumps from +2,147,483,647 to -2,147,483,648, then continue
counting; underflow means the count value jumps from -2,147,483,648 to +2,147,483,647
then continue counting.
5-4.HSC Input Wiring
For the counter’s pulse input wiring, things differ with different PLC model and counter
model; several typical input wiring diagrams are shown below: (take XD3-60 HSC0 as the
example):
COM X1 X3 X5
COM X0 X2 X4 X6
COM X1 X3 X5
COM X0 X2 X4 X6
Normally, X0 and X1 can accept 80 KHz and 50 KHz pulse in single phase mode and AB
phase mode. Other terminals can accept 10 KHz and 5 KHz pulse in single phase mode and
AB phase mode. X can use as normal input terminals when there are no high speed pulses
input. In the following table, Frequency time 2 means 2-time frequency; 4 means 4-time
frequency; 2/4 means 2-time and 4-time frequency.
XD3-16T/R/RT-E
Increasing mode AB phase mode
HSC0 HSC2 HSC4 HSC6 HSC8 HSC10 HSC12 HSC0 HSC2 HSC4 HSC6 HSC8
Max
80K 10K 50K 5K
frequency
Frequency
2/4 2/4
time
Counter
√ √ √ √
interruption
X000 U A
X001 B
X002 Z
X003 U A
X004 B
X005 Z
X006
X007
X010
X011
XD3-24/32/48/60/T/R/RT-E
Increasing mode AB phase mode
HSC0 HSC2 HSC4 HSC6 HSC8 HSC10 HSC12 HSC0 HSC2 HSC4 HSC6 HSC8
Max
80K 10K 10K 50K 5K 5K
frequency
Frequency
2/4 2/4 2/4
time
Counter
√ √ √ √ √ √
interruption
X000 U A
X001 B
X002 Z
X003 U A
X004 B
X005 Z
X006 U A
X007 B
X010 Z
X011
XDM-24T4/32T4/60T4-E
Increasing mode AB phase mode
HSC0 HSC2 HSC4 HSC6 HSC8 HSC10 HSC12 HSC0 HSC2 HSC4 HSC6 HSC8
Max
80K 80K 80K 80K 50K 50K 50K 50K
frequency
Frequency
2/4 2/4 2/4
time
Counter
√ √ √ √ √ √ √ √
interruption
X000 U A
X001 B
X002 Z
X003 U A
X004 B
X005 Z
X006 U A
X007 B
X010 Z
X011 U A
X012 B
X013 Z
XDM-60T10 -E
Incremental mode
HSC0 HSC2 HSC4 HSC6 HSC8 HSC10 HSC12 HSC14 HSC16 HSC18 HSC20 HSC22
Max 80K 80K 80K 80K 80K 80K 80K 10K 10K
80K
frequency
Frequency
time
Counter
√ √ √ √ √ √ √ √ √ √
interruption
X000 U
X001
X002
X003 U
X004
X005
X006 U
X007
X010
X011 U
X012
X013
X014 U
X015
X016
X017 U
X020
X021
X022 U
X023
X024
X025 U
X026
X027
X030 U
X031
X032
X033 U
X034
XDM-60T10 -E
AB phase mode
HSC0 HSC2 HSC4 HSC6 HSC8 HSC10 HSC12 HSC14 HSC16 HSC18 HSC20 HSC22
Max 50K 50K 50K 50K 50K 50K 50K 5K 5K
50K
frequency
Frequency
2/4 2/4 2/4 2/4 2/4 2/4 2/4 2/4 2/4 2/4
time
Counter
√ √ √ √ √ √ √ √ √ √
interruption
X000 A
X001 B
X002 Z
X003 A
X004 B
X005 Z
X006 A
X007 B
X010 Z
X011 A
X012 B
X013 Z
X014 A
X015 B
X016 Z
X017 A
X020 B
X021 Z
X022 A
X023 B
X024 Z
X025 A
X026 B
X027 Z
X030 A
X031 B
X032 Z
X033 A
X034 B
X035 Z
Operands
Operands Function Type
S Specify HSC code 32 bits, BIN
D Specify the read/written register 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
S. D.
DMOV HSC0 D10
Move the counting value of HSC (dword) to the target register when the condition activates.
DMOV will send the counting value to data register; this will improve the counting value
precision.
Program example:
SM0
CNT_AB HSC0 K999999999
D10 K1000 Y0
D≥ ( S )
D20 K1000
D≥
operands
Operands Function Type
S Specify HSC code 32 bits, BIN
D Specify the read/written register 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
FUNCTIONS AND ACTIONS
Move the data register value to HSC when the condition activates.
The HSC cannot join all the instructions except DMOV. Please use DMOV to send the HSC
value to normal register then it can join other instructions.
Program example:
Operand
Operand Function Type
S1 Set the HSC (for example: HSC0) 32 bits, BIN
S2 Set the compare value (K100, D0 ) 32 bits, BIN
Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1. S2.
SM0
CNT HSC0 D20
When HSC0 is counting, compare HSC counting value to D20, if they are equal, set on coil
HSC0.
Program example:
M0
CNT HSC0 K20000
Operand
Operand Function Type
S1 Set the HSC (such as:HSC0) 32 bits, BIN
S2 Set the compare value (such as: K100, D0 ) 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
S1. S2.
SM0
CNT_AB HSC0 D20
When HSC0 is AB phase counting, compare HSC counting value to D20, if they are equal,
set on coil HSC0.
Program example:
M0
CNT_AB HSC0 K20000
Operand
Operand Function Type
S1 Set the HSC (such as: HSC0) 32 bits, BIN
S2 Set the compare value (such as: K100, D0) 32 bits, BIN
S3 Set the 24-segment value 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
When HSC0 is single phase counting, compare the HSC value to D4100, if HSC value is
equal to 24-segment value, it will produce HSC interruption.
Program example:
M0
CNT HSC0 D4000 D4100
5-7-4.HSC 100-segment AB phase [CNT_AB]
Summarization
HSC 100-segment AB phase counting instruction.
HSC 100-segment AB phase [CNT_AB]
16 bits instruction - 32 bits instruction CNT_AB
Execution condition Normal ON/OFF Suitable model XD3, XDM
Hardware - Software -
requirments requirements
Operand
Operand Function Type
S1 Set the HSC (such as: HSC0) 32 bits, BIN
S2 Set the compare value (such as: K100, D0) 32 bits, BIN
S3 Set the 24-segment value 32 bits, BIN
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Description
When HSC0 is AB phase counting, compare the HSC value to D4100, if HSC value is equal
to 24-segment value, it will produce HSC interruption.
Program example:
M0
CNT_AB HSC0 D4000 D4100
When M0 is ON, HSC0 is counting the pulse from X0 terminal. When M1 changes from OFF
to ON, reset the HSC0, the counting value will be cleared.
5-10.HSC Example
M1
RST HSC0
SM0
CNT_AB HSC0 K88888888
DMOV HSC0 D0
M1
RST HSC0
D0 D2
D< ( Y0 )
D0 D2 D0 D4
D≥ D< ( Y1 )
D0 D4
D≥ ( Y2 )
When SM0 is ON, set the count value of HSC to K88888888, read the HSC0 counting value
to register D0 (dword).
When HSC0 counting vaue is less than D2 (D0<D2), Y0 is ON; when HSC0 counting value
is in the range of D2 to D4 (D2≤ D0 <D4), Y1 is ON; when HSC0 counting value is larger
than D4 (D0 ≥ D4), Y2 is ON.
When the rising edge of M1 is coming, reset HSC0.
AB phase mode:
M8
CNT_AB HSC0 K999999
SM0
DMOV HSC0 D0
D0 K3000
D≥ ( Y2 )
M9
RST HSC0
When M8 is ON, HSC0 starts counting. The pulse input from X0 (A phase) and X1 (B
phase).
If the counting value is over 3000, Y2 is ON.
When the rising edge of M9 is coming, reset HSC0.
SM2
RST HSC0
SM0
CNT_AB HSC0 K88888888
DMOV HSC0 D0
D0 K0 D0 K100
D= D< ( Y0 )
D0 K100 D0 K200
D= D< ( Y1 )
D0 K200
D= ( Y2 )
When the rising edge of SM2 is coming, reset HSC0 and the counting value is cleared.
When SM0 is ON, HSC0 starts counting; the set counting value is 88888888.
If the counting value is in the range of 0 to 100 (0≤ D0 <100), Y0 is ON; if the counting value
is in the range of 100 to 200 (100 ≤ D0 < 200), Y1 is ON; if the counting value is larger than
200 (D0 ≥ 200), Y2 is ON.
5-11.HSC interruption
Some HSC (refer to chapter 5-5) has 100 segments 32-bit preset value. When the HSC
difference value is equal to 100-segment preset value, the interruption will be produced.
5-11-1.Interruption instruction
(For the program about interruption, please refer chapter 5-11-4)
M0
CNT_AB HSC0 K2000 D4000
M1
RST HSC0
As shown in the above graph, data register D4000 is the start address of 100-segment preset
value. The following addresses will save each 100-segment preset value in DWORD form.
Please pay attention when using HSC:
If certain preset value is 0, it means count interruption end at this segment;
Set the interruption preset value but not write the correspond interruption program is not
allowed;
100-segment interruption of HSC occurs in order. If the first segment interruption doesn't
happen, then the second segment interruption will not happen;
HSC CAM: after setting the 100-segment preset value, choose the HSC CAM function. When
HSC counting value is equal to one of the preset value, the corresponding interruption will be
executed. The same HSC CAM can be repeated when HSC counting value changes.
100-segment single phase and AB phase, HSC absolute and relative mode (refer to special
register SFD330, SFD331), HSC CAM (refer to special register SFD332) can be configured
in the following way:
Click the high speed counter config in XDPpro software. And configure the
parameters in it.
HSC 100-segment preset value is the difference value. When the counting value is equal to
the difference of counting value and last preset value, it will produce the interruption. N
interruption flags correspond to N interruption preset values. The (N+1) preset value is 0.
Example1:
The current value of HSC0 is 0, segment one preset value is 10000, the preset value in
segment 2 is -5000, the preset value in segment 3 is 20000. When start to count, the
counter's current value is 10000, it generates the first interruption I2000; the counter's current
value is 5000, it generates the second interruption I2001; the counter's current value is 25000,
it generates the third interruption I2002.
I2000
HSC0 =0+10000=10000
100ddK0+K10000=K10000
I2001
HSC0 = 10000+ (-5000)=5000
I2002
HSC0 = 5000+20000=25000
Example 2:
HSC2 current value is 10000, the segment one preset value is 10000, the preset value in
segment 2 is 5000, the preset value in segment 3 is 20000. When start to count, the counter's
current value is 20000, it generates the first interruption I2100; the counter's current value is
25000, it generates the second interruption I2101; the counter's current value is 45000, it
generates the third interruption I2102.
I2100
HSC2 =10000+10000=20000
ccccKKK10000+K10000=K200
I2101
HSC2 = 20000+5000=25000
I2102
HSC2 =25000+20000=45000
K25000+K20000=K45000
Via setting the special auxiliary relays SFD331, users can set the HSC interruption to be
single loop mode or continuous loop mode. The continuous loop mode is only suitable for the
relative counting. The detailed assignment is show below:
FEND
I2000
SM0
INC D0
IRET
I2001
SM0
INC D1
IRET
Instruction:
LD SM0 //SM000 is normal ON coil
DMOV K10000 D4000 //segment one preset value D4000 is 10000
DMOV K-10000 D4002 //segment 2 preset value D4002 is -10000
DMOV K200000 D10 //set HSC compare value
LD M0 //HSC activate condition M0
CNT_AB HSC0 D10 D4000 //HSC interruption instruction
LDP M1 //HSC reset condition M1
RST HSC0 //reset HSC and 100 segments interruption
FEND //the main program end
I2000 //segment one interruption flag
LD SM0 //SM0 is normal ON coil
INC D0 //D0= D0+1
IRET //interruption return flag
I2001 //segment 2 interruption flag
LD SM0 //SM0 is normal ON coil
INC D1 //D1= D1+1
IRET //interruption return flag
Application 2: knit-weaving machine (continuous loop mode)
The machine principle: Control the inverter via PLC, thereby control the motor. Meantime,
via the feedback signal from encoder, control the knit-weaving machine and the precise
position.
I2003
HSC0=K15000+(K-15000)
I2002
HSC0=K90000+(K-75000)
I2001
HSC0=K75000+K15000
I2000
Pulse HSC0=K0+K75000 Forward Reverse
frequency Forward fast run slow run Reverse fast run slow run
f
Time t
Below is PLC program: Y2 represents forward output signal; Y3 represents reverse output
signal; Y4 represents output signal of speed 1; HSC2: Back-forth times accumulation counter;
HSC0: AB phase HSC;
SM2 Y2
( S )
Y2
CNT HSC2 K1000000
SM0
CNT_AB HSC0 D0 D100
FEND
I2000
SM0 Y4
( S )
IRET
I2001
SM0 Y4
( R )
Y2
( R )
Y3
( S )
IRET
I2002
SM0 Y4
( S )
IRET
I2003
SM0 Y3
( R )
Y4
( R )
Y2
( S )
IRET
Instruction List:
LD SM2 //SM2 is initial ON coil
SET Y2 //set ON Y2 (forward run)
LDP Y2 // Back-forth times activate condition Y2
CNT HSC2 K1000000 //HSC2 starts counting
LD SM0 //SM000 is normal ON coil
CNT_AB HSC0 D0 D100 //HSC 100 segments first address
DMOV HSC0 D200 //read HSC0 counting value to D200
FEND //main program end
I2000 //Interruption 1 flag
LD SM0 //SM0 is normal ON coil
SET Y4 //set ON Y4 (run at speed 1)
IRET //interruption return
I2001 //interruption 2 flag
LD SM0 //SM0 is normal ON coil
RST Y4 //reset Y4 (stop running at speed 1)
RST Y2 //reset Y2 (stop forward running)
SET Y3 //set ON Y3 (reverse running)
IRET //interruption return
I2002 //interruption 3 flag
LD SM0 //SM0 is normal ON coil
SET Y4 //set ON Y4 (run at speed 1)
IRET //interruption return
I2003 //interruption 4 flag
LD SM0 //SM0 is normal ON coil
RST Y3 //reset Y3 (stop reverse running)
RST Y4 //reset Y4 (stop running at slow speed)
SET Y2 //set on Y2 (forward running)
IRET //interruption return
6 PULSE OUTPUT
This chapter will introduce the pulse function of XD3, XDM series PLC. The content
includes pulse output instructions, input/output wiring, and notes, related coils and registers
etc.
6-1.Functions Summary
Generally, XD3 series PLC have two pulse output channels. XDM series PLC has 4~10
channels pulse output. The pulse output modes include single direction pulse output without
acceleration/deceleration, single direction pulse output with acceleration/deceleration, multi-
segment double direction pulse output. The pulse frequency can up to 200 KHz.
Pulse output terminal:
PLC model Pulse channel Pulse output terminal
XD3-16T/RT, XD3-24T/RT,
XD3-32T/RT, XD3-48T/RT, 2 Y0, Y1
XD3-60T/RT
XDM-24T4, XDM-32T4,
4 Y0, Y1, Y2, Y3
XDM-60T4
Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7,
XDM-60T10 10
Y10, Y11
※1: Please use transistor output terminal for pulse output. Such as XD3-14T-E, XD3-60T-E.
※2: the pulse output terminal please see the above table. The direction terminal can be any
one in the rest of the output terminals.
※3: the direction terminal will keep the pulse direction state after the pulse sending finished.
For example, the pulse direction is positive, the terminal will be ON after pulse sending
finished. If the pulse has direction output next time, the pulse will control the direction
terminal. If the pulse without direction output next time, the direction terminal state can be
controlled in the program.
Operand
Operand Function Type
S0 Pulse parameter start address
S1 User parameter start address
S2 System parameter block (1 ~4)
D Pulse output port
Suitable soft components
*Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM.
DS includes DS, DHS; M includes M, HM, SM; S includes S, HS; T includes T and HT;
C includes C and HC.
Description
《Instruction》
S0· S1· S2· D·
M0
PLSR HD0 HD100 K1 Y0
SM1000
RST M0
Waiting condition
Pulse sending end
Jump to the certain segment after executing this segment of pulse.
When the PLSR is triggered by edge, it sends 2000 pulses at 1000Hz, then jump to segment 2.
It will send 4000 pulses at 2000Hz, then jump to segment 3. It will send 6000 pulses at
3000Hz.
frequency
3000
2000
1000
Note: acceleration and deceleration time can be set in the parameter table.
Wait time
Add time delay after current segment finished, and then jump to the certain segment. The
delay time can be constant value, or set in register D, HD. The unit is ms.
The PLSR is triggered by edge. It will send 2000 pulses at 1000Hz, then wait 200ms. Then it
will send 4000 pulses at 2000Hz, then wait the time D100. Then it will send 6000 pulses at
3000Hz.
frequency
3000
2000
S=6000
1000 S=4000
S=2000
0
Delay Delay t
200ms D100ms
Note: acceleration and deceleration time can be set in the parameter table.
Wait signal
Wait for the wait signal after current segment finished. Jump to the certain segment when the
signal arrives. The wait signal can be X, M, HM.
The PLSR is triggered by edge. It will send 2000 pulses at 1000Hz. Then it will send 4000
pulses at 2000Hz when M10 from OFF to ON. Then it will send 6000 pulses at 3000Hz when
X2 from OFF to ON.
Frequency
3000
2000
S=6000
1000 S=4000
S=2000
0 t
M10
X2
Note:
1. acceleration and deceleration time can be set in the parameter table.
2. the wait signal is from OFF to ON, but the present segment pulse is still sending, it will
jump to the next segment when the present pulse sending completed.
frequency
3000
2000
S=6000
1000 S=4000
S=2000
0
t
M10
X2
3. if the wait signal is not ON when the present pulses sending completed, it will not jump to
the next segment until the wait signal is ON.
ACT time
Pulse sending for the ACT time, it will jump to the certain segment when the ACT time end.
ACT time can be constant value or set in register D, HD, FD. The unit is ms.
The PLSR is triggered by edge. It will send 2000 pulses at 1000Hz for 1200ms. Then it will
send 4000 pulses at 2000Hz for D100 time. Then it will send 6000 pulses at 3000Hz.
frequency
3000
2000
1000
0 ms
1200 1000 t
Note:
1. acceleration and deceleration time can be set in the parameter table.
2. if the ACT time is short, the pulse is in accelerating. It will accelerate to next segment at
the ACT time end point. The same to the third segment pulses.
frequency
3000
2000
1000
ms
0 t2
t1 t
3. if the ACT time is long, the pulse is in decelerating. It will accelerate to the next segment at
the ACT time end point. The same to the third segment pulse.
frequency
3000
2000
1000
ms
0
t1 t2
t
4. if the ACT time is too long, the pulse sending completed but the ACT time has not
finished, it will start the next segment when the ACT time finishes.
frequency
3000
2000
1000
ms
0 t
t1 t2
EXT signal
If EXT signal is activated (OFF to ON) when pulse is outputting,it will jump to the certain
segment. If EXT signal is not activated when the pulse output finished, it will continue
waiting the EXT signal. The EXT signal input is X (if the X is external interruption terminal,
the response will faster).
The PLSR is triggered by edge. It will send 2000 pulses at 1000Hz. Then it will send 4000
pulses at 2000Hz when X0 is ON. Then it will send 6000 pulses at 3000Hz when X1 is ON.
Then the pulse will deceleration stop when the X2 is ON.
frequency
3000
2000
1000
ms
0
t
X0
X1
X2
Note:
1. acceleration and deceleration time can be set in the parameter table.
2. if the EXT signal comes early, the pulse is in accelerating, it will accelerate to the next
segment at the EXT activated position, the same to the third segment.
frequency
3000
2000
1000
ms
0
t
X0
X1
X2
3. if the EXT signal comes too late, the present pulse already completed sending. It will go to
the next segment when the EXT signal activate.
frequency
3000
2000
1000
ms
0
t
X0
X1
4. if the EXT signal comes too late, the pulse is in decelerating, it will accelerate to the next
segment at the EXT signal activated position, the same to the third segment.
frequency
3000
2000
1000
ms
0
t
X0
X1
For example:
There are three segments of pulse. The first segment is 1000Hz, 2000 pulses; the second is
2000Hz, 4000 pulses; the third is 3000Hz, 6000 pulses.
Relative mode:
Absolute mode:
*2 To set the start execution segment. It will start from the first segment when it is set to 0 or
1.
For example:
There are three segments of pulse. The first segment is 1000Hz, 2000 pulses; the second is
2000Hz, 4000 pulses; the third is 3000Hz, 6000 pulses. The start execute section count is 2.
So the pulse will start from segment 2.
System parameters
User can set which group of parameters to use for the pulse. Each channel of pulse has 4
groups of parameters. each group of parameters include pulse speed, acceleration/deceleration
time, max speed, start speed, end speed. PLSR can choose the suitable parameters to send the
pulse.
Each channel pulse output has system parameters and 4 groups of parameters, user needs to
set which group of parameter to use in pulse instruction S2- (constant, D, HD, FD).
Note: the following table is system parameters of frist channel of pulse (Y0). Other pulse
channel parameters please refer to appendix 3.
Bit 0: pulse output logic
0: positive logic(default
setting)
1: negative logic,
Bit 1:pulse direction
logic
SFD900 Pulse parameters 0: positive logic(default
setting) 1: negative
logic
Bit 8: pulse unit
0: pulse quantity(default
setting) 1: equivalent
value
SFD901 Reserved
Pulse quantity/ 1
SFD902
rotation low 16 bits
PULSE_1
Pulse quantity/ 1
SFD903
rotation high 16 bits
Movement amount/1
SFD904
rotation low 16 bits
Movement amount/1
SFD905 Public
rotation high 16 bits
The number of Y, 0xFF parameter
SFD906 Pulse direction terminal
is no terminal
Default value is 20, unit
SFD907 Direction delay time
is ms
Gear clearance positive
SFD908
compensation
Gear clearance negative
SFD909
compensation
Electrical origin low 16
SFD910
bits
Electrical origin high 16
SFD911
bits
Bit0: promixity switch
Machine back to origin state
SFD912
parameters 0: normal open 1:
normal close
Bit0~bit7: the X
SFD913 Near signal terminal terminal number, 0xFF
is no terminal
Bit0~bit7: the X
SFD914 Z phase terminal terminal number, 0xFF
is no terminal
Bit7~bit0: limit 1 X
terminal number, 0xFF
is no terminal
SFD915 Limit terminal
Bit15~bit8: limit 2 X
terminal number, 0xFF
is no terminal
Bit0~bit7: X terminal
Origin auxiliary signal
SFD916 number, 0xFF is no
terminal
terminal
Bit0~bit7: Y terminal
CLR signal output
SFD917 number, 0xFF is no
terminal
terminal
Back speed VH low 16
SFD918
bits
Back speed VH high 16
SFD919
bits
Back speed VL low 16
SFD920
bits
Back speed VL high 16
SFD921
bits
SFD922 Creep speed low 16 bits
SFD923 Creep speed high 16 bits
Mechanical origin low
SFD924
16 bits
Mechanical origin high
SFD925
16 bits
SFD926 Z phase quantity
Default value 20, unit:
SFD927 CLR signal delay time
ms
G instruction which
G instruction parameter
SFD936 group of parameter
group choice
choice
…
Pulse default speed low
SFD950
16 bits Send pulse with default
Pulse default speed high speed when speed is 0 Group 1
SFD951
16 bits parameters
Pulse default speed
SFD952
acceleration time
Pulse default speed
SFD953
deceleration time
Tween
SFD954 acceleration/deceleration
time
SFD955 Reserved
Max speed limit low 16
SFD956
bits
Max speed limit high 16
SFD957
bits
SFD958 Start speed low 16 bits
SFD959 Start speed high 16 bits
SFD960 End speed low 16 bits
SFD961 End speed high 16 bits
Curve acceleration time
SFD962
(ms)
…
Pulse default speed low
SFD970
16 bits Send pulse with default
Pulse default speed high speed when speed is 0
SFD971
16 bits
Pulse default speed
SFD972
acceleration time
Pulse default speed
SFD973
deceleration time
Tween
SFD974 acceleration/deceleration
time
SFD975 Reserved Group 2
parameters
Max speed limit low 16
SFD976
bits
Max speed limit high 16
SFD977
bits
SFD978 Start speed low 16 bits
SFD979 Start speed high 16 bits
SFD980 End speed low 16 bits
SFD981 End speed high 16 bits
Curve acceleration time
SFD982
(ms)
…
Pulse default speed low
SFD990
16 bits Send pulse with default
Pulse default speed high speed when speed is 0
SFD991
16 bits
Pulse default speed
SFD992
acceleration time Group 3
Pulse default speed parameters
SFD993
deceleration time
Tween
SFD994 acceleration/deceleration
time
SFD995 Reserved
Max speed limit low 16
SFD996
bits
Max speed limit high 16
SFD997
bits
SFD998 Start speed low 16 bits
SFD999 Start speed high 16 bits
SFD1000 End speed low 16 bits
SFD1001 End speed high 16 bits
Curve acceleration time
SFD1002
(ms)
…
Pulse default speed low
SFD1010
16 bits Send pulse with default
Pulse default speed high speed when speed is 0
SFD1011
16 bits
Pulse default speed
SFD1012
acceleration time
Pulse default speed
SFD1013
deceleration time
Tween
SFD1014 acceleration/deceleration
time
SFD1015 Reserved Group 4
Max speed limit low 16 parameters
SFD1016
bits
Max speed limit high 16
SFD1017
bits
SFD1018 Start speed low 16 bits
SFD1019 Start speed high 16 bits
SFD1020 End speed low 16 bits
SFD1021 End speed high 16 bits
Curve acceleration time
SFD1022
(ms)
…
Public parameters
Pulse parameter setting----pulse output logic
Pulse output logic contains positive logic and negative logic.
Positive logic: pulse numbers set to positive value, send pulse in positive direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps increasing), pulse direction
terminal is ON. Pulse numbers set to negative value, send pulse in reverse direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps decreasing), pulse
direction terminal is OFF.
Negative logic: pulse numbers set to positive value, send pulse in reverse direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps decreasing), pulse
direction terminal is OFF. Pulse numbers set to negative value, send pulse in positive
direction (for example Y0 axis accumulated pulse numbers register HSD0 keeps increasing),
pulse direction terminal is ON.
Pulse parameters setting ---- pulse direction logic
Pulse direction logic contains positive logic and negative logic.
Positive logic: pulse numbers set to positive value, send pulse in positive direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps increasing), pulse direction
terminal is ON. Pulse numbers set to negative value, send pulse in reverse direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps decreasing), pulse
direction terminal is OFF.
Negative logic: pulse numbers set to positive value, send pulse in positive direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps increasing), pulse direction
terminal is OFF. Pulse numbers set to negative value, send pulse in reverse direction (for
example Y0 axis accumulated pulse numbers register HSD0 keeps decreasing), pulse
direction terminal is ON.
Note: the pulse direction will be ON when the pulse is sending, but the terminal will not be
OFF after pulse sending end. When the pulse sends next time, it will auto-change the
direction terminal state. If the pulse has no direction next time, please reset the direction
terminal by manual.
There are 3 segments in the pulse configure table. for example, the second segment will send
4000 pulses with the frequency of 2000Hz.
Equivalent: it calculates the pulse frequency and equivalent as the length unit. Please know
the public pararmeter pulse number (one rotation) and movement (one rotation) before
knowing the equivalent.
Public parameter ---- pulse number (one rotation)
The pulse numbers of transmission gear running one rotation. If there is reducing mechanism,
the motor running one rotation doesn’t mean the transmission gear running one rotation.
For example, the servo motor drives the lead screw through reducing mechanism. The servo
drive is DS2-20P7-AS, the motor is MS-80ST-M02430□□-20P7 (encoder 2500 ppr), the
servo drive electronic gear ratio is 1:1, the reducing ratio of reducing mechanism is 1:5, the
pitch of screw is 5mm.
5
50000 = 2500 * 4 *
1
Public parameter ---- movement (one rotation)
The movement amounts of transmission mechanism running one rotation drives the object
movement. For example, the lead screw means the screw pitch is 5mm, if it uses synchronous
belt, the movement amounts is the circumference of synchronous belt transmission
mechanism.
The following we will explain how to set the equivalent. We use the above mechanical
structure to send 3 segments of pulse. The pulse configuration table is:
There are 3 segments in the table (equivalent). For example, the second segment is moving
30mm with the speed 15mm/s. The public parameters are as the following.
The equivalent transforms to the corresponding frequency and pulse numbers:
No. Type Frequency/speed Pulse
number/length
Equivalent 10mm/s 20mm
1 Pulse 100000pulse/s 200000 pulse
number
Equivalent 15mm/s 30mm
2 Pulse 150000pulse/s 300000 pulse
number
Equivalent 20mm/s 40mm
3 Pulse 200000pulse/s 400000 pulse
number
Note:
1. when it sets to pulse number, Y0 pulse accumulated register HSD0(double words) shows
the pulse number, when it sets to equivalent, Y0 pulse accumulated register HSD0(double
words) shows the pulse number, accumulated register HSD2 (double words) shows the
accumulated equivalent lengths.
2. when it sets to equivalent, all other related parameters will run as equivalent; the equivalent
length unit depends on the public parameter movement (one rotation). For example,
movement (one rotation) is 6, the unit is mm, so other related length unit and speed unit are
mm or mm/s.
3. when the setting is equivalent, please note that the frequency cannot over 200KHz.
As the Y0 and Y1 terminal is high-speed optical coupler, and other terminal is normal optical
coupler or relay output. The direction outputting will behind the pulse outputting. The
direction terminal will be activated ahead and delay some time, then the pulse will output.
This will avoid pulse output error caused by direction terminal lagging.
The default delay time is 10ms. Please adjust the time according to the direction terminal
type. The delay time from short to long is Y0 and Y1, transistor output, relay output.
Reducing
servo motor Mechanism
The working table moves from right to left. The working table will stop when its left side
reaching the postion A. Then it moves from A to right. As the ball screw clearance, the
working table will not move right with the beginning pulses. This will decrease the actual
moving right distance. Without the ball screw clearance, the beginning pulses will make the
working table moving from position A to B. To solve the problem, it needs to send some
more pulses before sending the required moving right pulses.
F
Gear clearance positive
compensation
0 t
Note:
1. the gear clearance positive compensation will work when the pulse direction of present
segment and last segment is opposite.
2. the gear clearance positive compensation and moving right pulses must send in different
pulse segment.
3. the pulses of gear clearance positive compensation will not be accumulated in the pulse
accumulated register. (Y0 register is HSD0)
Reducing
Servo motor
mechanism
The working table moves from left to right. The working table will stop when its right side
reaching the postion A. Then it moves from A to left. As the ball screw clearance, the
working table will not move left with the beginning pulses. This will decrease the actual
moving left distance. Without the ball screw clearance, the beginning pulses will make the
working table moving from position A to B. To solve the problem, it needs to send some
more pulses before sending the required moving left pulses.
0 t
Moving left pulses
f
Gear clearance negative
compensation
Note:
1. the gear clearance negative compensation will work when the pulse direction of present
segment and last segment is opposite.
2. the gear clearance negative compensation and moving left pulses must send in different
pulse segment.
3. the pulses of gear clearance negative compensation will not be accumulated in the pulse
accumulated register. (Y0 register is HSD0)
Normally OFF: The mechanical origin switch state is always OFF when returning to
mechanical origin. When it touches the mechanical origin switch, the state will be ON.
Normally ON: The mechanical origin switch state is always ON when returning to
mechanical origin. When it touches the mechanical origin switch, the state will be OFF.
Note: this function only fit for mechanical back to origin instruction ZRN.
Note:
1. the input ID cannot over the real PLC input terminal range.
2. this function is only fit for mechanical back to origin instruction ZRN.
Note: this function is only fit for mechanical back to origin instruction ZRN.
Pulse public parameter ---- limit 1 terminal setting and limit 2 terminal setting
When backing to the mechanical origin, add protection terminal (such as travel switch) at
both sides of the trip to avoid the working table out of the trip range.
Note:
1. the input ID cannot over the real PLC input terminal range.
2. this function is only fit for mechanical back to origin instruction ZRN.
Pulse public parameter ---- origin auxiliary signal X terminal setting
The auxiliary input terminal helps to get the high precision when backing to the mechanical
origin.
When the working table is far away from the origin, the ZRN instruction will approach the
origin with fast returning speed VH. When the working table closes to the origin, it can
switch the speed VH to VL by origin auxiliary signal. It can make the working table touching
the origin with slow speed VL.
Note:
1. the input ID cannot over the real PLC input terminal range.
2. this function is only fit for mechanical back to origin instruction ZRN.
Pulse public parameter ---- zero clear CLR output terminal setting and CLR signal
delay time
zero clear CLR output terminal setting : It outputs a signal when returning the mechanical
origin end. This signal can be sent to other control device. For example, it outputs CLR signal
to servo drive in order to clear the servo motor Error Counter when returning the mechanical
origin end. Finally it copies the mechanical origin position to present position. Now the
flyback action finished.
CLR signal delay time: the CLR signal delay time after returning mechanical origin end.
The unit is ms, the range is 0~32767.
This function is only fit for mechanical back to origin instruction ZRN.
This function is only fit for mechanical back to origin instruction ZRN.
Pulse public parameter ---- return speed VL
When it executes the ZRN instruction, the working table touches the origin auxiliary signal
with return speed VH, then it decelerates to return speed VL in order to improve the back to
mechanical origin precision.
This function is only fit for mechanical back to origin instruction ZRN.
This function is only fit for mechanical back to origin instruction ZRN.
This function is only fit for mechanical back to origin instruction ZRN.
Example 1: the pulse unit is pulse number, pulse default speed is 1000, pulse default
acceleration time is 100ms, pulse default deceleration time is 200ms. It means when the pulse
instruction is in acceleration stage, it costs 100ms when the pulse frequency increases1000Hz.
When the pulse instruction is in deceleration stage, it costs 200ms when the pulse frequency
decreases 1000Hz. If it accelerates from 0Hz to 5000Hz, the acceleration time is
5000Hz/1000Hz*100ms=500ms. If it decelerates from 5000Hz to 0Hz, the deceleration time
is 5000Hz/1000Hz*200ms=1000ms.
Example 2: the pulse unit is equivalent, the equivalent unit is mm. pulse default speed is 10,
pulse default acceleration time is 100ms, pulse default deceleration time is 200ms. It means
when the pulse instruction is in acceleration stage, it costs 100ms when the pulse frequency
increases10mm/s. When the pulse instruction is in deceleration stage, it costs 200ms when the
pulse frequency decreases 10mm/s. If it accelerates from 0Hz to 50mm/s, the acceleration
time is 50mm/s/10mm/s*100ms=500ms, If it decelerates from 50mm/s to 0Hz, the
deceleration time is 50mm/s/10mm/s*200ms =1000ms.
Note: the three parameters define the slope of deceleration and acceleration time. Each
segment pulse will run as the slope.
First group of parameter ---- clearance compensation acceleration and deceleration time
The acceleration and deceleration time of gear clearance positive compensation and gear
clearance negative compensation. The acceleration and deceleration time is the same, they
are clearance compensation acceleration and deceleration time whatever the setting
clearance compensation is, the unit is ms.
F
Gear clearance positive
compensation
0 Clearance compensation t
acceleration and deceleration time
Clearance compensation
F acceleration and deceleration
time
0 t
Moving left pulse segment
f
Gear clearance negative
compensation
Note:
1. The max speed unit is pulse number/second, this will not change as the pulse unit (pulse
number or equivalent)
2. XD3 series PLC max output frequency is 200KHz. The max speed cannot over this value.
3. When the pulse unit is equivalent, the transformed pulse output frequency maybe too large
and over the max speed, please pay attention.
4. make sure to set the max speed when using the pulse output instruction. Otherwise the
pulse output instruction cannot work.
For example, the pulse number is 30000, start speed is 1000Hz, it costs 100ms to reach
5000Hz, it costs 50ms to decelerate to 2000Hz. The configuration table is as below:
5000
2000
1000
0 t
Curve S2 Curve S3
Line L1 Line L2
Curve S1 Curve S4
0 t
t1 t2 t3 t4
curve acceleration time=t1+t2, t1=t2; curve deceleration time=t3+t4, t3=t4. If the acceleration
and deceleration time is t, t1+ t2=t= t3+t4, acceleration curve is formed by S1 and S2,
deceleration curve is formed by S3 and S4.
Note:
1. when using the curve acceleration time, please keep the same of pulse default speed and
pulse max speed; keep the same of pulse default acceleration time, pulse default deceleration
time and curve acceleration time.
2. curve acceleration time is only fit for single segment pulse, but not fit for multi-segment S
curve switching.
Example 1: configure 8 pulse segments and run from segment 1. The pulse output terminal is
Y0. The interruption is shown as below:
0 t
I6000 I6001 I6002 I6003 I6004 I6005 I6006 I6007
Example 2: configure 6 pulse segments, the pulse output terminal is Y0, but it is not
continuous sending.
As the above pulse configure table, the PLSR pulse sending order is segment 1, 3, 5, 2, 6, 4.
The corresponding interruptions are I6000, I6002, I6004, I6001, I6005, I6003.
F
6000
6000
5000
5000
4000 4000
3000
3000
2000 2000
1000
1000
0 t
I6000 I6002 I6004 I6001 I6005 I6003
Note: the interruption program is the same to external interruption program
Main program
FEND
I6000
SM0
DINC D0
IRET
END
Pulse monitoring coil and register
Pulse sending flag
No. Coil Axis no. Explanation
7 SM1120 PULSE_7
SM1000
8 SM1140 PULSE_8
9 SM1160 PULSE_9
10 SM1180 PULSE_10
4 SM1061 PULSE_4
5 SM1081 PULSE_5
6 SM1101 PULSE_6
7 SM1121 PULSE_7
8 SM1141 PULSE_8
9 SM1161 PULSE_9
10 SM1181 PULSE_10
Instruction mode
f
f2
50000
f1
10000
f3
3000
20000 60000 5000 Ut
Application
The following curves are set when the curve acceleration time is 0.
1. multi-segment pulse output
Pulse segment
If user changes the current pulse frequency, it will get to the target frequency with the slope.
If user changes the current frequency, PLC will send pulse as the new pulse wave.
Application 1
There are 3 pulse segments. Pulse channel is Y0. Pulse direction channel is Y2. All the
parameters please see below tables.
Name Frequency (Hz) Pulse amounts
Segment 1 1000 2000
Segment 2 200 1000
Segment 3 2000 6000
Acceleration/deceleration Frequency changes 1000Hz every 100ms
Public parameters
Bit 0: pulse output logic
0: positive logic(default setting)
1: negative logic,
Bit 1:pulse direction logic
SFD900 Pulse parameters 0: positive logic(default setting) 0
1: negative logic
Bit 8: pulse unit
0: pulse quantity(default setting)
1: equivalent value
SFD901 Reserved
Pulse quantity/ 1
SFD902 0
rotation low 16 bits
Pulse quantity/ 1
SFD903 0
rotation high 16 bits
Movement amount/1
SFD904 0
rotation low 16 bits
Movement amount/1
SFD905 0
rotation high 16 bits
Pulse direction The number of Y, 0xFF is no
SFD906 2
terminal terminal
SFD907 Direction delay time Default value is 20, unit is ms 20
Gear clearance
SFD908 0
positive compensation
Gear clearance
SFD909 0
negative compensation
Electrical origin low
SFD910 0
16 bits
Electrical origin high
SFD911 0
16 bits
Machine back to Bit0: promixity switch state
SFD912 0
origin parameters 0: normal open 1: normal close
Bit0~bit7: the X terminal number,
SFD913 Near signal terminal 0xFF
0xFF is no terminal
Bit0~bit7: the X terminal number,
SFD914 Z phase terminal 0xFF
0xFF is no terminal
Bit7~bit0: limit 1 X terminal
number, 0xFF is no terminal
SFD915 Limit terminal FFFF
Bit15~bit8: limit 2 X terminal
number, 0xFF is no terminal
Origin auxiliary signal Bit0~bit7: X terminal number,
SFD916 0xFF
terminal 0xFF is no terminal
CLR signal output Bit0~bit7: Y terminal number,
SFD917 0xFF
terminal 0xFF is no terminal
Back speed VH low 16
SFD918 0
bits
Back speed VH high
SFD919 0
16 bits
Back speed VL low 16
SFD920 0
bits
Back speed VL high
SFD921 0
16 bits
Creep speed low 16
SFD922 0
bits
Creep speed high 16
SFD923 0
bits
Mechanical origin low
SFD924 0
16 bits
Mechanical origin
SFD925 0
high 16 bits
SFD926 Z phase quantity 0
SFD927 CLR signal delay time Default value 20, unit: ms 20
G instruction which
G instruction system parameter
SFD936 group of parameter 2
group choice
choice
…
Group 1 parameters
Pulse default speed
SFD950 1000
low 16 bits Send pulse with default speed
Pulse default speed when speed is 0
SFD951 0
high 16 bits
Pulse default speed
SFD952 100
acceleration time
Pulse default speed
SFD953 100
deceleration time
Tween 0
SFD954 acceleration/decelerati
on time
SFD955 Reserved
Max speed limit low 3392
SFD956
16 bits
Max speed limit high 3
SFD957
16 bits
SFD958 Start speed low 16 bits 0
Start speed high 16 0
SFD959
bits
SFD960 End speed low 16 bits 0
SFD961 End speed high 16 bits 0
Curve acceleration 0
SFD962
time (ms)
…
Pulse instruction
M0
PLSR HD0 HD100 K1 Y0
SM1000
RST M0
frequency
2000
1000
200
0 t
Application 2
Working
origin A(X0) B(X1) C(X2)
As the above diagram, there are three segments. The distance between A, B, C is unknown.
The distance of A-B, B-C, working oring-A are the same, but the moving speed is different.
The instruction PLSR can make the function. Fisrt, install three proximity switches at A, B,
C. then connect them to PLC terminal X0, X1, X2. Pulse output terminal is Y0, pulse
direction terminal is Y2. All the parameters please refer to the following table.
Name Frequency (Hz) Pulse amounts
Working origin-A 1000 999999999
A-B 3000 999999999
B-C 2000 999999999
Acceleration deceleration time Frequency changes 1000Hz every
100ms
Note: as the pulse amounts of each segment is unknown, set a large value to make sure the
object can move to the proximity switch. When the object reaches C, urgent stops the object
with STOP instruction.
Public parameter
Bit 0: pulse output logic
0: positive logic(default setting)
1: negative logic,
Bit 1:pulse direction logic
SFD900
Pulse parameters 0: positive logic(default setting) 0
1: negative logic
Bit 8: pulse unit
0: pulse quantity(default setting)
1: equivalent value
SFD901 Reserved
Pulse quantity/ 1
SFD902 0
rotation low 16 bits
Pulse quantity/ 1
SFD903 0
rotation high 16 bits
Movement amount/1
SFD904 0
rotation low 16 bits
Movement amount/1
SFD905 0
rotation high 16 bits
Pulse direction The number of Y, 0xFF is no
SFD906 2
terminal terminal
SFD907 Direction delay time Default value is 20, unit is ms 20
Gear clearance
SFD908 0
positive compensation
Gear clearance
SFD909 negative 0
compensation
Electrical origin low
SFD910 0
16 bits
Electrical origin high
SFD911 0
16 bits
Machine back to Bit0: promixity switch state
SFD912 0
origin parameters 0: normal open 1: normal close
Bit0~bit7: the X terminal number,
SFD913 Near signal terminal 0xFF
0xFF is no terminal
Bit0~bit7: the X terminal number,
SFD914 Z phase terminal 0xFF
0xFF is no terminal
Bit7~bit0: limit 1 X terminal
number, 0xFF is no terminal
SFD915 Limit terminal FFFF
Bit15~bit8: limit 2 X terminal
number, 0xFF is no terminal
Origin auxiliary signal Bit0~bit7: X terminal number,
SFD916 0xFF
terminal 0xFF is no terminal
CLR signal output Bit0~bit7: Y terminal number,
SFD917 0xFF
terminal 0xFF is no terminal
Back speed VH low
SFD918 0
16 bits
Back speed VH high
SFD919 0
16 bits
Back speed VL low
SFD920 0
16 bits
Back speed VL high
SFD921 0
16 bits
Creep speed low 16
SFD922 0
bits
Creep speed high 16
SFD923 0
bits
Mechanical origin low
SFD924 0
16 bits
Mechanical origin
SFD925 0
high 16 bits
SFD926 Z phase quantity 0
SFD927 CLR signal delay time Default value 20, unit: ms 20
G instruction which
G instruction system parameter
SFD936 group of parameter to 2
group choice
use
…
Group 1 parameters
Pulse default speed
SFD950 1000
low 16 bits Send pulse with default speed
Pulse default speed when speed is 0
SFD951 0
high 16 bits
Pulse default speed
SFD952 100
acceleration time
Pulse default speed
SFD953 100
deceleration time
Tween 0
SFD954 acceleration/decelerati
on time
SFD955 Reserved
Max speed limit low 3392
SFD956
16 bits
Max speed limit high 3
SFD957
16 bits
Start speed low 16 0
SFD958
bits
Start speed high 16 0
SFD959
bits
SFD960 End speed low 16 bits 0
End speed high 16 0
SFD961
bits
Curve acceleration 0
SFD962
time (ms)
…
Pulse instruction:
M0
PLSR HD0 HD100 K1 Y0
SM1000
RST M0
X2
STOP Y0 K1
Pulse configuration
Pulse wave form:
M0
Frequency f
3000Hz
2000Hz
1000Hz
Application 3
There are four segments. Segment 1 frequency is 2000Hz, 3000 pulses, it delays 100ms after
segment 1 then goes to segment 2. Segment 2 frequency is 2800Hz, pulse number is 4000.
When M100 coil is ON, it goes to segment 3. Segment 3 frequency is 1200Hz, pulse number
is 999999999, it delays ACT time 2s then goes to segment 4. Segment 4 frequency is 3000Hz,
pulse numbers are 999999999, it deceleration stops the pulse when X2 is ON. The pulse
acceleration slope is 80ms every 1000Hz, pulse deceleration slope is 120ms every 1000Hz.
Pulse direction terminal is Y2.
F
3000
2800
2000
1200
0 Delay ACT t
100ms delay
time
M100
Relative mode
Absolute mode
Application 4
There is a servo drive (electronic gear ratio is 1:1) and servo motor (encoder 2500ppr), the
reducing ratio of reducer is 1:2. The pitch of ball screw is 10mm, the ball screw drives the
working table which can moving left and right. It needs to move the working table from left
to right by 200mm, then reverse move 200mm, the speed is 20mm/s, acceleration time is
100ms, the deceleration time is 200ms. Pulse direction terminal is Y2. The mechanical
structure is shown as below:
Load shaft Pitch: 5mm
Servo reduc
motor er
t1=100ms
t2=200ms
20mm/s
t1 t2
0 t2 t
t1
20mm/s
Calculation:
Relative mode
Absolute mode
System parameters
Method 2: set via pulse data reigsters
Pulse data register table (relative mode)
Address Explanation Value
HD0 (dword) Pulse segment quantity (1~100) 2
HD2 (8 Reserved (8 words)
0
words)
HD10 (dword) Pulse frequency (segment 1) 20
HD12 (dword) Pulse quantity (segment 1) 200
bit15~bit8: wait condition (segment 1)
00: pulse sending end
01: wait time
02: wait signal
03: ACT time
04: EXT signal
HD14 0
05: EXT signal or pulse sending end
bit7~bit0: wait condition register type
00: constant
01: D
02: X
03: M
HD15 (dword) Constant/register(waiting condition) (segment 1) 0
bit7~bit0: jump register type
HD17 00: constant 0
01: D
HD+18 Constant/register (jump register) (segment 1)
0
(dword)
HD+20 Pulse frequency (segment 2)
20
(dword)
HD+22 Pulse quantity (segment 2) -200
(dword)
Wait condition, wait condition register type
HD+24 0
(segment 2)
HD+25 Constant or register (waiting condition) (segment 2)
0
(dword)
Jump type, jump register type (waiting condition)
HD+27 0
(segment 2)
HD+28 Constant or register (jump register) (segment 2)
0
(dword)
Public parameter
Bit 0: pulse output logic
0: positive logic(default setting)
1: negative logic,
Bit 1:pulse direction logic
SFD900
Pulse parameters 0: positive logic(default setting) 256
1: negative logic
Bit 8: pulse unit
0: pulse quantity(default setting)
1: equivalent value
SFD901 Reserved 0
Pulse quantity/ 1
SFD902 20000
rotation low 16 bits
Pulse quantity/ 1
SFD903 0
rotation high 16 bits
Movement amount/1
SFD904 10
rotation low 16 bits
Movement amount/1
SFD905 0
rotation high 16 bits
Pulse direction The number of Y, 0xFF is no
SFD906 2
terminal terminal
SFD907 Direction delay time Default value is 20, unit is ms 10
Gear clearance
SFD908 0
positive compensation
Gear clearance
SFD909 negative 0
compensation
Electrical origin low
SFD910 0
16 bits
Electrical origin high
SFD911 0
16 bits
Machine back to Bit0: promixity switch state
SFD912 0
origin parameters 0: normal open 1: normal close
Bit0~bit7: the X terminal
SFD913 Near signal terminal 0xFF
number, 0xFF is no terminal
Bit0~bit7: the X terminal
SFD914 Z phase terminal 0xFF
number, 0xFF is no terminal
Bit7~bit0: limit 1 X terminal
number, 0xFF is no terminal
SFD915 Limit terminal FFFF
Bit15~bit8: limit 2 X terminal
number, 0xFF is no terminal
Origin auxiliary signal Bit0~bit7: X terminal number,
SFD916 0xFF
terminal 0xFF is no terminal
CLR signal output Bit0~bit7: Y terminal number,
SFD917 0xFF
terminal 0xFF is no terminal
Back speed VH low
SFD918 0
16 bits
Back speed VH high
SFD919 0
16 bits
Back speed VL low
SFD920 0
16 bits
Back speed VL high
SFD921 0
16 bits
Creep speed low 16
SFD922 0
bits
Creep speed high 16
SFD923 0
bits
Mechanical origin low
SFD924 0
16 bits
Mechanical origin
SFD925 0
high 16 bits
SFD926 Z phase quantity 0
SFD927 CLR signal delay time Default value 20, unit: ms 20
G instruction which
G instruction system parameter
SFD936 group of parameter to 2
group choice
use
…
Group 1 parameters
Pulse default speed
SFD950
low 16 bits Send pulse with default speed
40000
Pulse default speed when speed is 0
SFD951
high 16 bits
Pulse default speed
SFD952 100
acceleration time
Pulse default speed
SFD953 200
deceleration time
Tween 0
SFD954 acceleration/decelerati
on time
SFD955 Reserved 0
Max speed limit low 3392
SFD956
16 bits
Max speed limit high 3
SFD957
16 bits
Start speed low 16 0
SFD958
bits
Start speed high 16 0
SFD959
bits
SFD960 End speed low 16 bits 0
End speed high 16 0
SFD961
bits
Curve acceleration 0
SFD962
time (ms)
…
例5
There is a servo drive (electronic gear ratio is 1:1) and servo motor (encoder is 2500 ppr). The
reducing ratio of reducer is 1:2. The pitch of ball screw is 5mm, the ball screw drives the
working table which can move left and right. The working table will move back and forth
between A and B. the distance between A and B is 200mm. the speed from A to B is
200mm/s, the speed from B to A is 30mm/s. the acceleration time is 100ms, the deceleration
time is 200ms. The ABA route mechanical clearance error is 3mm, BAB route
mechanical clearance error is 2mm. the pulse direction terminal is Y2.
Load shaft
Servo reduc
motor er
A B
F t1=100ms
t2=200ms
t3=30ms
20mm/s
t3 t1 t2
0 t1 t2 t3 t
30mm/s
Calculation:
The acceleration time and deceleration time is same, but the max frequency is different, so the
acceleration and deceleration slope is different.
Forward direction acceleration slope: it changes 80000Hz every 100ms
Forward direction deceleration slope: it changes 80000Hz every 200ms
Reverse direction acceleration slope: it changes 120000Hz every 100ms
Reverse direction deceleration slope: it changes 120000Hz every 200ms
It needs two groups of parameters as there are two groups of acceleration and deceleration
[Link] max frequency is 40KHz/s and 120KHz/s, they are less than 200KHz/s. So they can
run normally.
Pulse instruction:
M0
PLSR HD0 HD100 D0 Y0
SM1000
SM1000
D0 K1 MOV K2 D0
D0 K2 MOV K1 D0
Relative mode
Absolute mode
System parameter (relative mode)
Method 2: set via pulse register
Pulse data address table (relative mode)
Address Explanation Value
HD0 (dword) Pulse segment quantity (1~100) 2
HD2 (8 Reserved (8 words)
0
words)
HD10 (dword) Pulse frequency (segment 1) 20
HD12 (dword) Pulse quantity (segment 1) 200
bit15~bit8: wait condition (segment 1)
00: pulse sending end
01: wait time
02: wait signal
03: ACT time
04: EXT signal
HD14 0
05: EXT signal or pulse sending end
bit7~bit0: wait condition register type
00: constant
01: D
02: X
03: M
HD15 (dword) Constant/register(waiting condition) (segment 1) 0
bit7~bit0: jump register type
HD17 00: constant 0
01: D
HD+18 Constant/register (jump register) (segment 1)
0
(dword)
HD+20 Pulse frequency (segment 2)
20
(dword)
HD+22 Pulse quantity (segment 2) -200
(dword)
Wait condition, wait condition register type
HD+24 0
(segment 2)
HD+25 Constant or register (waiting condition) (segment 2)
0
(dword)
Jump type, jump register type (waiting condition)
HD+27 0
(segment 2)
HD+28 Constant or register (jump register) (segment 2)
0
(dword)
Operand
Operand Function Type
S0 Pulse frequency address
S1 System parameters (1~4)
D Pulse output terminal
Operand System
Bit X Y M* S* T* C* Dn.m
D ●
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
《Instruction》
Output mode
V1
User set slope K
V0
User set slope K
User set slope K
The pulse output direction is set through system parameters (refer to the PLSR pulse direction
setting)
The pulse direction is decided by the positive or negative of pulse frequency. Positive pulse
frequency means the pulse direction is positive, negative pulse frequency means the pulse
direction is negative.
When S0 is 0, PLSF stop pulse output
The instruction will adjust the pulse output as the frequency and slope set by user. If user set
the frequency to 0, the current segment frequency will fall to 0 then output as default pulse
speed.
V1
V0
V3
V1
V0
Target frequency V1 Target frequency 0
Target frequency V0
(2) The pulse is not in stable period when the user set new frequency. The pulse will change
to target frequency with set slope (the current set frequency will be considered as target if it is
V1
V0
V2
Target frequency V1 Target frequency 0
Target frequency V2
Target frequency V0
larger than last set frequency. If user set new frequency V1 before the pulse reaches set
frequency V0 (V1>V0), the pulse will change to V1 as the set slope.
(3) The pulse is not in stable period when the user set new frequency. The pulse will change
to target frequency with set slope (current set frequency < last set frequency, current set
frequency < current frequency). The user set new frequency V1 before pulse reaches set
frequency V0 (V1<V0, V1 < current frequency), the pulse will change to V1 with set slope.
V0
V2
Target frequency V2
Example 1
The working table needs to move from the left end to position X10. There are proximity in
the position from X0 to X10.
The speed of each segment please see the following table. Acceleration and deceleration slope
is 100ms every 1000Hz. Pulse direction terminal is Y2.
Segment Speed no. Speed
Left end X0 V0 1000Hz
X0 X1 V1 2000Hz
X1 X2 V2 3000Hz
X2 X3 V3 4000Hz
X3 X4 V4 5000Hz
X4 X5 V5 6000Hz
X5 X6 V6 7000Hz
X6 X7 V7 8000Hz
X7 X10 V8 9000Hz
Motor
V0 V1 V2 V3 V4 V5 V6 V7 V8
X0 X1 X2 X3 X4 X5 X6 X7 X10
F
(Hz) 9000
8000
7000
6000
5000
4000
3000
2000
1000
0
t
X0
X1
X2
X3
X4
X5
X6
X7
X10
Method 1: set the parameters via XDPpro software
SM2
DMOV K1000 HD0
M0
PLSF HD0 K1 Y0
X0
DMOV K2000 HD0
X1
DMOV K3000 HD0
X2
DMOV K4000 HD0
X3
DMOV K5000 HD0
X4
DMOV K6000 HD0
X5
DMOV K7000 HD0
X6
DMOV K8000 HD0
X7
DMOV K9000 HD0
X10 M0
( R )
Method 2: set the parameters via data registers
System parameters
Public parameter
Bit 0: pulse output logic
0: positive logic(default setting)
1: negative logic,
Bit 1:pulse direction logic
SFD900
Pulse parameters 0: positive logic(default setting) 0
1: negative logic
Bit 8: pulse unit
0: pulse quantity(default setting)
1: equivalent value
SFD901 Reserved 0
Pulse quantity/ 1
SFD902 0
rotation low 16 bits
Pulse quantity/ 1
SFD903 0
rotation high 16 bits
Movement amount/1
SFD904 0
rotation low 16 bits
Movement amount/1
SFD905 0
rotation high 16 bits
Pulse direction The number of Y, 0xFF is no
SFD906 2
terminal terminal
SFD907 Direction delay time Default value is 20, unit is ms 10
Gear clearance
SFD908 0
positive compensation
Gear clearance
SFD909 negative 0
compensation
Electrical origin low
SFD910 0
16 bits
Electrical origin high
SFD911 0
16 bits
Machine back to Bit0: promixity switch state
SFD912 0
origin parameters 0: normal open 1: normal close
Bit0~bit7: the X terminal
SFD913 Near signal terminal 0xFF
number, 0xFF is no terminal
Bit0~bit7: the X terminal
SFD914 Z phase terminal 0xFF
number, 0xFF is no terminal
Bit7~bit0: limit 1 X terminal
number, 0xFF is no terminal
SFD915 Limit terminal FFFF
Bit15~bit8: limit 2 X terminal
number, 0xFF is no terminal
Origin auxiliary signal Bit0~bit7: X terminal number,
SFD916 0xFF
terminal 0xFF is no terminal
CLR signal output Bit0~bit7: Y terminal number,
SFD917 0xFF
terminal 0xFF is no terminal
Back speed VH low
SFD918 0
16 bits
Back speed VH high
SFD919 0
16 bits
Back speed VL low
SFD920 0
16 bits
Back speed VL high
SFD921 0
16 bits
Creep speed low 16
SFD922 0
bits
Creep speed high 16
SFD923 0
bits
Mechanical origin low
SFD924 0
16 bits
Mechanical origin
SFD925 0
high 16 bits
SFD926 Z phase quantity 0
SFD927 CLR signal delay time Default value 20, unit: ms 20
G instruction which
G instruction system parameter
SFD936 group of parameter to 2
group choice
use
…
Group 1 parameters
Example 2
The AD module will collect the 0~10V voltage signal, then transform the analog value to
digital value 0~16383 and send to pulse frequency register of PLSF. The PLSF frequency will
change following the analog voltage.
Potentiometer
+ - R
24V
AD
PLC
module
10V
0 t
As the 0~10V signal will be transformed to digital value 0~16383, which means the output
frequency is 0~16383Hz. As the response problem, PLSF acceleration and deceleration time
is 0.
SM0
MOV ID10000 D0
DMOV D0 HD0
M0
PLSF HD0 K1 Y0
operands System
Bit X Y M* S* T* C* Dn.m
D ●
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
《Instruction form》
Its system parameters block is the same with PLSR, please refer to PLSR system parameters
block.
S· D
M0
ZRN K1 Y0
Action description:
(1) Accelerate to speed VH with slope K in origin return direction.
(2) Decelerate to VL with slope K when encountering origin auxiliary signal.
(3) Decelerate to 0 with slope K when touching the origin.
(4) Delay(direction delay in SFD), accelerate to crawl speed with slope K, and stop action
once leaving the origin; Output clear signal immediately and delay if ‘zero return CLR signal’
is set.(CLR signal delay in SFD can use ‘zero return CLR signal’ output to clear Error
Counter of servo motor), then copy mechanical origin to the current position, zero return is
finished.
Note: (some special occasions)
Decelerate to 0 with slope K immediately if it reaches the origin during the process that ZRN
start to accelerate; delay(direction delay in SFD), then accelerate to VH with slope K,
output clear signal immediately and delay(CLR signal delay in SFD can use ‘zero return
CLR signal’ output to clear Error Counter of servo motor)if ‘zero return CLR signal’ is set,
then copy mechanical origin to the current position, zero return is finished.
Decelerate with slope K when encountering origin signal, as mechanical origin structure is
short, it may haven’t slowed down to 0 when passes the origin, it will still decelerate to 0;
After delay(Direction delay in SFD), accelerate to VH with slope K backwards, the
moment it leaves origin (near point sensing signal 1→0), output clear signal immediately and
delay if ‘zero return CLR signal’ is set.(CLR signal delay in SFD can use ‘zero return CLR
signal’ output to clear Error Counter of servo motor), then copy mechanical origin to current
position, zero return is finished.
Action description:
(1) Accelerate to speed VH with slope K and in origin return direction.
(2) Decelerate to VL with slope K when encountering origin auxiliary signal.
(3) Decelerate to 0 with slope K when encountering origin signal.
(4) Delay(direction delay in SFD), and accelerate to crawl speed backwards with
acceleration time slope. The moment it leaves origin signal, Z phase input signal starts to
count.
(5) Stop action when Z phase signal counter reaches the set value. Output clear signal and
delay if ‘zero return CLR signal’ is set. (CLR signal delay in SFD can use ‘zero return CLR
signal’ output to clear Error Counter of servo motor), then copy mechanical origin to the
current position, zero return is finished.
Note: (some special occasions)
Decelerate to VL immediately with set slope if touching mechanical origin during the process
that ZRN start to accelerate, and come near to origin signal at speed VL, the following action
description is the same with above.
Decelerate to 0 with deceleration slope when touching origin signal during the process that it
decelerates with set slope from origin auxiliary signal.
Decelerate with deceleration slope when encountering origin signal, as mechanical origin
structure is short, it may haven’t slowed down to 0 when passes the origin, it will still
decelerate to 0; After delay (Direction delay in SFD), accelerate to VH with acceleration
slope backwards, the moment it leaves origin (near point sensing signal 1→0), output clear
signal immediately and delay if ‘zero return CLR signal’ is set. (CLR signal delay in SFD can
use ‘zero return CLR signal’ output to clear Error Counter of servo motor), then copy
mechanical origin to current position, zero return is finished.
Situation 1
Situation 2
Situation 3
Action description:
(1) Accelerate to speed VH with acceleration slope(zero return speed) in origin return
direction until touch limit switch.
(2) Decelerate to 0 with deceleration slope when touching limit switch, then accelerate in the
direction that is opposite with origin return direction, decelerate to 0 when touching limit
switch, then accelerate in the origin return opposite direction until touch origin switch,
decelerate to 0 with set deceleration slope.
(3) When accelerate to VL with set slope, three possible situations may occur as the
acceleration and deceleration slope is different
Decelerate to 0 with deceleration slope, during the process accelerate to VL the moment
touching the origin right signal;
Move on at speed VL until touching origin signal right side, if it still does not touch origin
right signal when accelerates to VL with acceleration slope. Decelerate to 0 when touch the
origin signal right side;
Decelerate to 0 with set deceleration slope, when accelerate with set acceleration slope and it
has touched origin signal right side before reaching speed VL.
(4) Any situation in (3), accelerate to VC (crawl speed) with acceleration slope in the opposite
direction after decelerating to 0 and delaying.
(5) Stop action the moment it leaves the right side of origin signal, output clear signal and
delay if ‘zero return CLR signal’ is set.(CLR signal time delay in SFD can use ‘zero return
CLR signal’ output point to clear Error Counter of servo), then copy mechanical origin
position to the current position, zero return is finished.
(D) Before back to mechanical origin, the device is between left limit switch and origin
switch, and start to decelerate when touch the origin rising edge, the speed reaches 0 before
leaving origin signal right side:
Action description:
(1) Accelerate to VH (zero return speed) with acceleration slope, and move in origin return
direction at speed VH until touch the route limit switch.
(2) Decelerate to 0 with deceleration slope when touch the route limit switch, then accelerate
in origin return opposite direction until touch the origin switch, decelerate to 0 at set
deceleration slope.
(3) Accelerate to VC (crawl speed) with set acceleration slope. Three possible situations may
occur as the acceleration and deceleration slope is different:
Stop by pulse at once, when accelerate to VC just the moment touching origin right side;
Move on to origin right edge at speed VC until leaves origin signal right edge, stop by pulse
at once, if the speed reaches VC before touching the origin right edge;
Stop by pulse at once, if leaves origin right side before reaching speed VC;
(4) Any situation in (3), stop action after stop by pulse, if ‘zero return CLR signal’ is
set.(CLR signal time delay in SFD can use ‘zero return CLR signal’ output point to clear
Error Counter of servo), then copy mechanical origin position to the current position, zero
return is finished.
Example 1
The servo drive (electronic gear ratio is 1:1) controls the servo motor (encoder 2500 ppr), the
ball screw pitch is 10mm. the ball screw drives a working table moving left and right. Now
the working table must go back to the origin. The left limit switch connects to PLC X0 input,
right limit switch connects to PLC X2 input. Origin position switch connects to X1. Origin
returning speed VH is 10000Hz, SFD direction delay time is 100ms, creeping speed VC is
100Hz, not count Z phase signal, pulse outputs from Y0, pulse direction terminal is Y2.
Mechanical origin position is 0, the acceleration slope is 1000Hz every 100ms. The
deceleration slope is 1000Hz every 150ms. Please note there is no near origin signal, so it no
needs to set origin returning speed VL.
Working table
2500
ppr
Servo
motor X0 X1 X2
Left limit origin Right limit
M0
ZRN K1 Y0
System pararmeters
Mechanical returning to origin movement diagram
Left limit Origin Working table Right limit
X0 X1 X2
2500
ppr
Servo motor
F
Creeping
speed VC
0 t
Returning
origin speed VH
1. At the moment leaving the falling edge of X1 with creeping speed, the mechanical
returning origin finished at once.
2. If the setting of origin returning speed, pulse acceleration and deceleration time, left limit
origin position is not reasonable, it will cause the working table touching the left limit in the
process of touching the origin signal and decelerating. Please avoid the special condition even
the software has solution for it.
3. Y2 terminal is OFF when the working table moves from right to left. Y2 terminal is ON
when the working table reverse moves with creeping speed and stops.
Example 2
The servo drive (electronic gear ratio is 1:1) controls the servo motor (encoder 2500 ppr), the
ball screw pitch is 10mm. the ball screw drives a working table moving left and right. Now
the working table must go back to the origin. The left limit switch connects to PLC X0 input,
right limit switch connects to PLC X2 input. Origin position switch connects to X1. Origin
returning speed VH is 10000Hz, origin returning speed is 1000Hz, SFD direction delay time
is 100ms, creeping speed VC is 100Hz, not count Z phase signal, pulse outputs from Y0,
pulse direction terminal is Y2. Mechanical origin position is 0, the acceleration slope is
1000Hz every 100ms. The deceleration slope is 1000Hz every 150ms.
Left Origin Working Right
origin table
limit auxiliary limit
X1
2500 X0 X3 X2
ppr
Servo motor
M0
ZRN K1 Y0
System parameters
Mechanical returning origin movement diagram
Origin Working Right
Left limit origin
auxiliary table limit
X0 X1
X3 X2
2500
ppr
Servo motor
Creeping speed
VC
0 t
Origin returning
speed VL
Origin returning
speed VH
1. At the moment leaving the falling edge of X1 with creeping speed, the mechanical
returning origin finished at once.
2. If the setting of origin returning speed, pulse acceleration and deceleration time, left limit
origin position is not reasonable, it will cause the working table touching the left limit in the
process of touching the origin signal and decelerating. Please avoid the special condition even
the software has solution for it.
3. Y2 terminal is OFF when the working table moves from right to left. Y2 terminal is ON
when the working table reverse moves with creeping speed and stops.
Example 3
The servo drive (electronic gear ratio is 1:1) controls the servo motor (encoder 2500 ppr), the
ball screw pitch is 10mm. the ball screw drives a working table moving left and right. Now
the working table must go back to the origin. The left limit switch connects to PLC X0 input,
right limit switch connects to PLC X2 input. Origin position switch connects to X1. Origin
returning speed VH is 10000Hz, origin returning speed is 1000Hz, SFD direction delay time
is 100ms, creeping speed VC is 100Hz, count the Z phase number when reverse leaving the
origin signal (connect to X4), Z phase number set to 6, pulse outputs from Y0, pulse direction
terminal is Y2. Mechanical origin position is 0, the acceleration slope is 1000Hz every
100ms. The deceleration slope is 1000Hz every 150ms.
Left Origin Working Right
origin table
limit auxiliary limit
X1
2500 X0 X3 X2
ppr
Servo motor
M0
ZRN K1 Y0
System parameters
Origin Working
Left limit origin Right
auxiliary table
X0 X1 limit X2
X3
2500
ppr
Servo motor
Creeping speed
VC Z phase
count
0 t
Origin returning
speed VL
Origin returning
speed VH
1. At the moment leaving the falling edge of X1 with creeping speed, it starts to count the Z
phase pulse, the pulse will stop when the count value reach the setting value, the mechanical
returning origin finished.
2. If the setting of origin returning speed, pulse acceleration and deceleration time, left limit
origin position is not reasonable, it will cause the working table touching the left limit in the
process of touching the origin signal and decelerating. Please avoid the special condition even
the software has solution for it.
3. Y2 terminal is OFF when the working table moves from right to left. Y2 terminal is ON
when the working table reverse moves with creeping speed and stops.
operands
Operands Function Type
S The stop pulse terminal bit
D Pulse stop mode (0: slow stop, 1: urgent stop) Word 16 bits
Suitable soft component
Operand System
X Y M* S* T* C* Dn.m
Word S ●
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
M0
PLSR HD0 HD100 K1 Y0
S D
M1
STOP Y0 K0
SM1000
RST M0
when M0 from OFF to ON, PLSR output pulse from Y0. It stop outputting when the pulse
numbers are equal to the setting value. At the rising edge of M1, STOP instruction will stop
the pulse output immediately, as D0 is 0, the pulse will slow stop.
Stop all the pulses include PLSR, PLSF, ZRN.
Slow
stop
0 t
STOP
The pulse will stop when pulse present frequency decreases to the pulse end frequency
according to the falling slope or the pulse numbers outputting end.
Urgent stop
0 t
STOP
6-3.Output wiring
Y0 Y1 Y2
COM0 COM1 COM2
Below is the graph of the output terminals and step driver wiring:
PU
Y1
Note: if the stepper motor pulse and direction terminals are drived by DC5V, please connect
2.2KΩ resistor after pulse and direction terminal.
The wiring diagram of output terminal and servo motor:
Y0 P-
COM0
P+5V
+24V P+24V
R=3.3K
Y1 D-
COM1
D+5V
D+24V
0V 屏蔽层 R=3.3K
SD1061
Low 16 bit of current pulse
SD1062 (unit is pulse number)
High 16 bit of current pulse
SD1063 (unit is pulse number)
Low 16 bit of current pulse
SD1064 (unit is pulse equivalent)
High 16 bit of current pulse
SD1065 (unit is pulse equivalent)
Low 16 bit of current output
frequency (unit is pulse
SD1066 number)
High 16 bit of current output
frequency (unit is pulse
SD1067 number)
Low 16 bit of current output
frequency (unit is pulse
SD1068 equivalent)
High 16 bit of current output
PULSE_4
frequency (unit is pulse
SD1069 equivalent)
1:pulse data block error
2:equivalent mode:pulse
number/ turn, shift amount/turn is
0
3:system parameter block
number error
4:pulse data block exceed max
limit
SD1070 Pulse error message
10:origin return do not set near
point signal
11:origin return speed is 0
12:origin return crawling speed
is 0
13:origin return speed and origin
auxiliary speed direction is
different
Error pulse data block
SD1071 number
MODBUS Communication
7-1.Summary
XD3, XDM series PLC main units can fulfill your requirement on communication and
network. They not only support Modbus RTU, but also support Modbus ASCII and field bus
X-NET. XD3, XDM series PLC offer multiple communication methods, with which you can
communicate with the devices (such as printer, instruments etc.) that have Modbus
communication protocol.
7-1-1.COM port
COM Port
COM1 RS232
COM2 RS232
Extended port COM3
Extended port
COM4
COM2 RS485 or
Field bus X-NET
RS232 port
Mini Din 8 pin female port Mini Din 8 pin female port
Note:
1. COM1 supports RS232 and USB port, but they cannot be used at the same time.
2. COM2 supports X-NET and RS485, but X-NET and RS485 cannot be used at the same
time.
2. RS485 port
About RS485 port, A is “+” signal、B is “-” signal.
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
7-1-2.Communication parameters
Communication Parameters
The default parameters of COM1: Station number is 1, baud rate is 19200bps, 8 data bits, 1
stop bit, even parity.
Note: Do not modify COM1 parameters, otherwise connection between PLC and PC
may fail!
XD3, XDM series PLC can set the parameters by the COM ports.
COM1 Function Description Note
See value of corresponding
SFD600* Communication mode
bit
Communication Baud rate, data bit, stop See value of corresponding
SFD601*
format bit, parity bit
Frame timeout
SFD602* Unit: character High 8 bits invalid
judgment time
Reply timeout
SFD603* High 8 bits invalid
judgment time
Delay time before
SFD604 Unit: ms
sending
COM2
See value of corresponding
SFD610* Communication mode
bit
Communication Baud rate, data bit, stop See value of corresponding
SFD611*
format bit, parity bit
Frame timeout
SFD612* Unit: ms
judgment time
Reply timeout Unit: ms, if set to be 0, it
SFD613*
judgment time means no timeout wait
delay time before
SFD614 Unit: ms
sending
Timeout:
Frame timeout judgment set to be 0: then wait for time of a character, and it means over if
timeout; 8bit unsigned number.
Reply timeout judgment set to be 0: no timeout; 16bits unsigned number.
Delay time before sending set to be 0: no delay; 16bits unsigned number.
2. click config/find device to show below window, then choose com port and deivce type.
Click confirm.
3. Click config/single device/comport
Ma
Sla Sla
ve ve
Sla
ve
In RS232 network (see below diagram), there can only be one master and one slave at one
time.
Maste Slav
r the diagram. It means any PLC can be master station when all PLC in
There is dotted line in
the network don’t send data. As the PLC do not have unified clock standard, communication
will fail when more than one PLC send data at one time. It is not recommended to use.
Note:
1. For XD3 series PLC, RS232 and RS485 only support half-duplex.
2. For XC series PLC, if master PLC send one data to slave PLC, and master PLC send data
again before slave PLC receiving the last one completely, slave PLC end data error may
occur; For XD3 series PLC, we solve this problem by adding waiting time before
communication (COM1/COM2: SFD1337/SFD1347), which means the slave PLC will
receive the next data only after some time the last data finished.
7-2-2.Changing of Modbus instruction
Modbus instruction handling mode has changed, users can write Modbus instructions directly
in program, the protocol station will queue up Modbus requests, which is not the same task
with communication; It means users can use one triggering condition to trigger multiple
Modbus instructions at the same time. PLC will queue up Modbus requests according to
protocol station, which will lead to communication error in XC series PLC.
M0
COLR K1 K500 K3 M1 K2
MCLW K1 K500 K3 M1 K2
REGW K1 K500 D1 K2
XC series(×)
M0
COLR K1 K500 K3 M1 K2
MCLW K1 K500 K3 M1 K2
REGW K1 K500 D1 K2
XD3 series(√)
Note: XD3 series PLC sequence block has cancelled Modbus communication instructions,
which is replaced by the current Modbus instruction handling mode.
7-2-3.Communication address
The soft component’s code in PLC corresponds with Modbus ID number, please see the
following table:
XD3 series PLC Modbus address and internal soft component table:
Modbus Modbus
type component Address number address address
(Hex) (decimal)
M M0~M7999 8000 0~1F3F 0~7999
X0~X77 (main unit) 64 5000~503F 20480~20543
X10000~X10077 5100~513F 20736~20799
64
(#1 module)
X10100~X10177 5140~517F 20800~20863
Coil 64
(#2 module)
bit X X10200~X10277 64 5180~51BF 20864~20927
(#3 module)
X10300~X10377 64 51C0~51FF 20928~20991
(#4 module)
X10400~X10477 64 5200~523F 20992~21055
(#5 module)
X10500~X10577 64 5240~527F 21056~21119
(#6 module)
X10600~X10677 64 5280~52BF 21120~21183
(#7 module)
X10700~X10777 64 52C0~52FF 21184~21247
(#8 module)
X11000~X11077 64 5300~533F 21248~21311
(#9 module)
X11100~X11177 64 5340~537F 21312~21375
(#10 module)
X20000~X20077(#1
64 58D0~590F 22736~22799
BD)
Y0~77(main unit) 64 6000~603F 24576~24639
Y10000~Y10077 6100~613F 24832~24895
64
(#1 module)
Y10100~Y10177 6140~617F 24896~24959
64
(#2 module)
Y10200~Y10277 64 6180~61BF 24960~25023
(#3 module)
Y10300~Y10377 64 61C0~61FF 25024~25087
(#4 module)
Y10400~Y10477 64 6200~623F 25088~25151
(#5 module)
Y Y10500~Y10577 64 6240~627F 25152~25215
(#6 module)
Y10600~Y10677 64 6280~62BF 25216~25279
(#7 module)
Y10700~Y10777 64 62C0~62FF 25280~25343
(#8 module)
Y11000~Y11077 64 6300~633F 25344~25407
(#9 module)
Y11100~Y11177 64 6340~637F 25408~25471
(#10 module)
Y20000~Y20077(#1
64 68D0~690F 26832~26895
BD)
S S0~S1023 1024 7000~73FF 28672~29695
SM SM0~SM2047 2048 9000~97FF 36864~38911
T T0~T575 576 A000~A23F 40960~41535
C C0~C575 576 B000~B23F 45056~45631
ET ET0~ET31 32 C000~C01F 49152~49183
SEM SEM0~SEM31 32 C080~C09F 49280~49311
HM※1 HM0~HM959 960 C100~C4BF 49408~50367
※
HS 1 HS0~HS127 128 D900~D97F 55552~55679
※
HT 1 HT0~HT95 96 E100~E15F 57600~57695
※
HC 1 HC0~HC95 96 E500~E55F 58624~58719
※
HSC 1 HSC0~HSC31 32 E900~E91F 59648~59679
D D0~D7999 8000 0~1F3F 0~7999
Register ID0~ID99(main unit) 100 5000~5063 20480~20579
word ID ID10000~ID10099
100 5100~5163 20736~20835
(#1 module)
ID10100~ID10199
100 5164~51C7 20836~20935
(#2 module)
ID10200~ID10299 100 51C8~522B
20936~21035
(#3 module)
ID10300~ID10399 100 522C~528F
21036~21135
(#4 module)
ID10400~ID10499 100 5290~52F3
21136~21235
(#5 module)
ID10500~ID10599 100 52F4~5357
21236~21335
(#6 module)
ID10600~ID10699 100 5358~53BB
21336~21435
(#7 module)
ID10700~ID10799 100 53BC~541F
21436~21535
(#8 module)
ID10800~ID10899 100 5420~5483
21536~21635
(#9 module)
ID10900~ID10999 100 5484~54E7
21636~21735
(#10 module)
ID20000~ID20099
100
(#1 BD) 58D0~5933 22736~22835
QD0~QD99(main
100 6000~6063 24576~24675
unit)
QD10000~QD10099
100 6100~6163 24832~24931
(#1 module)
QD10100~QD10199 100 24932~25031
6164~61C7
(#2 module)
QD10200~QD10299 100 25032~25131
61C8~622B
(#3 module)
QD10300~QD10399 100 25132~25231
622C~628F
(#4 module)
QD10400~QD10499 100 25232~25331
6290~62F3
(#5 module)
QD
QD10500~QD10599 100 25332~25431
62F4~6357
(#6 module)
QD10600~QD10699 100 25432~25531
6358~63BB
(#7 module)
QD10700~QD10799 100 25532~25631
63BC~641F
(#8 module)
QD10800~QD10899 100 25632~25731
6420~6483
(#9 module)
QD10900~QD10999 100 25732~25831
6484~64E7
(#10 module)
QD20000~QD20099
100 68D0~6933 26832~26931
(#1 BD)
SD SD0~SD2047 2048 7000~77FF 28672~30719
TD TD0~TD575 576 8000~823F 32768~33343
CD CD0~CD575 576 9000~923F 36864~37439
ETD ETD0~ETD31 32 A000~A01F 40960~40991
HD※1 HD0~HD999 1000 A080~A467 41088~42087
HSD※1 HSD0~HSD499 500 B880~BA73 47232~47731
HTD※1 HTD0~HTD95 96 BC80~BCDF 48256~48351
HCD※1 HCD0~HCD95 96 C080~C0DF 49280~49375
HSCD※1 HSCD0~HSCD31 32 C480~C49F 50304~50335
FD※2 FD0~FD6143 6144 C4C0~DCBF 50368~56511
SFD※2 SFD0~SFD1999 2000 E4C0~EC8F 58560~60559
FS※2 FS0~FS47 48 F4C0~F4EF 62656~62703
XDM series PLC Modbus address and internal soft component table:
Modbus Modbus
Type component Address numbers address address
(hex) (decimal)
M M0~M20479 20480 0~4FFFF 0~20479
X0~X77(main unit) 64 5000~503F 20480~20543
X10000~X10077 5100~513F 20736~20799
64
(#1 module)
X10100~X10177 5140~517F 20800~20863
64
(#2 module)
X10200~X10277 64 5180~51BF 20864~20927
(#3 module)
X10300~X10377 64 51C0~51FF 20928~20991
(#4 module)
X10400~X10477 64 5200~523F 20992~21055
(#5 module)
X10500~X10577 64 5240~527F 21056~21119
(#6 module)
X10600~X10677 64 5280~52BF 21120~21183
(#7 module)
X10700~X10777 64 52C0~52FF 21184~21247
(#8 module)
X X11000~X11077 64 5300~533F 21248~21311
(#9 module)
Coil X11100~X11177 64 5340~537F 21312~21375
bit (#10 module)
X11200~X11277 64 5380~53BF 21376~21439
(#11 module)
X11300~X11377 64 53C0~53FF 21440~21503
(#12 module)
X11400~X11477 64 5400~543F 21504~21567
(#13 module)
X11500~X11577 64 5440~547F 21568~21631
(#14 module)
X11600~X11677 64 5480~54BF 21632~21695
(#15 module)
X11700~X11777 64 54C0~54FF 21696~21759
(#16 module)
X20000~X20077
64 58D0~590F 22736~22799
(#1 BD)
Y0~77(main unit) 64 6000~603F 24576~24639
Y10000~Y10077 6100~613F 24832~24895
640
(#1 module)
Y
Y10100~Y10177 6140~617F 24896~24959
64
(#2 module)
Y10200~Y10277 64 6180~61BF 24960~25023
(#3 module)
Y10300~Y10377 64 61C0~61FF 25024~25087
(#4 module)
Y10400~Y10477 64 6200~623F 25088~25151
(#5 module)
Y10500~Y10577 64 6240~627F 25152~25215
(#6 module)
Y10600~Y10677 64 6280~62BF 25216~25279
(#7 module)
Y10700~Y10777 64 62C0~62FF 25280~25343
(#8 module)
Y11000~Y11077 64 6300~633F 25344~25407
(#9 module)
Y11100~Y11177 64 6340~637F 25408~25471
(#10 module)
Y11200~Y11277 64 6380~63BF 25472~25535
(#11 module)
Y11300~Y11377 64 63C0~63FF 25536~25599
(#12 module)
Y11400~Y11477 64 6400~643F 25600~25663
(#13 module)
Y11500~Y11577 64 6440~647F 25664~25727
(#14 module)
Y11600~Y11677 64 6480~64BF 25728~25791
(#15 module)
Y11700~Y11777 64 64C0~64FF 25792~25855
(#16 module)
Y20000~Y20077(#1
64 68D0~690F 26832~26895
BD)
S S0~S7999 8000 7000~8F3F 28672~36671
SM SM0~SM4095 4096 9000~9FFF 36864~40959
T T0~T4095 4096 A000~AFFF 40960~45055
C C0~C4095 4096 B000~BFFF 45056~45151
ET ET0~ET39 40 C000~C027 49152~49191
SEM SEM0~SEM127 128 C080~C0FF 49280~49407
HM※1 HM0~HM6143 6144 C100~D8FF 49408~55551
HS※1 HS0~HS999 1000 D900~DCEF 55552~56551
HT※1 HT0~HT1023 1024 E100~E4FF 57600~58623
HC※1 HC0~HC1023 1024 E500~E8FF 58624~59647
HSC※1 HSC0~HSC36 40 E900~E927 59648~59687
D D0~D20479 20480 0~4FFF 0~20479
ID0~ID99(main unit) 100 5000~5063 20480~20579
ID10000~ID10099
100 5100~5163 20736~20835
(#1 module)
Register ID10100~ID10199
100 5164~51C7 20836~20935
word ID (#2 module)
ID10200~ID10299 100 51C8~522B
20936~21035
(#3 module)
ID10300~ID10399 100 522C~528F
21036~21135
(#4 module)
ID10400~ID10499 100 5290~52F3 21136~21235
(#5 module)
ID10500~ID10599 100 52F4~5357
21236~21335
(#6 module)
ID10600~ID10699 100 5358~53BB
21336~21435
(#7 module)
ID10700~ID10799 100 53BC~541F
21436~21535
(#8 module)
ID10800~ID10899 100 5420~5483
21536~21635
(#9 module)
ID10900~ID10999 100 5484~54E7
21636~21735
(#10 module)
ID11000~ID11099 100 54E8~554B
21736~21835
(#11 module)
ID11100~ID11199 100 554C~55AF
21836~21935
(#12 module)
ID11200~ID11299 100 55B0~5613
21936~22035
(#13 module)
ID11300~ID11399 100 5614~5677
22036~22135
(#14 module)
ID11400~ID11499 100 5678~56DB
22136~22235
(#15 module)
ID11500~ID11599 100 56DC~573F
22236~22335
(#16 module)
ID20000~ID20099(#1
100
BD) 58D0~5933 22736~22835
QD0~QD99(main unit) 100 6000~6063 24576~24675
QD10000~QD10099
100 6100~6163 24832~24931
(#1 module)
QD10100~QD10199 100 24932~25031
6164~61C7
(#2 module)
QD10200~QD10299 100 25032~25131
61C8~622B
(#3 module)
QD10300~QD10399 100 25132~25231
622C~628F
(#4 module)
QD10400~QD10499 100 25232~25331
6290~62F3
(#5 module)
QD10500~QD10599 100 25332~25431
62F4~6357
(#6 module)
QD10600~QD10699 100 25432~25531
QD 6358~63BB
(#7 module)
QD10700~QD10799 100 25532~25631
63BC~641F
(#8 module)
QD10800~QD10899 100 25632~25731
6420~6483
(#9 module)
QD10900~QD10999 100 25732~25831
6484~64E7
(#10 module)
QD11000~QD11099 100 25832~25931
64E8~654B
(#11 module)
QD11100~QD11199 100 25932~26031
654C~65AF
(#12 module)
QD11200~QD11299 100 26032~26131
65B0~6613
(#13 module)
QD11300~QD11399 100 6614~6677 26132~26231
(#14 module)
QD11400~QD11499 100 26232~26331
6678~66DB
(#15 module)
QD11500~QD11599 100 26332~26431
66DC~673F
(#16 module)
QD20000~QD20099(#1
100 68D0~6933 26832~26931
BD)
SD SD0~SD4095 4096 7000~7FFF 28672~32767
TD TD0~TD4095 4096 8000~8FFF 32768~36863
CD CD0~CD4095 4096 9000~9FFF 36864~40959
ETD ETD0~ETD39 40 A000~A027 40960~40999
HD※1 HD0~HD6143 6144 A080~B87F 41088~47231
HSD※1 HSD0~HSD1023 1024 B880~BC7F 47232~48255
※
HTD 1 HTD0~HTD1023 1024 BC80~C07F 48256~49279
※
HCD 1 HCD0~HCD1023 1024 C080~C47F 49280~40303
HSCD※1 HSCD0~HSCD39 40 C480~C4A7 50304~50343
FD※2 FD0~FD8191 8192 C4C0~E4BF 50368~58559
SFD※2 SFD0~SFD4095 4096 E4C0~F4BF 58560~62655
※
FS 2 FS0~FS255 256 F4C0~F5BF 62656~62911
Note:
1. *1 is power-off retentive range, *2 is flash range.
2. The address is usually for Modbus-RTU and Modbus-ASCII communication when PLC
works as lower computer, and upper computer: configuration/screen/PLC......
3. If upper computer is PLC, then we write program according to Modbus-RTU or Modbus-
ASCII protocol; if upper computer is configuration or touch screen, there will be two
situations: 1. with xinje driver. E.g.: xinje touch screen/ Real bridge configuration can use
PLC soft components directly (Y0/M0). 2. without xinje driver. Then users have to use below
address to define variables after select Modbus-RTU or Modbus-ASCII protocol.
4. For Octonary I/O, calculate corresponding octonary I/O Modbus address.
2. Modbus address:
00H:All the Xinje XC series PLC broadcast—— slave stations don’t response.
01H:Communicate with address 01H PLC.
0FH:Communicate with address 15H PLC.
10H:Communicate with address 16H PLC and so on. Up to 254(FEH).
Take 06H function code as example (single register write), and introduce data format (other
function code is similar to this):
E.g.: upper computer write data to PLC H0002 (D2).
RTU mode:
Asking format Response format
ID 01H ID 01H
Function code 06H Function code 06H
Register ID 00H Register ID 00H
02H 02H
Data content 13H Data contents 13H
88H 88H
CRC CHECK High 25H CRC CHECK High 25H
CRC CHECK Low 5CH CRC CHECK Low 5CH
Explanation:
1. Address is PLC station no.
2. Function code is Modbus-RTU protocol read/write code.
3. Register address is the PLC modbus address, please see chapter 7-2-2.
4. Data content is the value in D2.
5. CRC CHECK High / CRC CHECK Low is high and low bit of CRC check value.
If 2 pieces of Xinje XD3 series PLC communicate with each other, write K5000 to D2.
M0
REGW K1 H0002 K5000 K2
M0 is trigger condition (Rising edge). If communication fails, the instruction will try twice. If
the third time communication fails, then 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 datum are: 01H 06H 00H 02H 13H 88H (system take CRC
checking automatically)
If monitor the serial port2 data by serial port debugging tool, the datum are: 01 06 00 02 13
88 25 5C
Note: The instruction doesn’t distinguish decimal, hex, binary, 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
Format:
STX (3AH) Start mark=3AH
Address code high bit
Communication position(no):
Address code low bit
Consist of 2 ASCII codes
Function code high bit Function code(command):
Function code low bit Consist of 2 ASCII codes
Instruction start ID
Instruction start ID Command start bit:
Instruction start ID Consist of 4 ASCII codes
Instruction start ID
Data length
Data length Length from start to end:
Data length Consist of 4 ASCII codes
Data length
LRC check high bit LRC check code:
LRC check low bit Consist of 2 ASCII codes
END high bit End mark:
END Hi=CR(0DH),END Lo=CR
END low bit
(0AH)
2. Communication address:
00H:All Xinje XC series PLC broadcast—— slave stations do not response.
01H:Communicate with address 01H PLC.
0FH:Communicate with address 15H PLC.
10H:Communicate with address 16H PLC.
And so on, up to 254(FEH).
Take 06H function code(write single register)as example, and introduce data format
(other functions are the similar to this):
E.g.:upper computer write data to PLC H0002 (D2).
ASCII mode:
Start mark 3AH
ID 30H
31H
Function code 30H
36H
Register ID high byte 30H
30H
Register ID low byte 30H
32H
Data content high byte 31H
33H
Data content low byte 38H
38H
LRC 35H
43H
End mark 0DH
0AH
Description:
1. ID is PLC station number.
2. Function code is Modbus-ASCII protocol read/write code.
3. Register ID is the PLC modbus communication ID, please see chapter 7-2-2.
4. Data content is the value in D2.
5. LRC CHECK Low / CRC CHECK High is low and high bit of CRC check value.
If two pieces of Xinje XD3 PLC communicate with each other, write K5000 to D2.
M0
REGW K1 H0002 K5000 K2
Complete data string: 3AH 30H 31H 30H 36H 30H 30H 30H 32H 31H 33H 38H 38H
35H 43H (system take CRC checking automatically)
If monitor the serial port2 by serial port debugging tool, the datum are: 3AH 30H 31H 30H
36H 30H 30H 30H 32H 31H 33H 38H 38H 35H 43H 0DH 0AH
Note: The data does not distinguish decimal, binary, hexadecimal 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-5.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.
E.g.:one PLC connects 3 inverters. PLC needs to write and read the parameters of inverter.
The inverter station number is 1.2 and 3. So the remote communication number is 1.2 and 3.
Operands
Operands Function Type
S1 Specify the remote communication station 16 bits, BIN
S2 Specify the remote coil start address 16 bits, BIN
S3 Specify the coil quantity 16 bits, BIN
D1 Specify the local coil start address bits
D2 Specify the serial port no. 16 bits, BIN
Operands System
X Y M* S* T* C* Dn.m
D1 ● ● ● ● ● ●
Bit
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM. M includes M, HM, SM; S includes S and HS; T includes T and
HT; C includes C and HC.
Function
Summary
Write input coils status in specified station to the local station.
Input coil read[INPR]
16 bits INPR 32 bits -
instruction instruction
Execution Normally ON/OFF, rising Suitable XD3, XDM
condition edge models
Hardware - Software -
requirement requirement
Operands
Operands Function Type
S1 Specify remote communication no. 16 bits, BIN
S2 Specify remote coil start address number 16 bits, BIN
S3 Specify coil number 16 bits, BIN
D1 Specify start address number of local receipt bit
coils
D2 Specify serial port number 16 bits, BIN
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
Function
Summary
Write input coils status in specified station to the local station.
Coil write [COLW]
16 bits COLW 32 bits -
instruction instruction
Execution Normally ON/OFF、rising Suitable XD3, XDM
Condition edge Models
Hardware - Software -
Requirement Requirement
Operands
Operands Function Type
D1 Specify remote communication number 16 bits,BIN
D2 Specify remote coil start address number 16 bits,BIN
S1 Specify start address number of local send coil bit
S2 Specify serial port number 16 bits,BIN
Suitable soft components
Operands System Constant Module
Word D* FD TD* CD* DX DY DM* DS* K /H ID QD
D1 ● ● ● ● ●
D2 ● ● ● ● ●
S2 K
Operand System
X Y M* S* T* C* Dn.m
Bit S1 ● ● ● ● ● ●
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
Function
Summary
Write input coils status in the local station to the specified station.
Multi-coils write [MCLW]
16 bits MCLW 32 bits -
instruction instruction
Execution Normally ON/OFF, rising Suitable XD3, XDM
Condition edge models
Hardware - Software -
Requirement Requirement
Operands
Operands Function Type
D1 Specify remote communication number 16 bits,BIN
D2 Specify remote coil start address number 16 bits,BIN
D3 Specify coil number 16 bits,BIN
S1 Specify start address number of local send coils bit
S2 Specify serial port number 16 bits,BIN
Operands System
Bit X Y M* S* T* C* Dn.m
S1 ● ● ● ● ● ●
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
Function
Operands
Operands Function Type
S1 Specify remote communication number 16 bits,BIN
S2 Specify remote register start address number 16 bits,BIN
S3 Specify register number 16 bits,BIN
D1 Specify start address number of local receipt 16 bits,BIN
register
D2 Specify serial port number 16 bits,BIN
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Function
Operands
Operands Function Type
S1 Specify remote communication number 16 bits,BIN
S2 Specify remote register start address number 16 bits,BIN
S3 Specify coil number 16 bits,BIN
D1 Specify start address number of local receipt 16 bits,BIN
register
D2 Specify serial port number 16 bits,BIN
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Function
Operands
Operands Function Type
D1 Specify remote communication number 16 bits,BIN
D2 Specify remote register start address number 16 bits,BIN
S1 Specify start address number of local send 16 bits,BIN
register
S2 Specify serial port number 16 bits,BIN
Notes: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
Function
Operands
Operands Function Type
D1 Specify remote communication number 16 bits,BIN
D2 Specify remote register start address number 16 bits,BIN
D3 Specify register number 16 bits,BIN
S1 Specify start address number of local send 16 bits,BIN
registers
S2 Specify serial port number 16 bits,BIN
Function
7-2-6.Communication application
Wiring method
There are two wiring methods:
232 wiring methods
Note:
1. COM2 with *1 only show the RS232 pins. The RS485 pins are external terminal(A、
B).
2. XD3 series PLC,RS232 do not support full-duplex, so it can only communicate in single
direction.
3. RS232 communication distance is short (about 13m); RS485 is suitable for longer distance.
485 wiring methods
Y0 COLW K2 H4800 Y0 K2
COLW K3 H4800 Y0 K2
The program takes serial port 2 as example, so corresponding communication flag is the serial
port 2’s. About other serial port, please refer to appendix 1. Serial port, please refer to
appendix 1.
Y0
Broadcast station is 0, all the slaves will response but not reply.
Broadcast cannot read.
When master Y0 status changes, it broadcasts the status to all the slaves. The synchronization
of three PLCs is better than method 1.
TBN belongs to industry fieldbus. It is token structure, any node in the network has access
rights (token), any node who got the token can send message to other node. It doesn’t have
master and slave. It makes the data access efficient and flexible.
OMMS focus on the connection between upper device and embedded equipment. The
connection between equipments is permitted. The PLC connection with programming
software and network configuration software uses OMMS protocol.
The MCP (motion control protocol) based on OMMS makes the multi-axis controlling
simple. 8-axis 2ms control period can meet most of motion control needs. It needs one PLC
and 8 servo drives to make the project, no need special communication module.
Connection method 1:
Terminal A is RS485+, terminal B is RS485-. Connnect A to A, B to B.
Note: RS485 port can communication through Modbus_RTU or X-NET. Please choose the
mode in XINJEConfig software.
Connection method 2:
There are four terminals including A, B, SG(signal ground), FG(shielded ground) on
expansion BD board XD-RS485-BD. Normally, X-NET needs to connect terminal A and B,
the shielded layer connects to FG. If there is requirements for anti-interference, such as
motion control fieldbus, it needs to connect terminal A, B, SG.
XD-RS485-BD has switch to set terminal resistor. The default setting is switch OFF(left)
without terminal resistor. If XD-RS485-BD is at the head or end of the filedbus, it needs to
add 120ohm terminal resistor at both end, the switch must be ON (right).
Connection method 3:
Connect through the expansion ED board on the left side of PLC.
Note: the ED board is in developing.
When TBN runs on OC, the station connection wire is optical fiber. The last station sending
terminal connects to the receiving terminal of the first station to make the loop network. The
optical signal has strong anti-interference ability. But the optical fiber is easy to broken and
complicated to make the pigtail, this limits the developing of optical fiber. TBN_OC supports
600bit~3Mbit baud rate.
As the RS485 device driving ability and conversion speed of photoelectric module, the node
quantity in the TBN network must be less than 32.
As the PLC RS485 port is serial port2, here we choose no.2 for comportNo. The protocol is
X-NET. The physical layer is RS485.
NetID: the network number of the two PLC. The device net ID in the same network must be
the same. Here we set it to 1.
StationID: each PLC station number in the network. The two PLC station number is 1 and 2.
Net type:
TBN--- PLC communicate with PLC
TBN or HDN--- PLC communicate with HMI
HDN--- PLC communicate with servo.
Baud rate: here we set it to 1.5M
TokenCycle time: the time of each station in the network cycle once, the unit is ms. Here we
have two PLC, so the time set to 10ms.
Max station number: the max device numbers in the network.
Click “write config”, it will show read success window.
Click ok to back to the main window. Cut off the PLC power and power on again to make the
setting effective.
Then click config/single device/route.
It shows the Form_RouteTb1 window.
2. Target station number: the station number of target device in the network.
For example: PLC connects to 3 frequency inverters, the frequency inverter station number is
1, 2, 3, and PLC station number is 4. The PLC will read the parameters of three inverters.
Station number 1, 2, 3 are the target station number of PLC.
4. Target object number: the target device coil or register address in the network
For example: write register D0, write the D0 value to target address
1. Instruction explanation
Read the target coil to local coil.
Read bit [BIT_READ]
Execution Edge trigger Suitable XD3, XDM
conditoin model
Hardware V3.2 and up Software V3.2 and up
2. Operand
Operand Function Type
S1 Target net ID 16 bits constant or single word register
S2 Target station number 16 bits constant or single word register
S3 Target object type (refer to chapter 16 bits constant or single word register
7-3-4)
S4 Target object address (refer to 32 bits constant or double words register
chapter 7-3-4)
S5 Access object numbers 16 bits constant or single word register
D1 Local object address Local coil
Operand System
X Y M* S* T* C* Dn.m
Bit D1 ● ● ● ● ● ●
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD; DM
includes DM, DHM; DS includes DS, DHS.
M includes M, HM; S includes S, HS; T includes T, HT; C includes C, HC.
Intruction
S1· S2· S3· S4· S5· D1.
X0
BIT_READ K1 K2 K3 K0 K8 Y0
Function: read the station no.2 coil M0~M7 to local address Y0~Y7 in ID1 network.
1. Intruction explanation
Write the local coil value to target coil.
Write bit [BIT_WRITE]
Execution Edge trigger Suitable XD3, XDM
conditoin model
Hardware V3.2 and up Software V3.2 and up
2. Operand
Operand Function Type
S1 Target net ID 16 bits constant or single word register
S2 Target station number 16 bits constant or single word register
S3 Target object type (refer to chapter 16 bits constant or single word register
7-3-4)
S4 Target object address (refer to 32 bits constant or double words register
chapter 7-3-4)
S5 Access object numbers 16 bits constant or single word register
S6 Local object address Local coil
Operand System
X Y M* S* T* C* Dn.m
Bit S6 ● ● ● ● ● ●
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD; DM
includes DM, DHM; DS includes DS, DHS.
M includes M, HM; S includes S, HS; T includes T, HT; C includes C, HC.
Intruction
S1· S2· S3· S4· S5· S6.
X0
BIT_WRITE K1 K3 K2 K0 K8 M0
Function: write the local coil M0~M7 to station no.3 Y0~Y7 in ID1 network.
Read register [REG_READ]
1. Instruction explanation
Read the target register to local register.
Read register [REG_READ]
Execution Edge trigger Suitable XD3, XDM
conditoin model
Hardware V3.2 and up Software V3.2 and up
2. Operand
Operand Function Type
S1 Target net ID 16 bits constant or single word register
S2 Target station number 16 bits constant or single word register
S3 Target object type (refer to chapter 16 bits constant or single word register
7-3-4)
S4 Target object address (refer to 32 bits constant or double words register
chapter 7-3-4)
S5 Access object numbers 16 bits constant or single word register
D1 Local object address Local register
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD; DM
includes DM, DHM; DS includes DS, DHS.
M includes M, HM; S includes S, HS; T includes T, HT; C includes C, HC.
Intruction
S1· S2· S3· S4· S5· D1.
X0
REG_READ K1 K2 K128 K0 K10 D0
Function: read the station no.2 register D0~D9 to local address D0~D9 in ID1 network.
2. Operand
Operand Function Type
S1 Target net ID 16 bits constant or single word register
S2 Target station number 16 bits constant or single word register
S3 Target object type (refer to chapter 16 bits constant or single word register
7-3-4)
S4 Target object address (refer to 32 bits constant or double words register
chapter 7-3-4)
S5 Access object numbers 16 bits constant or single word register
S6 Local object address Local register
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD; DM
includes DM, DHM; DS includes DS, DHS.
M includes M, HM; S includes S, HS; T includes T, HT; C includes C, HC.
Intruction
S1· S2· S3· S4· S5· S6.
X0
REG_WRITE K2 K5 K128 K0 K10 D0
Function: write the local register D0~D9 to station no.5 D0~D9 in ID2 network.
NetID: the network number of the two PLC. The device net ID in the same network must be
the same. Here we set it to 1.
StationID: each PLC station number in the network. The two PLC station number is 1 and 2.
Net type: it is PLC communication, please choose TBN.
Baud rate: here we set it to 1.5M
TokenCycle time: the time of each station in the network cycle once, the unit is ms. Here we
have two PLC, so the time set to 10ms.
Max station number: the max device numbers in the network. As the X-NET communication
max station no. is 32, so it is set to 32.
Click “write config”, it will show read success window.
Click ok to back to the main window. Cut off the PLC power and power on again to make the
setting effective.
Then click config/single device/route.
The subnet ID is the same to the netID. The communication port is the PLC physical terminal,
RS485 port number is 4. Gateway address: the default setting is 0.
Click “write”, it will show write success. Then click ok. Please cut off the PLC power and
power on again to make the setting effective.
PLC B RS485 configuration is the same to PLC A.
BIT_WRITE K1 K2 K3 K0 K10 M0
8-1.PID Introduction
PID instruction and auto tune function are added into XD series PLC basic units. Via auto
tune method, users can get the best sampling time and PID parameters and improve the
control precision.
PID instruction has brought many facilities to the users.
Output can be data form D, HD, and on-off quantity Y, user can choose them freely when
programming.
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. Positive action is used for
heating control; negative action is used for cooling control.
PID control separates the basic units with the expansions, which improves the flexibility of
this function.
XD3 series PLC have two methods for auto tune, step response method and critical oscillation
method.
For temperature control object:
Step response method: the PID auto tune will start when current temperature of object
controlled is equal to ambient temperature.
Critical oscillation method: the PID auto tune can start at any temperature.
8-2.Instruction Form
Brief Introduction of the Instructions
Execute PID control instructions with the data in specified registers.
PID control [PID]
16 bits PID 32 bits -
instruction instruction
Executing Normally ON/normally closed Suitable XD3, XDM
condition coil trigger models
Hardware Software V3.2
requirement requirement
Operands
Operands Function 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 16 bits, BIN; bit
port
Suitable soft components
Operands System
Bit
X Y M* S* T* C* Dn.m
D ● ● ● ● ●
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
M includes M, HM, SM; S includes S and HS; T includes T and HT; C includes C and HC.
S3~ S3+ 69 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.
For the operation result, data registers are used to store PID output values; the output points
are used to output the occupy duty ratio in the form of ON/OFF.
PID control rules are shown as below:
P: proportion, I: integral, D: differential
+
P
r(t) + e(t) u(t) c(t)
+ Controlled
I
object
-
D +
Here, e(t) is offset value, r ( t ) is the setting value, c ( t ) is actual output value and the u(t) is
the control value;
In function (1-2), Kp is the proportion coefficient, Ti is the integration time coefficient, and
TD is the differential time coefficient.
The result of the operation:
1.Analog output: digital form of MV = u(t), the default range is 0~4095.
2.Digital output: Y = T * [MV / PID output upper limit]. Y is the outputs activate time
within the control cycle. T is the control cycle, equals to the sampling time. PID output upper
limit default value is 4095.
8-3.Parameters setting
Users can call PID in XCP Pro software directly and set the parameters in the window (see
graph below), for the details please refer to XCP Pro user manual. Users can also write the
parameters into the specified registers by MOV instructions before PID operation.
Auto tune mode:
V3.2 and higher version software can choose auto tune mode: step response or critical
oscillation.
If the target value is 100, PID operation zone is 10, and then the real PID’s operation zone is
from 90~110.
D0
+DIFF
D0
Setting value
D0
-DIFF
Output
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. If bit8 of (S3+ 2) turn to 1, it means the auto tune is successful.
PID auto tune period value [S3+12]
Set this value in S3+12 during auto tune.
This value decides the auto tune performance, in a general way, set this value to be AD result
corresponding to one standard tested unit. The default value is 10. The suggested setting
range: fall-scale AD result×0.3~1%.
User doesn’t need to change this value. However, if the system is interfered greatly by
outside, this value should be increased modestly to avoid wrong judgment of positive and
negative movement. If this value is too large, the PID control period (sampling time) got from
the auto tune process will be too long. As the result do not set this value too large.
※1:If users have no experience, please use the default value 10, set PID sampling time
(control period) to be 0msthen start the auto tune.
℃
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+15]
This parameter is valid only when [S3+13] is 1;
If entering into PID control directly after auto tune, small range of overshoot may occur. It is
good to prevent 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-5.Advanced Mode
Users can set some parameters in advanced mode in order to get better PID control effect.
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
Users can choose the analog output range via setting this value.
Default value: lower-limit output =0
Upper-limit =4095
8-6.Application outlines
Under the circumstances of continuous output, the system whose effect ability will die down
with the change of the feedback value can do auto tune, such as temperature or pressure. It is
not suitable for flux or liquid level.
Under the condition of overshooting permission, the system will get the optimal PID
parameters from self study.
Under the condition that overshoot not allowed, the PID parameters got from auto tune 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 auto tune 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:
M1 HD2.7
( S ) // auto tune mode, or set to autotune mode
after auto tune end
M2
M2
HD2.8 HD09 K0 M1
( R ) // if auto tune is successful, and overshoot is
permitted, close auto tune control bit, auto
HD2.8 HD09 K1 tune will finish;
If auto tune turns to be manual mode, and
overshoot is not permitted, close auto
tune control bit.
Soft element function comments:
HD2.7: Auto tune bit
HD2.8: Successful flag of auto tune
M0: Normal PID control
M1: Auto tune control
M2: Enter PID control after auto tune
Operation steps:
1. Send the actual temperature to PID collection register
2. Set probably value for P, I, D, sampling period
3. Set ON auto tune control bit M1 to startup PID auto tune
4. M1 will be reset after the auto tune is finished
5. Set ON M0, use the PID parameters getting from auto tune
6. If the PID effect is not good by using the auto tune PID parameters, user can adjust the PID
parameters to get good effect.
Example 2:
To control the target temperature 60°C in step response mode.
Overshoot is permitted:
1. The target temperature 60°C (6000)
2. Parameters setting
Note:
1. When the temperature reaches 100 degree and stops heating, the PID start bit D4002.7 will
not reset at once, it has delay before reset.
2. When the temperature reaches 100 degree and stops heating, the PID auto tune success bit
D4002.8 will be ON at once.
3. When it starts PID calculation, the PLC will auto set a sampling time (about 2500). This
parameter will be replaced by the PID best sampling time after stoping heating at 100 degree.
4. When it starts PID calculation, the PLC will auto set the PID parameters (P=4454, I=926,
D=2317). These parameters will be replaced by the best PID value after stoping heating at
100 degree.
5. When the temperature reaches 100 degree and stops heating, the PID start bit D4002.7 will
not reset at once, it has delay before reset. At this time, the sampling temperature is higher
than target temperature. If user sets ON the PID auto tune again, PLC will get all the PID
parameters as 0. Please set ON the PID after the temperature decreases under the normal
atmospheric temperature.
6. If PID auto tune start bit and auto tune success bit are power-off retentive, please set or
reset them propably to avoid calculation error when starting the PLC next time.
7. The final heating temperature will up to 110 degree when the overshoot is permitted. It is
over the target temperature by 50 degree, the overshoot amount is too large.
8. When the PID starts to work, the output will heat the object from 28 degree to 60 degree,
then the output is forced to stop heating to avoid overshoot, but this will interrupt the PID
auto tune process.
9. To enlarge the PID calculation range can suppress the heating overshoot.
Note:
1. When the temperature reaches 48 degree and stops heating, the PID start bit D4002.7 will
not reset at once, it has delay before reset.
2. When the temperature reaches 48 degree and stops heating, the PID auto tune success bit
D4002.8 will not be ON at once. It hasn’t set ON even when the auto tune succeeded.
3. When it starts PID calculation, the PLC will auto set a sampling time (about 2500). This
parameter will be replaced by the PID best sampling time after stoping heating at 48 degree.
4. When it starts PID calculation, the PLC will auto set the PID parameters (P=4454, I=926,
D=2317). These parameters will be replaced by the best PID value after stoping heating at 48
degree.
5. When the temperature reaches 48 degree and stops heating, the PID start bit D4002.7 will
not reset at once, it has delay before reset. At this time, the sampling temperature is higher
than target temperature. If user sets ON the PID auto tune again, PLC will get all the PID
parameters as 0. Please set ON the PID after the temperature decreases under the normal
atmospheric temperature.
6. If PID auto tune start bit and auto tune success bit are power-off retentive, please set or
reset them propably to avoid calculation error when starting the PLC next time.
7. The final heating temperature will up to 70 degree when the overshoot is permitted. It is
over the target temperature by 10 degree, the overshoot amount is small.
8. To enlarge the PID calculation range can suppress the heating overshoot.
9 C Language 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.Summary
XD3, XDM supports almost all C language function in XDPPro software (also supports
global variable). Users can call the function at many places and call different functions, which
greatly increase program security and programmer’s efficiency.
9-2.Instruction Format
1. Instruction Summary
Call the C language Function Block at the specified place.
Call the C language function block [NAME_C]
16 bits NAME_C 32 bits -
instruction Instruction
Execution Normally ON/OFF, Suitable XD3, XDM
condition Rising/Falling Edge activation Models
Hardware Software
2. Operands
Operands Function Type
S1 Name of C Function Block, defined by the user String
S2 Corresponding start ID of word W in C language 16 bits, BIN
function
S3 Corresponding start ID of word B in C language bit, BIN
function
3. Suitable Soft Components
Operands System
X Y M S* T* C* Dn.m
Bit
S3 ●
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS. M includes M, HM, SM; S includes S
and HS; T includes T and HT; C includes C and HC.
S1 is the function name. It consists of numbers, letters and underlines. The first character
can’t be number, and the name length should be < =9 ASC.
The name can be the same with PLC’s self instructions like LD, ADD, SUB, PLSR etc.
The name can’t be the same with the function blocks existing in current PLC;
9-3.Operation Steps
1. Open PLC edit tool, in the left “Project” toolbar, choose “Func Block”, right click it and
choose “Add New Func Block”.
Function Block name is the name we use to call the BLOCK. For example: the diagram of
FUNC1 should be written as below:
M0
FUNC1 D0 M0
3. After creating the new Function Block, you can see the edit interface as shown below:
Parameters’ transfer way: if call the Function 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 the used parameters in the
ladder are D100, M100, then W[0] is D100, B[0]is M100; if the parameters in the ladder
are HD0, HM0, then W[0]=HD0,B[0]=HM0; if the parameters in the ladder are D100,
HM100, then W[0]=D100, B[0]=HM100. So, word and bit components start address are
defined in PLC program by the user.
Note: The coil and data type in one C language should be the same. All the coils in C
language are power loss retentive, or not power loss retentive; so is the same with data
register.
Parameter W: represent Word soft component, use it in the form of data group. E.g W[0]=1;
W[1]=W[2]+W[3]; in the program, use soft components according to standard C language
rules.
Parameter B: represent Bit soft component, use it in the form of data group. Support SET
and RESET. E.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 double-word W[10]W[11]. Double-word operation: Support the definition of floating
variable in the function, and execute floating operation; (E.g: float register D0(double
word) means FW[0], FW[0]=123.456)
Other soft elements definition in C language:
In C language of PLC, if you want to use input(X) and output(Y), then macro definition
‘#define SysReg Addr_X_Y’ is needed; E.g: send the state of input X0 to given coil M0, then
B[0]=X[0]; send the state of Y0 to given coil M10, then: B[10]=Y[0];(Note: corresponding
X Y in C language is decimal, not Octonary number).
In a similar way, if the not-power-loss-retentive flow S, Counter C, timer T, counter register
TD is in the C language, macro definition ‘#define SysRegAddr_S_C_T_CD_TD’ is also
needed; if the power-loss-retentive flow HS, counter HC, timer HT, counter register HCD,
timing register HTD etc, macro definition ‘#define SysRegAddr_HS_HC_HT_HCD_HTD’ is
needed.
E.g: W[0]=CD[0];W[1]=TD[0];B[1]=C[0];B[2]=T[0];
Function Library: In Function Block, users can use the Functions and Constants in function
library directly. For the Functions and Constants in function library, see 9-8.
The other data type supported:
BOOL; //BOOL Quantity
INT8U; //8 bits unsigned integer
INT8S; //8 bits signed integer
INT16U //16 bits unsigned integer
INT16S //16 bits signed integer
INT32U //32 bits unsigned integer
INT32S //32 bits signed integer
FP32; // single precision floating
FP64; //double precision floating
Predefined Marco: #define true 1
#define false 0
#define TRUE 1
#define FALSE 0
9-4.Import and Export the Functions
1. Export
(1) Function: Export the function as the file, then other PLC program can import to use;
2. Import
Function: Import the existing Func Block file, to use in the PLC program.
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 modifying the program. In the information list, we can
confirm that there is no grammar error in the program.
(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 the toolbar, we can see that D2 changes to be 30, it means
assignment is successful;
Free Monitor
9-6.Program Example
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.
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.
C program
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;
9-7.Application
In one Func Block file, you can write many functions, and they can be called by each other.
Each Func Block file is independent, they can’t call block in each other;
Func Block files can call C language library function in form of floating, arithmetic like sin,
cos, tan.
XC series PLC only support local variable, while XD3 series PLC support both local and
global variable. This makes C language Block more flexible and convenient.
XDPPro software v3.3 and later version keep C function library:
For example: click TEL10, the function name will show on the project bar:
User can call it in the ladder chart editing window at any time.
9-8.Function Table
The default function library
Constant Data Description
_LOG2 (double)0.693147180559945309417232121458 Logarithm of 2
_LOG10 (double)2.3025850929940459010936137929093 Logarithm of 10
_SQRT2 (double)1.41421356237309504880168872421 Radical of 2
_PI (double)3.1415926535897932384626433832795 PI
_PIP2 (double)1.57079632679489661923132169163975 PI/2
_PIP2x3 (double)4.71238898038468985769396507491925 PI*3/2
Sequence Block
SBSTOP Pause BLOCK SBSTOP S1 S2 10-6-1
Go to execute SBGOON S1 S2
SBGOON 10-6-1
BLOCK
Sequence block whose brief name is BLOCK is a program block to realize some functions.
As a special flow, all instructions in the block are executed in order, which is the biggest
difference with general processes.
BLOCK starts from SBLOCK and ends with SBLOCKE, and programmers can write
instructions in the BLOCK. If one BLOCK contains multiple pulse output instructions(or
other instructions), then pulse output instructions will execute in accordance with conditions
meet order; And meanwhile the next pulse output instruction will not execute until the current
instruction is over.
The XD3, XDM series PLC supports multiple BLOCKs※1.
A complete BLOCK structure is shown as below:
Instruction
Pulse output
Read write module
All instructions in
G code
BLOCK is executed in
Wait instruction
order
Command list
In one program file, it can call many BLOCK; the following is the method to add BLOCK in
the program.
Click the command ‘add sequence block’, the following window will jump out:
You can edit the BLOCK in the window, Upwards/Downwards are used to change the
position of instructions in the block.
Click ‘insert’ button, some instructions list under the menu:
Meantime, a new sequence block is added in the right of the project bar:
10-2-2.Move the BLOCK
If you want to move the BLOCK to other place, you have to select the original BLOCK and
delete it (select all, then delete):
Move the cursor to the new place, and then right click the BLOCK and select ‘add to lad’:
10-3-1.Command item
Use ‘command item’ to edit the program:
An ‘instruction list’ will jump out after click the ‘command item’:
Note: We can add multiply instructions in one BLOCK and use ‘Skip’ as every instruction’s
execution condition.
10-3-2.Pulse Item
Open the ‘pulse item’ in the same way:
In the following BLOCK, we add two impulse instructions:
10-3-3.Wait Item
‘Wait Item’: to wait coil flag or timer bit.
Open ‘Wait Item’ in the same way. There are two waiting modes: flag bit and timer wait.
(A) Flag bit
This item is used to read and write data between PLC and modules, and the operate panel is as
below:
1#read
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
M1
M2
M3
M2
2
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
The instructions running sequence in block 1 is shown as below:
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-5.BLOCK instruction editing rules
In the BLOCK, the instruction editing should accord with some standards.
Do not use the same pulse output terminal in different BLOCK.
NO(×) YES(√)
Do not use the same pulse output terminal in BLOCK and main program.
NO(×) YES(√)
There only can be one SKIP condition for one BLOCK instruction.
NO(×) YES(√)
The SKIP condition only can use M, X, can not use other coil or register.
NO(×) YES(√)
6. BLOCK is not recommended to put in the STL, because if one STL ends, while the
BLOCK doesn’t end, then big problem will happen.
NO(×) YES(√)
STL S0 S0
SBLOCK
SM0
SBLOCK FROM K0 K1 K5 D100
FROM K0 K1 K5 D100
WAIT K1 K50
WAIT K1 K50
PLSR HD0 HD100 K1 Y0
PLSR HD0 HD100 K1 Y0
SBLOCKE
SBLOCKE STL S0
M100 Y0 Y0
( ) M100
( )
STLE
STLE
Summarization
Stop the instructions running in the block
[SBSTOP]
16 bits SBSTOP 32 bits -
Condition NO,NC coil and pulse edge Suitable XD3, XDM
types
Hardware Software V3.2
Operand
Operand Function Type
S1 The number of the BLOCK 16bits, BIN
S2 The mode to stop the BLOCK 16bits, BIN
Suitable component
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
S1· S2·
Function M1
↑ SBSTOP K1 K0
Execute
SBSTOP
frequency
K1 K0
0 t
Continue running the BLOCK[SBGOON]
Summarization
This instruction is opposite to SBSTOP. To continue running the BLOCK.
[SBGOON]
16 bits SBGOON 32 bits -
Condition Pulse edge Suitable XD3, XDM
types
Hardware - Software V3.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
Suitable component
*Note: D includes D, HD; TD includes TD, HTD; CD includes CD, HCD, HSCD, HSD;
DM includes DM, DHM; DS includes DS, DHS.
S1· S2·
Function M3
↑ SBGOON K1 K0
When M0 is from OFF→ON, run “PLSR HD0 HD100 K1 Y0” in the BLOCK to output the
pulse;
When M2 is from OFF→ON, the BLOCK stops running at once;
When M4 is from OFF→ON, abandon the rest pulse.
Condition M0
M0
Condition M2
M1
Condition M4
PLS Y0
PLS Y0
When M0 is OFF→ON, run ‘PLSR HD0 HD100 K1 Y0’ in the BLOCK to output the pulse;
When M2 is OFF→ON, the BLOCK stops running, the pulse output stops at once;
When M4 is OFF→ON, output the rest pulses.
…….. …….
…….. …….
BLOCK100 running
SD399
instruction
11 Special Function Instructions
This chapter mainly introduces PWM (pulse width modulation), precise timing, interruption
etc.
Chapt
Mnemonic Function Circuit and soft components
er
Pulse Width Modulation, Frequency Detection
Output pulse with the
PWM specified duty cycle and PWM S1 S2 D 11-1
frequency
FRQM S1 D S2 S3
Fixed pulses frequency
FRQM 11-2
measurement
Time
STR Precise Time STR D1 D2 11-3
Interruption
EI
EI Enable Interruption 11-4-1
DI
DI Disable Interruption 11-4-1
IRET
IRET Interruption Return 11-4-1
Operands System
Bit X Y M* S* T* C* Dn.m
D ●
Function and
Action
S1· S2· D·
X0
PWM K100 D10 Y0
Note: it needs to connect 1K ohm amplification resistor between output terminal and common
terminal when using PWM instruction.
Example
There is a LED drived by DC24V. It needs to control the brightness of the LED. In order to
decrease the power loss of wave collector, turn ON the switch at the moment it is OFF, then
turn it OFF. This process will cycle. Connet a transistor between the power supply and LED.
The pulse signal will input from the transistor base terminal. The current between base and
emitter is pulse. The LED input voltage is proportional to the duty ratio. The LED input
voltage will be changed by changing the duty ratio. There are many methods to change the
value. The normal way is pulse width modulation (PWM) which means only changing the ON
holding time but not changing the ON frequency.
This example applies the PWM technology to the LED brightness adjustment. The controller
can accpet 24V PWM control signal. The brightness range includes 25%, 50%, 75%, 100%.
The brightness is controlled by the PWM duty ratio.
Element explanation:
PLC Explanation Mark
component
X0 Start button, X0 is ON when pressed.
X1 Stop button, X1 is ON when pressed.
X2 25% brightness button, X2 is ON when
pressed.
X3 50% brightness button, X3 is ON when
pressed.
X4 75% brightness button, X4 is ON when
pressed.
X5 100% brightness button, X5 is ON when
pressed.
HD0 PWM duty ratio register
HD2 PWM frequency register Defaulted
100Hz
Program:
SM2
MOV K100 HD2
X0
MSET M0 M1
X1
MOV K0 HD0
ZRST M0 M1
M0 M2 M3 M4 M5
MOV K8192 HD0
M2 M3 M4 M5
MOV K16384 HD0
M2 M3 M4 M5
MOV K24576 HD0
M2 M3 M4 M5
MOV K32767 HD0
M1
PWM HD0 HD2 Y0
Program explanation:
1. HD0 will control the LED voltage. The voltage = 24*HD0/32767, pulse output frequency
is 100Hz.
2. Press start button, X0 is ON, M0, M1 is ON, the LED brightness adjustment starts.
3. X2 is ON, HD0=8192, HD0/32768=0.25, the LED brightness is 25%.
4. X3 is ON, HD0=16384, HD0/32768=0.5, the LED brightness is 50%.
5. X4 is ON, HD0=24576, HD0/32768=0.75, the LED brightness is 75%.
6. X5 is ON, HD0=32768, HD0/32768=1, the LED brightness is 100%.
7. Press shut down button, X1 is ON, HD0 is reset, shut down the PWM trigger condition,
LED voltage is 0V.
2. Operand
Operands Function Type
S1 Sampling pulse numbers 32 bits, BIN
S2 Frequency division option 32 bits, BIN
D Measurement result 32 bits, BIN
S3 Pulse input terminal bit
3. Suitable component
Operand System
Bit X Y M* S* T* C* Dn.m
D ●
Function
and Action
The sampling pulse numbers can be adjusted according to the frequency, the higher the
frequency, the bigger the sampling pulse numbers
Measurement result, the unit is Hz
Frequency division option, the range is 1 or 2. Whatever 1 or 2, the frequency range is 1Hz to
80KHz
When M0 is ON, FRQM collects 20 pulses from X0, and records the sampling time. The result
of sampling numbers dividing by sampling time will be saved in D100. The measurement
process will repeat. If the measurement freqeuncy is less than the measurement range, the result
is 0
The measurement precision is 0.001%
Component explanation:
PLC Control explanation Mark
component
X0 Proximity switch, to count the gear numbers
M0 Start signal
D16 Speed register (float number)
Program:
M0
FRQM K20 D0 X0 K1
DFLT D0 D2
EDIV D2 K100 D4
EMUL D4 D6 D10
Operands system
Bit X Y M* S* T* C* Dn.m
D ●
D1 ●
Function
and Action
ET0
Y0
M0
RST ET0
D1· Timer’s number. Range: ET0~ET30 (ET0, ET2, ET4……all number should be even)
D2· Timing value
Precise timer works in unit of 1ms.
Precise timer 32 bits, the counting range is 0~+2,147,483,647.
When executing STR, the timer will be reset before start timing.
When X0 turns from OFF to ON, ET0 starts timing. ET0 will be reset and keep its value 100
when accumulation time reaches 100ms; If X0 again turns from OFF to ON, timer T600 turns
from ON to OFF,restart to time, when time accumulation reaches 100ms, T600 reset again.
See graph below:
X0
ET0
100ms 100ms
M0
D·
X0
DMOV ET0 D0 When X0 changes from OFF to ON, move the
current precise timing value into D0
immediately, it will not be affected by the scan
cycle;
D·
M0 When M0 changes from OFF to ON, execute
STOP ET0
STOP instruction immediately, stop precise
timing and refresh the count value in ETD0. It
will not be affected by the scan cycle;
Precise Timing Interruption
When the precise timing reaches the count value, it will generate an
interruption tag, interruption subprogram will be executed.
Can start the precise timing in precise timing interruption;
Every precise timer has its own interruption tag, as shown below:
Note: XD3-16, XD3-24, XD3-32, XD3-48, XD3-60, XDM-24, XDM-32, XDM-60T10 timer
number are ET0, ET2, ET4, ET6……ET24; XDM-60T4 timer number is ET0, ET2, ET4,
ET6……ET22.
X0
STR ET0 K100 When X0 changes from OFF to ON,
ET0
ET0 will start timing. And ET0 reset
Y0 when accumulation time is up to
100ms; meantime generate an
M0
RST ET0 interruption, the program jumps to
interruption tag I3000 and execute the
FEND subprogram.
I3000
SM0
Y1
SM0
M1
IRET
Example 1
The filling machine controls the filling capacity by controlling the liquid valve open time (it is
3000ms in this application). To improve the filling capacity precision, the liquid valve open
time can be controlled by precise timing.
Filling machine
Component explanation:
PLC Control explanation Mark
component
X0 Start button, X0 is ON when the button is pressed
ET0 Precise timer
Y0 Control the liquid valve, Y0 ON when the valve
opened, Y0 OFF when the valve closed
Program:
X0 Y0
( S )
ET0 Y0
( R )
RST ET0
Program explanation:
1. When X0 is ON, the liquid valve Y0 and precise timer ET0 open at once.
2. Shut down the liquid valve Y0 and precise timer ET0 when the time arrived.
Example 2
The precise timer interruption can produce the following pulse wave. The Y2 ON time is
500ms, the pulse period is 1000ms.
Component explanation:
Program:
X0
STR ET0 K500
X0
RST ET0
FEND
I3000
SM0 Y2 Y2
( S )
PLS M0
M0 Y2 Y2
( R )
SM0
STR ET0 K500
IRET
END
Program explanation:
1. When X0 is ON, the precise timer interruption will work, Y2 will output the pusle wave.
2. When X0 is OFF, shut down the precise timer interruption, Y2 stop outputting.
Example 3
As the FRQM calculating the time for fixed pulse numbers, we will change the way to
calculate the pulse numbers in fixed time.
Component explanation:
PLC Control explanation Mark
component
M0 Start button, X0 is ON when pressed
ET0 Precise timer
HD0 Precise timer setting value (unit: ms)
HSC0 High speed counter
D10 The measured frequency (unit: s)
Program:
M0
STR ET0 HD0
M0
RST ET0
M0
CNT HSC0 K999999999
DMOV HSC0 D0
FEND
I3000
SM0
DFLT D0 D2
DFLT HD0 D4
EDIV K1000 D4 D6
EMUL D2 D6 D8
DINT D8 D10
DMOV K0 HSC0
SM0
STR ET0 HD0
IRET
END
Program explanation:
1. Set the high speed counter sampling period register HD0, the unit is ms.
2. Set ON M0 to start the precise timer interruption and high speed counter, calcuate the
frequency
3. The frequency range is 0-80KHz, the precision is 0.005%.
11-4. Interruption [EI], [DI], [IRET]
XD3 series PLC have interruption function, including external interruption and timing
interruption. By interruption function we can deal with some special programs. This function
is not affected by the scan cycle.
11-4-1.External Interruption
The input terminals X can be used to input external interruption. Each input terminal
corresponds with one external interruption. The input’s rising/falling edge can activate the
interruption. The interruption subroutine is written behind the main program (behind FEND).
After interruption generates, the main program stops running immediately, turn to run the
correspond subroutine. After subroutine running ends, continue to execute the main program.
Subprogram
Input Interrupt
Note: The external interruption of XC series PLC cannot be activated by rising edge
and falling edge at the same time; but XD3 series PLC supports rising edge and falling
edge activation meantime.
XD3-16 points
Pointer No. Disable the
Input
Rising Falling interruption
terminal
Interruption interruption instruction
X2 I0000 I0001 SM050
X3 I0100 I0101 SM051
X4 I0200 I0201 SM052
X5 I0300 I0301 SM053
X6 I0400 I0401 SM054
X7 I0500 I0501 SM055
Interruption Instruction
Example 1
The positions of A, B, C are unknown. The speed of the three segments are different. The
application can be perform by PLSF instruction and external interruption. We can install three
proximity switch at postion A, B, C, and connect the signal to PLC input terminal X0, X1,
X2. (suppose X0, X1, X2 are external interruption terminal, the related rising edge
interruption ID are I0000, I0100, I0200. The PLC external interruption terminal please refer
to “external interruption terminal definition). The pulse terminal is Y0, the direction terminal
is Y2. To improve the speed changing precision, the acceleration and deceleartion time are 0.
The speed will switch by external interruption.
Segment Frequency setting Pulse numbers
value (Hz)
Origin ---- A 10000 999999999
A---- B 30000 999999999
B ----- C 20000 999999999
Acceleration 0
and deceleratoin
time
Note: as the pulse numbers of each segment is unknown, the pulse numbers should set large
enough to ensure the object can move to the proximity switch. The STOP instruction will be
run by external interruption when the object gets to position C.
Component explanation
PLC Control explanation Mark
component
M0 Start button, PLSF will send pulse when the
button is pressed
HD0 the PLSF pulse frequency register
Program
SM2
DMOV K10000 HD0
M0
PLSF HD0 K1 Y0
FEND
I0000
SM0
DMOV K30000 HD0
IRET
I0100
SM0
DMOV K20000 HD0
IRET
I0200
SM0 M0
( R )
STOP Y0 K1
IRET
END
Program explanation
1. SM2 is ON, set HD0 to 10000, set on M0, PLSF instruction will send 10000Hz pulse, the
object will move from origin to A.
2. When the object touches A, X0 will be ON at once, the external interruption I0000 will
work, HD0 is set to 30000, the object will move from A to B with the speed of 30000Hz.
3. When the object touches B, X1 will be ON at once, the external interruption I0100 will
work, HD0 is set to 20000, the object will move from B to C with the speed of 20000Hz.
4. When the object touches C, X2 will be ON at once, the external interruption I0200 will
work, M0 is set OFF, the pulse sending will stop at once.
Example 2
The diagram is the product packing machine. The robot will pack the product when 30
products are detected, the robot and counter will be reset after packing completed. To
improve the working efficiency, the product sending speed is very fast, the sensor X2 detects
the product time is 8ms, PLC input terminal filter time is 10ms, the normal counter cannot
detect the products. We can use the external interruption to count the products.
Component explanation:
PLC Control explanation Mark
component
X2 Product counting photoelectric sensor, X2 is ON when
the product is detected
X1 Robot action complete sensor, X1 is ON when the
action is completed
C0 16-bit counter
Y0 Robot
Program:
M0 Y0
( )
X1 M0
( R )
Y0
( R )
RST C0
FEND
I0000
SM0
CNT C0 K30
C0 M0
( S )
IRET
END
Program explanation:
1. In the external interruption program, count the X2 input, when the X2 is 30, set ON M0
2. In the main program, it controls the Y0 according to the M0 state.
3. When the robot action is completed, X1 changes from OFF to ON once, RST works, Y0
and C0 are reset, M0 is OFF, wait for the next packing process.
Under the circumstance that the main program execution cycle is very long, when you
have to handle with special program or execute specific program every once in a while
when program is scanning in sequence control, the timing interruption is very useful. It is
not affected by PLC scan cycle and executes timing interruption subroutine every N ms.
X0
Y0
FEND
I4010
SM0
INC D0
IRET
Timing interruption is open status in default, just like other interruption subroutines, it
should be written behind the main program, starts with I40xx, ends with IRET.
There are 20CH timing interruptions, representation: I40**~I59**(‘**’means
interruption time; Unit is ms. E.g: I4010 means executing once the first timing
interruption per 10ms.
Interruption No
Interruption allowed
DI
Interruption forbidden
EI
Interruption allowed
FEND
I4010
Interruption forbidden
IRET
Interruption Forbidden
EI
Interruption
M0
Allowed The first 3CH timing
SM070
interruptions are equipped with
special relays (SM070~SM079).
FEND
In the left example, if use M0 to
I4020 set SM070 “ON”, then forbid
Interruption timing interruption forbidden.
Program
IRET
END
12 Application Example
This chapter mainly introduces main instructions, such as pulse output and Modbus
communication instructions, and gives some examples.
Pulse parameters
Address Explanation Value
HD0 (dword) Pulse segment quantity (1~100) 3
HD2 (8 Reserved (8 words)
0
words)
HD10 (dword) Pulse frequency (segment 1) 3000
HD12 (dword) Pulse quantity (segment 1) 1000
bit15~bit8: wait condition (segment 1)
00: pulse sending end
01: wait time
02: wait signal
03: ACT time
04: EXT signal
HD14 0
05: EXT signal or pulse sending end
bit7~bit0: wait condition register type
00: constant
01: D
02: X
03: M
HD15 (dword) Constant/register(waiting condition) (segment 1) 0
bit7~bit0: jump register type
HD17 00: constant 0
01: D
HD+18 Constant/register (jump register) (segment 1)
0
(dword)
HD+20 Pulse frequency (segment 2)
800
(dword)
HD+22 Pulse quantity (segment 2) 2000
(dword)
Wait condition, wait condition register type
HD+24 0
(segment 2)
HD+25 Constant or register (waiting condition) (segment
0
(dword) 2)
Jump type, jump register type (waiting condition)
HD+27 0
(segment 2)
HD+28 Constant or register (jump register) (segment 2)
0
(dword)
HD+30 Pulse frequency (segment 3)
6000
(dword)
HD+32 Pulse quantity (segment 3)
8000
(dword)
Wait condition, wait condition register type
HD+34 0
(segment 3)
HD+35 Constant or register (waiting condition) (segment
0
(dword) 3)
Jump type, jump register type (waiting condition)
HD+37 0
(segment 3)
HD+38 Constant or register (jump register) (segment 3)
0
(dword)
System parameters:
Public parameter
Bit 0: pulse output logic
0: positive logic(default setting)
1: negative logic,
Bit 1:pulse direction logic
SFD900
Pulse parameters 0: positive logic(default setting) 0
1: negative logic
Bit 8: pulse unit
0: pulse quantity(default setting)
1: equivalent value
SFD901 Reserved 0
Pulse quantity/ 1
SFD902 0
rotation low 16 bits
Pulse quantity/ 1
SFD903 0
rotation high 16 bits
Movement amount/1
SFD904 0
rotation low 16 bits
Movement amount/1
SFD905 0
rotation high 16 bits
Pulse direction The number of Y, 0xFF is no
SFD906 2
terminal terminal
SFD907 Direction delay time Default value is 20, unit is ms 20
Gear clearance
SFD908 0
positive compensation
Gear clearance
SFD909 negative 0
compensation
Electrical origin low
SFD910 0
16 bits
Electrical origin high
SFD911 0
16 bits
Machine back to Bit0: promixity switch state
SFD912 0
origin parameters 0: normal open 1: normal close
Bit0~bit7: the X terminal
SFD913 Near signal terminal 0xFF
number, 0xFF is no terminal
Bit0~bit7: the X terminal
SFD914 Z phase terminal 0xFF
number, 0xFF is no terminal
Bit7~bit0: limit 1 X terminal
number, 0xFF is no terminal
SFD915 Limit terminal FFFF
Bit15~bit8: limit 2 X terminal
number, 0xFF is no terminal
Origin auxiliary signal Bit0~bit7: X terminal number,
SFD916 0xFF
terminal 0xFF is no terminal
CLR signal output Bit0~bit7: Y terminal number,
SFD917 0xFF
terminal 0xFF is no terminal
Back speed VH low
SFD918 0
16 bits
Back speed VH high
SFD919 0
16 bits
Back speed VL low
SFD920 0
16 bits
Back speed VL high
SFD921 0
16 bits
Creep speed low 16
SFD922 0
bits
Creep speed high 16
SFD923 0
bits
Mechanical origin low
SFD924 0
16 bits
Mechanical origin
SFD925 0
high 16 bits
SFD926 Z phase quantity 0
SFD927 CLR signal delay time Default value 20, unit: ms 20
G instruction which
G instruction system parameter
SFD936 group of parameter to 2
group choice
use
…
Group 1 parameters
Program
Software setting
Pulse wave:
12-2. MODBUS Communication Application
The following program is write and read of Modbus communication between 1 master station
and 3 slave stations.
Program operation
(1)Write Y0~~Y11 status of host station to 2# slave station Y0~~Y11;
(2)Read 2#slave station Y0~~Y10 to host station M10~~M19;
(3)Write D10~~D19 to 2#slave station D10~~D19;
(4)Read 2#slave station D10~~D19 to host station D20~~D29;
(5)So are the 3#、4# slave station
STL S0
S0 M0
( S )
Set Y0~Y11 of host station ON;
MOV HA0 DY0
M0
write the host state to 2#、3#、4#
MCLW D100 K18432 K10 Y0 K2 slave station Y0~Y11 in turn; and
M0 M8138 S1 enter Flow S1 after
( S )
M0
communicating successfully.
( R )
STLE
STL S1
S1 M1
( S )
M1
COLR D100 K18432 K10 M10 K2 M10~M19 in host station read
M1 M8138 S2 2#、3#、4#slave station
( S ) Y0~~Y11 state in turn; Reset
M1
( R ) Y0~Y11 of host station and enter
MOV K0 DY0
Flow S2.
STLE
STL S2
S2
FMOV K1 D10 K10
M2
M2
( S ) Write 1 to D10~D19 in host
MRGW D100 K10 D10 K2 station; Write 2#、3#、4#slave
M2 M8138 S3 station D10~D19 to host station
( S )
M2 register; Enter Flow S3 after
( R )
communicating successfully.
STLE
STL S3
S3 M3 Host station register D20~D29
( S )
M3 read D10~D19 in 2#、3#、
REGR D100 K10 K10 D20 K2 4#slave station; Reset host station
M3 M8138 D10~D19 after communicating
FMOV K0 D10 K10
successfully. Then station number
INC D100
increase 1, execute flow S0, and
S0
( S ) repeat above steps.
M3
( R )
STLE
Modbus RTU instruction can be written in program directly, and the protocol station will
queue Modbus communication request. Communication is another task which means users
can write multiply Modbus RTU communication instructions together in the main program,
and the instructions can be activated by one trigger condition. Then PLC will handle with this
Modbus RTU communication instructions in turn, while XC series PLC errors if multiply
communication instructions execute at the same time.
XD series program:
M200
MOV H3FF DY0 Set Y0~Y11 of host station and
write 1 to D10~D19 if M200 is
FMOV K1 D10 K10 rising edge; RST Y0~Y11 of
M201
MOV H0 DY0 host station and write 0 to
D10~D19 if M201 is rising
FMOV K0 D10 K10 edge.
M0
MCLW K2 K24576 K10 Y0 K2
write Y0~Y11 of host station to
COLR K2 K24576 K10 M10 K2 Y0~Y11 of 2#slave station;
MRGW K2 K10 K10 D10 K2
read Y0~Y11 of 2#slave
station to M10~M19; write
REGR K2 K10 K10 D20 K2 D10~D19 to D10~D19 of
2#slave station; read
MCLW K3 K24576 K10 Y0 K2
D20~D29 of 2#slave station
COLR K3 K24576 K10 M20 K2 to D20~D29 of host station,
and so on.
MRGW K3 K10 K10 D10 K2
Command language:
LDP M200 //set M200
MOV H3FF DY0 //send Hexadecimal 3FF to Y0~Y15
FMOV K1 D10 K10 //send decimal 1 to register D10~D19
LDP M201 //set M201
MOV H0 DY0 //send decimal 0 to Y0~Y15
FMOV K0 D10 K10 //send decimal 0 to register D10~D19
LD M0 //set M0
MCLW K2 K24576 K10 Y0 K2 //write Y0~Y11 status of host station to 2#slave
station Y0~Y11
COLR K2 K24576 K10 M10 K2 //read status of 2#slave station Y0~Y11 to host
station M10~M19
MRGW K2 K10 K10 D10 K2 //write host station D10~D19 to 2#slave
station D10~D19
REGR K2 K10 K10 D20 K2 //read 2#slave station D10~D19 to host
station D20~D29
MCLW K3 K24576 K10 Y0 K2 //write status of host station Y0~Y11 to 3#slave
stationY0~Y11
COLR K3 K24576 K10 M20 K2 //read status of 3#slave station Y0~Y11 to host
station
M20~M29
MRGW K3 K10 K10 D10 K2 //write 3 to D10~D19 of host station
REGR K3 K10 K10 D30 K2 //read D10~D19 status of 3#slave station to
D30~D39 of host station
MCLW K4 K24576 K10 Y0 K2 //write the status of host station Y0~Y11 to
Y0~Y11 of 4#slave station
COLR K4 K24576 K10 M30 K2 //read Y0~Y11 status of 4#slave station to
M30~M39 of host station
MRGW K4 K10 K10 D10 K2 //write D10~D19 of host station to D10~D19
of 4#slave station
REGR K4 K10 K10 D40 K2 //read D10~D19 of 4#slave station to
D40~D49 of host station
13 Common Questions and Answers
This chapter mainly introduces XD3 series PLC common questions and answers.
Choose correct communication serial port according to your PC actual serial port.; baud rate
selects 19200BPS, parity check selects even parity, 8 data bits, 1 stop bit; you can also click
‘check’ button directly in the window, and communication parameters will be selected by
PLC itself. ‘Connect PLC successfully’ will be displayed on the left bottom of window as
below:
Solutions:
At first, change the DVP or XVP cable used to connect PC and PLC to Xinje special cable if
it is not;
After confirming the connection cable is the Xinje special DVP cable and USB converter has
been used, you can use it to try to connect desktop PC with 9-needle serial port to PLC. If the
desktop PC can be connected correctly, please change the USB converter cable with higher
performance or install the USB converter serial driver software again.
If PLC can not connect with desktop computer correctly either, you can use ‘stop PLC when
reboot’ function to stop PLC and recover the PLC to factory setting, operating method is as
follow:
Power on PLC and connect PLC by DVP cables, then click ‘online’ button on PLC editing
software menu;
By this time, ‘Reset PLC’ information window will jump out and it means that all steps of
‘Stop when PLC reboot’ have been finished.
If initialize PLC unsuccessfully after you trying a few times or the following window jumps
out after clicking ‘Reset PLC’:
In both cases, use PLC system update tool to update PLC system, and PLC and PC will be
connected successfully if system is updated (For more steps about system update, please refer
to Q3 related content).
If update of the desktop computer with 9-pin serial port fails, it is very likely that PLC
communication port is damaged, and please contact manufacturer or agent.
Note: set the com port, the baud rate is default setting, no need to change.
Click “download”, the window will show below words:
Power on the PLC, the update tool will show below words:
Cut off the power of PLC, connect the short jumper, then power on the PLC again.
Example 1:
M100
MOV K3 DM0 When M100 is from OFF to ON,
M0 M1 are ON, M2—M15 are OFF
The other mode is bit operation of fixed register. E.g: D0.0 is the first bit of 16 bits in register
D0. Similarly, D0.1 is the second bit and so on, as shown below:
D0:
D0.15 D0.14 D0.13 D0.12 D0.11 D0.10 D0.9 D0.8 D0.7 D0.6 D0.5 D0.4 D0.3 D0.2 D0.1 D0.0
X0 status
LD X0 input
Q6: Why the output LED keeps flashing when using ALT instruction?
A6:
For ALT and many calculation instructions, these instructions will execute every scanning
period when the condition is fulfilled (for example, the condition is normal ON coil). We
recommend that the condition is rising edge or falling edge.
M0 Y0
( ) Y0 will be ON for one scanning period
Q8: Check and change the button battery in the PCB of PLC
A8:
The rated voltage of button battery is 3V. The voltage can be measured by multimeter. If the
value of power-loss retentive register is very large, it means the battery is low. Please change
the button battery.
FLT D2 D8
EDIV D6 D8 D10
Q13: Why the floating numbers become messy code in online ladder monitor window?
A13:
As the floating number cannot be displayed in online ladder monitoring, please monitor the
floating number in free monitor function.
Open XDPpro software, click online/free monitor. The following window will pop up:
Click “add” in the window, the following window will pop up. Set the monitor mode to
“float”. Monitor register set to D10. Then click ok.
Q15: Why the output point action errors after PLC running for a while?
A15:
It’s possible that output terminal is loose, please check.
Q16: Why expansion module does not work while power indicator is ON?
A16:
It is likely the connection of module strips and PLC pins or CPU is not good. Compare the
CPU and expansion in cross contrast way to find the problems.
Q17: Why pulse do not output when we get through the conduction condition?
A17:
First, make sure your PLC has pulse control function and output is transistor type.
Second, check if pulse instruction(absolute or relative instruction)and parameters are OK.
Third, check if there is double coils output of one pulse output terminal in program. Please
refer to Section 6-4 ‘notice’ in Chapter 6.
Q18: Why the corresponding temporary register still not count when the PLC input
terminal of HSC has been connected correctly?
A18:
To realize HSC function, we not only need connect the high speed pulse to HSC terminal, but
also need write corresponding HSC program according to function instructions; For more
details please refer to Chapter 5 ‘high speed counter’ in this manual.
Q21: What’s the difference of sequence function BLOCK trigger condition: rising edge
triggered and normally closed conduction?
A21:
Rising edge triggered: when the condition is triggered, block executes in order from top to
bottom; Normally closed conduction: when the condition is triggered, Block will execute in
order from top to bottom, return to the top and execute again until the normally closed
conduction breaks off. The cycle stops when the last one finished.
M0 M800
SBLOCK SBLOCK
Instruction 1 Instruction 1
Instruction 2 Instruction 2
Instruction 3 Instruction 3
SBLOCKE SBLOCKE
From up to down, run the instruction from up to down, cyclic run the instruction
one by one
Q22: what’s the advantage that XD series PLC replaces DVP download cable with
Bluetooth?
A22:
XD series PLC Bluetooth function can perform PLC program download and upload, monitor
and Twin configuration software online simulation. The Bluetooth can replace the cable to
transfer the data.
Note: COM-Bluetooth only fit for XINJE PLC.
Q23: XD series PLC program several download modes and each mode’s feature?
A23:
XD series PLC have three program download modes:
General download mode: Under this mode, users can download program from computer to
PLC or upload program from PLC to computer very conveniently, so we usually use this
mode when we debug devices.
Password download mode: If you set a password for PLC, you need input correct
password when you upload program in PLC to computer. In the password advanced options,
you still can check ‘decrypt before program download’ function(Note: this operation is
dangerous. If you forget password, your PLC will be locked!). If you want to protect your
program and still want to upload the program to use by yourself, you can use this mode.
Confidential download mode: Under this mode, once users download the program to PLC,
the program will not be uploaded anyway. This mode can save more PLC internal resources,
increase PLC capacity and improve download speed.
Q27: how to add soft element and line note in XDppro software?
A27:
Soft element note
Open XDPpro software, and move the mouse to the corresponding soft element and right
click the mouse, then menu will pop out:
Line note
Line note starts from “;”. Double click the line, then input semicolon and the contents.
Q28: do not have clock function?
A28:
XD series PLC clock function is optional, and if you want to buy the PLC with clock
function, please confirm when purchasing. Otherwise, the default PLC when it leaves factory
does not have clock function.
If the PLC has clock function, then please check whether the value in register SD13-SD19 is
decimal, if not, transform it to decimal by instruction BIN or TRD.
Appendix Special soft components
Appendix mainly introduces the functions of XD3 series PLC special soft element, data
register, FlashROM and the address distribution of expansions for users to search.
Initial Status(SM0-SM3)
ID Function Description
RUN
SM000 keeps ON
SM000 Coil ON when running Input
when PLC running
SM0
Coil OFF when SM001 keeps OFF
SM001
running when PLC running
SM1
SM3
Initial negative pulse Scan SM003 is OFF in first
SM003
coil period scan cycle
Clock(SM11-SM14)
ID Function Description
5ms
ID Function Description
SM020 Zero bit SM020 is ON when plus/minus operation result is 0
SM021 Borrow bit SM021 is ON when minus operation overflows
SM022 Carry bit SM022 is ON when plus operation overflows
PC Mode(SM32-SM34)
ID Function Description
When SM032 is ON, ON/OFF mapping memory of
Retentive register
SM032 HM、HS and current values of HT、HC、HD will be
reset
reset.
When SM033 is ON, all PLC user’s program will be
SM033 Clear user’s program
cleared.
When SM034 is ON, all PLC external contacts will be set
SM034 All output forbidden
OFF.
Stepping Ladder
ID Function Description
SM040
Interruption(SM50-SM80)
(M)
ID Address Function Description
SM050 I0000/I0001 Forbid input interruption 0 After executing EI instruction,
SM051 I0100/I0101 Forbid input interruption 1 the input interruption couldn’t
SM052 I0200/I0201 Forbid input interruption 2 act independently when M
SM053 I0300/I0301 Forbid input interruption 3 acts, even if the interruption is
SM054 I0400/I0401 Forbid input interruption 4 allowed.
…… …… …… E.g.:when SM050 is ON,
SM069 I1900/I1901 Forbid input interruption 19 I0000/I0001 is forbidden.
SM070 I40** Forbid timing interruption 0
SM071 I41** Forbid timing interruption 1 After executing EI instruction,
the timing interruption couldn’t
SM072 I42** Forbid timing interruption 2 act independently when M
SM073 I43** Forbid timing interruption 3 acts, even if the interruption is
SM074 I44** Forbid timing interruption 4 allowed.
…… …… ……
SM089 I59** Forbid timing interruption 19
SM090 Forbid all interruptions Forbid all interruptions
High Speed Pulse(SM140-SM199)
ID Function Description
SM1000 will be ON when sending the
SM1000 ‘Sending pulse’ flag pulse
SM1001 value being 1 stands for positive
SM1001 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1002 value will be 1 when accumulated
SM1002 number pulse number overflows.
Overflow flag of SM1003 value will be 1 when pulse
SM1003 pulse equivalent equivalent overflows PULSE_1
SM1004
SM1005
SM1006
SM1007
SM1008
SM1009
SM1010 Pulse error flag SM1010 will be ON when pulse errors
SM1020 will be ON when sending the
SM1020 ‘Sending pulse’ flag pulse
SM1021 value being 1 stands for positive
SM1021 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1022 value will be 1 when accumulated
SM1022 number pulse number overflows.
Overflow flag of SM1023 value will be 1 when pulse
SM1023 pulse equivalent equivalent overflows PULSE_2
SM1024
SM1025
SM1026
SM1027
SM1028
SM1029
SM1030 Pulse error flag SM1030 will be ON when pulse errors
SM1040 will be ON when sending the
SM1040 ‘Sending pulse’ flag pulse
SM1041 value being 1 stands for positive
SM1041 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1042 value will be 1 when accumulated
SM1042 number pulse number overflows.
Overflow flag of SM1043 value will be 1 when pulse
PULSE_3
SM1043 pulse equivalent equivalent overflows
SM1044
SM1045
SM1046
SM1047
SM1048
SM1049
SM1050 Pulse error flag SM1050 will be ON when pulse errors
SM1060 will be ON when sending the
SM1060 ‘Sending pulse’ flag pulse
SM1061 value being 1 stands for positive
SM1061 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1062 value will be 1 when accumulated
SM1062 number pulse number overflows.
Overflow flag of SM1063 value will be 1 when pulse
SM1063 pulse equivalent equivalent overflows PULSE_4
SM1064
SM1065
SM1066
SM1067
SM1068
SM1069
SM1070 Pulse error flag SM1070 will be ON when pulse errors
SM1080 will be ON when sending the
SM1080 ‘Sending pulse’ flag pulse
SM1081 value being 1 stands for positive
SM1081 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1082 value will be 1 when accumulated
PULSE_5
SM1082 number pulse number overflows.
Overflow flag of SM1083 value will be 1 when pulse
SM1083 pulse equivalent equivalent overflows
SM1084
SM1085
SM1086
SM1087
SM1088
SM1089
SM1090 Pulse error flag SM1090 will be ON when pulse errors
SM1100 will be ON when sending the
SM1100 ‘Sending pulse’ flag pulse
SM1101 value being 1 stands for positive
SM1101 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1102 value will be 1 when accumulated
SM1102 number pulse number overflows.
Overflow flag of SM1103 value will be 1 when pulse
SM1103 pulse equivalent equivalent overflows PULSE_6
SM1104
SM1105
SM1106
SM1107
SM1108
SM1109
M1110 Pulse error flag SM1110 will be ON when pulse errors
SM1120 will be ON when sending the
SM1120 ‘Sending pulse’ flag pulse
PULSE_7
SM1121 value being 1 stands for positive
SM1121 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1122 value will be 1 when accumulated
SM1122 number pulse number overflows.
Overflow flag of SM1123 value will be 1 when pulse
SM1123 pulse equivalent equivalent overflows
SM1124
SM1125
SM1126
SM1127
SM1128
SM1129
SM1130 Pulse error flag SM1130 will be ON when pulse errors
SM1140 will be ON when sending the
SM1140 ‘Sending pulse’ flag pulse
SM1141 value being 1 stands for positive
SM1141 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1142 value will be 1 when accumulated
SM1142 number pulse number overflows.
Overflow flag of SM1143 value will be 1 when pulse
SM1143 pulse equivalent equivalent overflows PULSE_8
SM1144
SM1145
SM1146
SM1147
SM1148
SM1149
SM1150 Pulse error flag SM1150 will be ON when pulse errors
SM1160 will be ON when sending the
SM1160 ‘Sending pulse’ flag pulse
SM1161 value being 1 stands for positive
SM1161 Direction flag direction and corresponding port is ON
Overflow flag of
accumulated pulse SM1162 value will be 1 when accumulated
SM1162 number pulse number overflows.
Overflow flag of SM1163 value will be 1 when pulse
SM1163 pulse equivalent equivalent overflows PULSE_9
SM1164
SM1165
SM1166
SM1167
SM1168
SM1169
SM1170 Pulse error flag SM1170 will be ON when pulse errors
SM1180 will be ON when sending the
SM1180 ‘Sending pulse’ flag pulse
SM1181 value being 1 stands for positive
SM1181 Direction flag direction and corresponding port is ON
PULSE-
Overflow flag of
_10
accumulated pulse SM1182 value will be 1 when accumulated
SM1182 number pulse number overflows.
Overflow flag of SM1183 value will be 1 when pulse
SM1183 pulse equivalent equivalent overflows
SM1184
SM1185
SM1186
SM1187
SM1188
SM1189
SM1190 Pulse error flag SM1190 will be ON when pulse errors
ID Function Description
SM300 BLOCK1 running flag SM300 will be ON when block1 is running
SM301 BLOCK2 running flag SM301 will be ON when block2 is running
SM302 BLOCK3 running flag SM302 will be ON when block3 is running
SM303 BLOCK4 running flag SM303 will be ON when block4 is running
SM304 BLOCK5 running flag SM304 will be ON when block5 is running
SM305 BLOCK6 running flag SM305 will be ON when block6 is running
…… ……
SM396 BLOCK97 running flag SM396 will be ON when block97is running
SM397 will be ON when block98 is
SM397 BLOCK98 running flag running
SM398 will be ON when block99 is
SM398 BLOCK99 running flag running
SM399 will be ON when block100 is
SM399 BLOCK100 running flag running
Error check(SM400-SM413)
ID Function Description
ERR LED keeps ON, PLC don not run and output, check
SM400 I/O error when power on
Expansion module
communication
SM401 error
BD communication
SM402 error
……
SM405 No user program Internal code check wrong
SM406 User program error Implement code or configuration table check wrong
ERR LED keeps ON, PLC don not run and output, check
SM407 SSFD check error when power on
SM408 Memory error Can not erase or write Flash
SM409 Calculation error
SM410 Offset overflow Offset exceeds soft element range
FOR-NEXT
SM411 overflow Reset when power on or users can also reset by hand.
When offset of register overflows, the return value will be
SM412 Invalid data fill SM372 value
SM413
Error Message(SM450-SM452)
ID Function Description
SM450 System error check
SM451
SM452
ID Function Description
Module status read is
SM500 finished
Communication(SM130-SM1319)
ID Function Description
SM130 Accurate receipt flag
SM131 Error receipt flag
SM132
SM133
COM1 SM134
SM135
SM136
SM137
SM138
SM139
SM140 Accurate receipt flag
SM141 Error receipt flag
SM142
SM143
SM144
COM2
SM145
SM146
SM147
SM148
SM149
Clock(SD010-SD019)
ID Function Description
SD010 Current scan cycle 100us, us is the unit
SD011 Min scan time 100us, us is the unit
SD012 Max scan time 100us, us is the unit
SD013 Second (clock) 0~59 (BCD code)
SD014 Minute (clock) 0~59 (BCD code)
SD015 Hour (clock) 0~23 (BCD code)
SD016 Day (clock) 0~31 (BCD code)
SD017 Month (clock) 0~12 (BCD code)
SD018 Year (clock) 2000~2099 (BCD code)
SD019 Week (clock) 0 (Sunday ) ~6 (Saturday) (BCD code)
Flag (SD020-SD031)
ID Function Description
SD020 Information of type
SD021 Information of type
:
SD030 Information of type
SD031 Information of type
Step ladder(SD040)
ID Function Description
SD40 Flag of the executing process S
ID Function Description
Current segment(No. n
SD100
segment) HSC00
Current segment(No. n
SD101
segment) HSC02
Current segment(No. n
SD102
segment) HSC04
Current segment(No. n
SD103
segment) HSC06
Current segment(No. n
SD104
segment) HSC08
Current segment(No. n
SD105
segment) HSC10
Current segment(No. n
SD106
segment) HSC12
Current segment(No. n
SD107
segment) HSC14
Current segment(No. n
SD108
segment) HSC16
Current segment(No. n
SD109
segment) HSC18
ID Function Description
SD300 Executing instruction of BLOCK1 The value will be used when BLOCK monitors
SD301 Executing instruction of BLOCK2 The value will be used when BLOCK monitors
SD302 Executing instruction of BLOCK3 The value will be used when BLOCK monitors
SD303 Executing instruction of BLOCK4 The value will be used when BLOCK monitors
SD304 Executing instruction of BLOCK5 The value will be used when BLOCK monitors
SD305 Executing instruction of BLOCK6 The value will be used when BLOCK monitors
…… …… ……
SD396 Executing instruction of BLOCK97 The value will be used when BLOCK monitors
SD397 Executing instruction of BLOCK98 The value will be used when BLOCK monitors
SD398 Executing instruction of BLOCK99 The value will be used when BLOCK monitors
Executing instruction of
SD399 BLOCK100 The value will be used when BLOCK monitors
Error Check(SD400-SD413)
Number of
communication error
SD401 expansion module
Number of
SD402 communication error BD
……
SD405
SD406
SD407
SD408
1:Divided by zero error
2:Former operand’s address less that the latter one’s
of MRST,MSET
3:ENCO,DECO encoding, decoding instruction data
bit overruns.
Operation error code 4:BDC code error
SD409 number 7:Square root error
Numbers of shift register
D when migration
SD410 overruns
SD411
SD412
SD413
Error Check(SD450-SD452)
ID Function Description
1:Watchdog act(Default 200ms)
2:Control block application fail
SD450 3:Visit illegal address
Hardware error type:
1:Register error
2:Bus error
SD451 3:Usage error
SD452 Hardware error
ID Function Description
Module number
SD500 Expansion modules:#1~16
BD:#10001~10005
SD501~5
16 Expansion module、BD status 16 registers
Modules Information(SD520-SD855)
ID Function Description
SD520
…… Expansion module 1
SD535
Each expansion module
…… …… ……
occupies 16 registers
SD760
…… Expansion module 16
SD775
SD776
…… BD module 1
SD791
…… …… …… Each BD module
SD840 occupies 16 registers
…… BD module 5
SD855
ID Function Description
SD860 Error times of module read
Expansion’s CRC parity error
Expansion’s address error
Expansion accepted data length error
Expansion’s accept buffer zone
SD861 Error types of module read overflows Expansion
Expansion timeout error module 1
CRC parity error when PLC is accepting
data
Unknown error
SD862 Error times of module write
SD863 Error types of module write
SD864 Error times of module read
Expansion’s CRC parity error
Expansion’s address error
Expansion accepted data length error
Expansion’s accept buffer zone
SD865 Error types of module read overflows Expansion
Expansion timeout error module 2
CRC parity error when PLC is accepting
data
Unknown error
SD866 Error times of module write
SD867 Error types of module write
……
SD920 Error times of module read
Expansion
Expansion’s CRC parity error module 16
SD921 Error types of module read
Expansion’s address error
Expansion accepted data length error
Expansion’s accept buffer zone
overflows
Expansion timeout error
CRC parity error when PLC is accepting
data
Unknown error
SD922 Error times of module write
SD923 Error types of module write
SD924 Error times of module read
SD925 Error types of module read
BD module
SD926 Error times of module write
1
SD927 Error types of module write
……
SD940
SD941 BD module
SD942 5
SD943
Communication
ID Function Description
SD130
0:Correct
Serial port communication error code :
13:No initial character
14:No ending character
100:Hardware error
101:Timeout error
108:CRC parity error
110:Station number error
Modbus communication error code:
211:Function number do not support
212:Address error(overrun)
COM 213:Data length error
1 214:Data error
Serial port 215:Slave station busy
communication error 216:Data storage error
SD131 code (Erase FLASH)
SD132
SD133
SD134
SD135
SD136
SD137
SD138
SD139
SD140
0:Correct
Serail port communication error code :
13:No initial character
14:No ending character
100:Hardware error
101:Timeout error
108:CRC parity error
110:Station number error
Modbus communication error code:
211:Function number do not support
212:Address error(overrun)
COM
2 213:Data length error
214:Data error
Serial port 215:Slave station busy
communication error 216:Data storage error
SD141 code (Erase FLASH)
SD142
SD143
SD144
SD145
SD146
SD147
SD148
SD149
ID Function Description
HSD0 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD1 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD2 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD3 equivalent) PULSE_1
HSD4 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD5 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD6 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD7 equivalent) PULSE_2
HSD8 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD9 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD10 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD11 equivalent) PULSE_3
HSD12 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD13 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD14 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD15 equivalent) PULSE_4
HSD16 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD17 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD18 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD19 equivalent) PULSE_5
HSD20 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD21 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD22 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD23 equivalent) PULSE_6
HSD24 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD25 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD26 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD27 equivalent) PULSE_7
HSD28 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD29 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD30 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD31 equivalent) PULSE_8
HSD32 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD33 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD34 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD35 equivalent) PULSE_9
HSD36 Low 16 bits of accumulated pulse number (the unit is pulse number)
HSD37 High 16 bits of accumulated pulse number (the unit is pulse number)
Low 16 bits of accumulated pulse number(the unit is pulse
HSD38 equivalent)
High 16 bits of accumulated pulse number(the unit is pulse
HSD39 equivalent) PULSE_10
Appendix 3. Special Flash Register
I Mapping
ID Function Description
0xFF means terminal
I00 corresponds to Input terminal 0 corresponds
SFD10* bad,0xFE means
X** to X** number
terminal idle
SFD11* I01 corresponds to
X**
SFD12* I02 corresponds to
X**
…… ……
SFD73* I77 corresponds to Default value is 77
X** (Octonary)
O Mapping
ID Function Description
0xFF means terminal
O00 corresponds to Output terminal 0 correspond
SFD74* bad,0xFE means
Y** to Y** number
terminal idle
Default value is 0
…… ……
SFD134 O77 corresponds to Default value is 77
* Y** (Octonary)
I Attribute
ID Function Description
0:positive logic
SFD138* I00 attribute Attribute of input terminal 0 others:negative
logic
SFD139* I01 attribute
…… ……
SFD201* I77 attribute