Chapter 4. Ladder Diagram (LD) Programming188 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C4.9.10 Table WriteThe Table Write (TBL_WRT) function sequentially updates values in atable that never becomes full. When the pointer (PTR) reaches the endof the table, it automatically returns to the beginning of the table.Mnemonics:TBL_WRT_DINTTBL_WRT_DWORDTBL_WRT_INTTBL_WRT_UINTTBL_WRT_WORD1. TBL_WRT increments the pointer by one.2. TBL_WRT copies data from input parameter IN to the position in the table indicated by thepointer. (It writes over any value currently at that location.) Additional program logic must thenbe 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. Byspecifying a different reference for the pointer, these functions can access the same datatable at different locations or at different rates.When TBL_WRT receives power flow, the pointer (PTR) increments by 1. If this new pointer locationis the last item in the table, the output FL is set to ON. The next time TBL_WRT executes, PTR isautomatically set back to 1. After incrementing PTR, TBL_WRT writes the content of the inputreference 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.OperandsNote: For each mnemonic, use the corresponding data type for the TB and IN operands. Forexample, TBL_WRT_DINT requires TB and IN to be DINT variables.Parameter Description Allowed Operands OptionalLength 1 Length 32,767. Constants NoTB (must be thesame data type as IN)The elements in the table All except S, constants, data flow. SA – SCallowed only for WORD, DWORDNoPTR Pointer. Index of the nextelement.All except constants, data flow, %S - %SC NoIN (must be the samedata type as TB)The element to write to the table All. %S - %SC allowed only for WORD,DWORDNoFL Energized when IN is written tothe last element of the tablePower flow NoTable Write ExampleWIDGETS is a table with 20 integer elements. When the enablinginput %I00012 is ON, the pointer increments and the contents of%P00077 are written into the table at the pointer location. %L00001functions as the pointer into the data table.