8.21 DEFRBUF (Ring Buffer Definition)
Name
[D+6]
Write pointer
[D+7]
----
Buffer data
area
[D
+7+n-1]
■
Processing
1. [n] (buffer size) is specified in [D] (buffer start).
2. The range from [D+1] (stored data amount) to [D+6] (write pointer) is cleared to zero.
Example) n=U4, D=DT0
DT0
K 0
DT1
K 1
DT2
K 2
DT3
K 3
DT4
K 4
DT5
K 5
DT6
K 6
DT7
K 7
DT8
K 8
DT9
K 9
DT10
K 10
■
Precautions for programming
● When this instruction is executed, data in the ring buffer area is not cleared. Use a data
transfer instruction or other instructions to reset the area, if necessary.
● Do not use other instructions than the RBUFW instruction to write data into the ring buffer.
The calculation of total value and moving average value are not guaranteed.
■
Flag operations
Name
SR7
SR8
(ER)
8-46
Data type
Unsigned 16-bit
integer
Unsigned 16-bit
integer
Signed 16-bit
integer
DT0
DT1
DT2
DT3
DT4
DT5
DT6
DT7
DT8
DT9
DT10
Description
To be set in the case of out-of-range in indirect access (index modification).
To be set when [n] (buffer size) is out of the available range.
To be set when the range of [D (the beginning of a buffer) + n (buffer size)] is out of the
accessible range.
Description
The relative number from [D+7] is stored. The value is reset
to 0 when the DEFRBUF instruction is executed. The value is
incremented when data is written by the RBUFW instruction.
The value returns to 0 when the RBUFW instruction is
executed at the end of the data area.
Data is written by the RBUFW instruction.
Buffer size
U 4
Stored data amount
U 0
Total
K 0
Average
SF 0.0
U 0
Write pointer
K 5
K 6
K 7
K 8
WUME-FP7CPUPGR-12