Chapter 4. Ladder Diagram (LD) Programming178 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C4.9.3 FIFO ReadThe First-In-First-Out (FIFO) Read (FIFO_RD) function moves data out oftables. Values are always moved out of the bottom of the table. If thepointer reaches the last location and the table becomes full, FIFO_RDmust be used to remove the entry at the pointer location anddecrement the pointer by one. FIFO_RD is used in conjunction with theFIFO_WRT function, which increments the pointer and writes entriesinto the table.Mnemonics:FIFO_RD_DINTFIFO_RD_DWORDFIFO_RD_INTFIFO_RD_UINTFIFO_RD_WORD1. FIFO_RD copies the top location (entry 0) of the table to output parameter Q. Additional programlogic 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. FIFO_RD decrements the pointer by one.4. Steps 1, 2, and 3 are repeated each time FIFO_RD is executed, until the table is empty (PTR = 0).The pointer does not wrap around when the table is full.When FIFO_RD 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 thetable, which is moved into position 1. Finally, the pointer is decremented. If this causes the pointerlocation to become 0, the output EM is set ON, i.e., EM indicates whether or not the table is empty.FIFO_RD passes power to the right if the pointer is greater than zero and less than the valuespecified for LEN.Note: A FIFO table is a queue. A LIFO table is a stack.Operands for FIFO ReadNote: For each mnemonic, use the corresponding data type for the TB and Q operands. Forexample, FIFO_RD_DINT requires TB and Q to be DINT variables.Parameter Description Allowed Operands OptionalLength (??) 1 Length 32,767. Constants NoTB (must be the same type asQ)The elements in the FIFO table All except constants NoPTR Pointer. Index of the lastelement of the FIFO table.All except constants, data flow,and variables in %S -%SCNoEM Energized when the lastelement of the table is readFlow NoQ (must be the same type asTB)The element read from the FIFOtableAll except constants, S; SA, SB, SCallowed only for WORD, DWORDNo