8.21 DEFRBUF (Ring Buffer Definition)
■
Ladder diagram
■
List of operands
Operand Description
n Device address storing the buffer size or the constant (available range: 1 to 30000)
D Starting device address of a ring buffer
■
Available devices (●: Available)
Operan
d
16-Bit device:
32-Bit
device:
Integer
Real
numbe
r
St
rin
g
Index
modifie
r
W
X
W
Y
W
R
W
L
W
S
S
D
D
T
L
D
U
M
WI
W
O
TS
C
S
TE
C
E
IX K U H SF
D
F
" "
n ● ● ● ● ● ● ● ● ● ● ● ●
D ● ● ●
■
Outline of operation
● This instruction defines a ring buffer that has storage areas for a total value and a moving
average value, and creates a ring buffer for [n] data in the area that starts with [D].
● 16-bit integer values can be stored in the buffer.
● Use the RBUFW instruction to write data into a ring buffer that is defined by this instruction.
● When the number of stored data reaches the buffer size, the next data is written from the
beginning of the ring buffer and the previous values are overwritten.
■
Structure of ring buffer
Name Data type Description
[D] Buffer size
Unsigned 16-bit
integer
The size of the ring buffer area is stored when the DEFRBUF
instruction is executed.
[D+1]
Number of
stored data
Unsigned 16-bit
integer
The amount of data that is stored in the buffer data area is
stored. The value is reset to 0 when the DEFRBUF instruction
is executed.
[D+2]
Total value
Signed 32-bit
integer
The total value of the stored data is stored. The value is reset
to 0 when the DEFRBUF instruction is executed.
[D+3]
[D+4]
Moving
average value
Single-precision
floating point real
number (32-bit)
The moving average value of the stored data is stored as a
single-precision floating point real number. The value is reset
to 0 when the DEFRBUF instruction is executed.
[D+5]
8.21 DEFRBUF (Ring Buffer Definition)
WUME-FP7CPUPGR-12 8-45