Chapter 4. Ladder Diagram (LD) ProgrammingGFK-2950C February 2018 1874.9.9 Table ReadThe Table Read (TBL_RD) function sequentially reads values in a table.When the pointer reaches the end of the table, it wraps around to thebeginning of the table. (TBL_RD is like FIFO_RD with a wrap-around.)Mnemonics:TBL_RD_DINTTBL_RD_DWORDTBL_RD_INTTBL_RD_UINTTBL_RD_WORDWhen TBL_RD receives power flow:1. TBL_RD increments the pointer by one.2. TBL_RD copies data indicated by the pointer to output parameter Q. Additional program logicmust then be used to capture the data from the output reference.3. Steps 1 and 2 are repeated each time the instruction is executed, until the end of the table isreached (PTR=the length specified in Length). When the end of the table is reached, the pointerwraps around to the beginning of the table.When TBL_RD receives power flow, the pointer (PTR) increments by one. If this new pointer locationis the last item in the table, the output EM is set ON. The next time TBL_RD executes, PTR isautomatically set back to 1. After PTR is incremented, the content at the new pointer location iscopied to output Q.TBL_RD always passes power to the right when it receives power.Note: The TBL_RD and TBL_WRT functions can operate on the same or different tables. Byspecifying a different reference for the pointer, these functions can access the same datatable at different locations or at different rates.OperandsNote: For each mnemonic, use the corresponding data type for the TB and Q operands. Forexample, TBL_RD_DINT requires TB and Q to be DINT variables.Parameter Description Allowed Operands OptionalLength 1 Length 32,767 Constants NoTB (must be the sametype as Q)The elements in the table All except constants NoPTR Pointer. Index of the nextelement.All except data flow, S - SC, constants NoEM Energized when the last elementof the table is readPower flow NoQ (must be the sametype as TB)The element read from the table All except constants, S. SA, SB, SCallowed only for WORD, DWORDNoTable Read ExampleWIDGETS is a table with 20 integer elements. When theenabling input %M00346 is ON, the pointer increments andthe contents of the next element of the table are copiedinto ITEM_CT. %L00001 functions as the pointer into thedata table. %M01001 is used to signal when all items ofthe data table have been accessed.