Professional Documents
Culture Documents
Word Shifting Process PDF
Word Shifting Process PDF
Contact Us
Back
VOL. 11
Word shifting
Example
Outline
The stop duration of equipment is measured using the internal timer of the KV, and is stored into data memory
DM0000. When the equipment stops again, the previous stop duration is transferred to DM0001 and the current
stop duration is written into DM0000. The last 5 stop durations are stored.
Example:
When stop 1 (1 min), stop 2 (2 min and 28 sec), and stop 3 (51 sec) are input sequentially, the contents of each
data memory is changed, as follows, each time a new stop duration is input.
Stop 1 (1 min)
#00060
DM0000:
DM0001:
#00148
#00051
#00060
#00148
#00060
DM0002
DM0004
Programming Technique
Use the FOR-NEXT instructions and indirect addressing of data memory.
Use the LDA instruction and STA instruction to shift words in the data memory. The content of each data memory is
transferred as follows:
(4)
(5)
DM0000
Latest stop duration
(3)
DM0001
(2)
DM0002
(1)
DM0003
DM0004
Indirect addressing of the data memory (format: #TMxx) can be performed using temporary data memory (such as TM10 and TM11).
Destination indirectly
Destination indirectly
Value of TM10
addressed by #TM10
addressed by #TM11
DM0003
#00004
DM0004
Word shifting
Value of TM10
(1)
#00003
(2)
#00002
DM0002
#00003
DM0003
(3)
#00001
DM0001
#00002
DM0002
(4)
#00000
DM0000
#00001
DM0001
When word shifting (1) is performed, for example, #00003 and #0004 are specified respectively for TM10 and TM11
to transfer data from #TM10 to #TM11 using the LDA instruction and STA instruction.
Word shifting of (1) to (4): Transfer from #TM10 to #TM11 is repeated using the FOR-NEXT instructions.
To use the FOR-NEXT instructions in combination with indirect addressing of data memory, refer to examples 1 and 2 of
FOR-NEXT applications of the visual KV Series Users Manual, Indirect addressing on page 521.
Top
Back
Contact Us
0000
0001
0002
1000
0004
#65535
T000
1001
0003
1000
DIFD
T000
LDA
TM04
STA
#65535
LDA
TM04
SUB
1001
RES
TM05
STA
00
CALL
1000
END
0005
SBN
00
0006
#00003
LDA
2002
0007
TM02
STA
2002
#TM02
LDA
#TM03
STA
TM03
STA
FOR
#00004
#00004
LDA
0008
0009
TM02
DEC
TM03
DEC
NEXT
0010
0011
TM05
LDA
2002
#TM03
STA
RET
0012
Tips
0000
1001
1000
1000
DIFD
#65535
T000
T000
LDA
TM04
STA
#65535
LDA
1000
TM04
SUB
TM05
STA
1001
RES
DM0003 DM0004
LDA
STA
DM0002 DM0003
LDA
STA
DM0001 DM0002
LDA
STA
DM0000 DM0001
LDA
STA
TM05 DM0000
LDA
STA
FOR
#00004