13: P
ROGRAM
B
RANCHING
I
NSTRUCTIONS
13-6
FC6A S
ERIES
MICROS
MART
L
ADDER
P
ROGRAMMING
M
ANUAL
FC9Y-B1726
Example: DJNZ and LABEL
The following example demonstrates a program to store consecutive values 1,000 through 1,049 to data registers D100 through
D149, respectively.
LABEL
255
M8120
END
M8120
REP
S1 –
D0
D1 –
D99
IMOV(W)
S2
D2
D1
REP
S1 –
1049
D1 –
D0
MOV(W)
REP
S1 –
50
D1 –
D1
MOV(W)
S/D
D0
DEC(W)
S2
255
S1
D1
DJNZ
M8120 is the initialize pulse special internal relay.
At start-up, MOV instructions store initial data.
1049
→
D0 to store the value for the first cycle.
50
→
D1 to determine the jump cycles.
IMOV moves D0 data 1049 to D1049 in the first cycle.
DEC decrements D0 data to 1048.
DJNZ jumps to label 255 until D1 value reduces to 0.
1049
D0
Destination: D99 + 50 = D149
1049
D149
50
D1
1st cycle:
1048
D0
Destination: D99 + 49 = D148
1048
D148
49
D1
2nd cycle:
1047
D0
Destination: D99 + 48 = D147
1047
D147
48
D1
3rd cycle:
1046
D0
Destination: D99 + 47 = D146
1046
D146
47
D1
4th cycle:
1001
D0
Destination: D99 + 2 = D101
1001
D101
2
D1
49th cycle:
1000
D0
Destination: D99 + 1 = D100
1000
D100
1
D1
50th cycle:
Summary of Contents for MICROSmart FC6A Series
Page 1: ...B 1726 7 FC6A SERIES Ladder Programming Manual ...
Page 8: ...Preface 7 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 32: ...1 OPERATION BASICS 1 20 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 96: ...3 INSTRUCTIONS REFERENCE 3 18 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 130: ...4 BASIC INSTRUCTIONS 4 34 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 192: ...9 SHIFT ROTATE INSTRUCTIONS 9 12 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 272: ...12 DISPLAY INSTRUCTIONS 12 24 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 284: ...14 REFRESH INSTRUCTIONS 14 6 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 502: ...25 DATA LOG INSTRUCTIONS 25 22 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 546: ...26 SCRIPT 26 44 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...
Page 598: ...APPENDIX A 14 FC6A SERIES MICROSMART LADDER PROGRAMMING MANUAL FC9Y B1726 ...