The Table Write (TBL_WRT) function sequentially updates values in a
table that never becomes full. When the pointer (PTR) reaches the end
of the table, it automatically returns to the beginning of the table.
1. TBL_WRT increments the pointer by one.
2. TBL_WRT copies data from input parameter IN to the position in the table indicated by the
pointer. (It writes over any value currently at that location.) Additional program logic must then
be used to place the data in the input reference.
3. Steps 1 and 2 are repeated each time the instruction is executed, until the table is full (PTR=LEN).
When the table is full, the pointer wraps around to the beginning of the table.
Note: The TBL_WRT and TBL_RD 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.
When TBL_WRT receives power flow, the pointer (PTR) increments by 1. If this new pointer location
is the last item in the table, the output FL is set to ON. The next time TBL_WRT executes, PTR is
automatically set back to 1. After incrementing PTR, TBL_WRT writes the content of the input
reference to the current pointer location, overwriting data already stored there.
TBL_WRT always passes power to the right when it receives power.
Note: TBL_WRT is like FIFO_WRT with a wrap-around.
Operands
Note: For each mnemonic, use the corresponding data type for the TB and IN operands. For
example, TBL_WRT_DINT requires TB and IN to be DINT variables.
All except S, constants, data flow. SA – SC
allowed only for WORD, DWORD
WIDGETS is a table with 20 integer elements. When the enabling
input %I00012 is ON, the pointer increments and the contents of
%P00077 are written into the table at the pointer location. %L00001
functions as the pointer into the data table.