The Table Read (TBL_RD) function sequentially reads values in a table.
When the pointer reaches the end of the table, it wraps around to the
beginning of the table. (TBL_RD is like FIFO_RD with a wrap-around.)
When 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 logic
must 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 is
reached (PTR=the length specified in Length). When the end of the table is reached, the pointer
wraps around to the beginning of the table.
When TBL_RD receives power flow, the pointer (PTR) increments by one. If this new pointer location
is the last item in the table, the output EM is set ON. The next time TBL_RD executes, PTR is
automatically set back to 1. After PTR is incremented, the content at the new pointer location is
copied 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. By
specifying a different reference for the pointer, these functions can access the same data
table at different locations or at different rates.
Operands
Note: For each mnemonic, use the corresponding data type for the TB and Q operands. For
example, TBL_RD_DINT requires TB and Q to be DINT variables.
All except constants, S. SA, SB, SC
allowed only for WORD, DWORD
WIDGETS is a table with 20 integer elements. When the
enabling input %M00346 is ON, the pointer increments and
the contents of the next element of the table are copied
into ITEM_CT. %L00001 functions as the pointer into the
data table. %M01001 is used to signal when all items of
the data table have been accessed.