Panasonic FP Series Programming Manual page 484

Hide thumbs Also See for FP Series:
Table of Contents

Advertisement

15.1 Introduction into the FIFO buffer
The FIFO buffer is a first-in-first-out buffer area realized as a ring buffer. Data is stored in the order in which it is
written to the buffer, and then read out in the order stored, starting from the first data item stored. It is
convenient for buffering objects in sequential order.
Usage procedure
The area to be used is defined as the FIFO buffer using the F115_FIFT (see page 483) instruction.
(This should be done only once, before reading or writing is done.)
Data should be written to the buffer using the F117_FIFW (see page 491) instruction, and read out
of the buffer using the F116_FIFR (see page 487) instruction.
Writing data
When data is written, the data items are stored in sequential order, starting from the first data
storage area. The writing pointer indicates the next area to which data is to be written. The number
of words stored increases by 1.
If the data storage area becomes full, i.e. the number of words stored is equal to n-1, further data
writing is inhibited.
Reading data
When data is read, data is transferred starting from the first data item stored. The reading pointer
indicates the next area from which data is to be read. The number of words stored decreases by 1.
An error occurs if an attempt is made to read data when the data storage area is empty, the number
of words stored is equal to the memory size of the FIFO buffer or is equal to zero.
Data storage area
If data is written while the FIFO buffer is in the status shown below, the data will be stored in the area indicated
by 3. The writing pointer moves to 4, i.e. the next data item will be written to 4. If data is read, it will be read from
the area indicated by 0. The reading pointer then moves to 1, i.e. the next data item will be read from 1. (For
more information on the reading and writing pointer, see F115_FIFT (see page 483)).
Size
5
Number
3
Positions
0
3
0
100
1
101
2
102
3
4
Write 103
5
4
0
4
100
0
101
1
2
102
103
3
4
Read 100
5
3
1
4
100
0
101
1
2
102
103
3
4
Arithmetic instructions
483

Advertisement

Table of Contents
loading

Table of Contents