Xinje XD Series User Manual page 94

Hide thumbs Also See for XD Series:
Table of Contents

Advertisement

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.
SM 2
M0
LD
SM2
MOV K19
D0
LD
M0
MCS
//
FOR
D0
MOV K0
D21
LD
SM0
MCS
//
FOR
D0
LD>
D1[D21]
XCH
D1[D21]
LD
SM0
SM 0
D1[D21]
//SM2 is initial ON coil
//the times of FOR loop
//M0 to trigger the FOR loop
//Nesting FOR loop, the loop times is D0
//the offset starts from 0
//SM0 is always ON coil
//nesting FOR loop, the loop times is D0
D2[D21]
//if the current data is larger than the next, it will be ON
D2[D21] //exchange the two neighbouring data
//M8000 is always ON coil
MOV
MOV
FOR
D2[D21]
XCH D1[D21] D2[D21]
INC
NEXT
NEXT
93
K19
D0
FOR
D0
K0
D21
D0
D21

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xl seriesXd3Xd5

Table of Contents