Download Series 90-70 Programmable Controller Reference Manual

Transcript
10
FIFORD
(INT, UINT, DINT, WORD, DWORD)
The First-In-First-Out (FIFO) Read (FIFORD) function is used to move data out of tables. Values
are always moved out of the bottom of the table. If the pointer reaches the last location and the
table becomes full, the FIFORD function must be used to remove the entry at the pointer location
and decrement the pointer by one. The FIFORD function is used in conjunction with the
FIFOWRT function, which increments the pointer and writes entries into the table.
FIFO WRITE
FIFO READ
table
pointer
5
4
3
2
1
same table
pointer
5
4
3
2
Sequence of events:
1. The function copies the top location of the table to output parameter Q. Additional program
logic must then be used to place the data in the input reference.
2.
The remaining items in the table are copied to a lower numbered position in the table.
3.
The function decrements the pointer by one.
4.
Steps 1 and 2 are repeated each time the instruction is executed, until the table is empty
(PTR = LEN).
5.
The pointer does not wrap around when the table is full.
The FIFORD function has three input parameters and three output parameters. When the function
receives power flow, the data at the first location of the table is copied to output Q. Next, each item
in the table is moved down to the next lower location. This begins with item 2 in the table, which
is moved into position 1. Finally, the pointer is decremented. If this causes the pointer location to
become 0, the output EM is set ON. Therefore, EM indicates whether or not the table is empty.
The FIFORD function passes power to the right if the pointer is greater than zero and less than the
value specified for LEN.
_____
|
|
(enable)
(ok)
—|FIFO_|—
|
|
| RD_ |
| WORD|
(table elements) —|TB EM|— (output parameter EM)
| LEN |
|00001|
(pointer) —|PTR Q|— (output parameter Q)
|_____|
GFK-0265J
Chapter 10 Data Table Functions
10-11