L9_TBLK: Table to Block
(Original Document)
Naming
Name in LL984 Editor
Function Block Name
name of legacy 984 instruction
name in other tools and editors like:
  • Type Library Browser
  • Data Editor
  • Animation Tables
  • Search Results
Function Description
The L9_TBLK table-to-block procedure combines the functionality of a table-to-register procedure with a block move procedure. In a single scan, it can copy a block of up to 100 contiguous words from a source table to a destination block of words. The length of the destination block of words is fixed. Each block of words copied from the source table has the same length as the destination block.
The LENGTH value determines the number of words included in the destination block. The SOURCE parameter defines the location of the first word in the source table.
The DEST parameter defines the location of the pointer. The pointer contains an integer value which, when multiplied against the LENGTH value, points to the first word of the block in the source table that will be copied and written to the destination block in the current scan. The initial value of the pointer is 0, which points to the first word in the source table. The word contiguous to and immediately following the pointer is the first word in the destination block.
NOTE:
The source table is segmented into a series of blocks, each of which is the same length as the destination block.
  • If the source table is located at %MW memory, the size of the source table does not have to be parametrized. It is only limited by the number of memory words (%MW) in your system configuration.
  • If the source table is in unlocated memory, the source table length must be defined by the array size of SOURCE. The array size of SOURCE must be a multiple of LENGTH.
The operation begins when the input to the ENABLE pin is turned ON. If both the HOLD and RESET inputs remain OFF during operation, the pointer will increment by a value of 1 after each scan, causing the operation to move to the next adjacent block of words within the source table.
The operation continues to copy data from a series of blocks of words in the source table to a the destination blocks until the operation reaches the end of the table, or until either of the following events occurs. If the HOLD input turns ON, the pointer stops incrementing and the operation continues to copy from the same block of words in the source table. If the RESET input turns ON, the pointer is reset to 0, and the operation copies from the first block of words in the source table.
The OUT output turns ON upon the successful completion of the operation. The ERR output indicates the attempted move operation is not possible.
Representation
Parameters
Input Pin
Name
Data Type
Address Range
Meaning
Top
ENABLE
OFF to ON initiates the operation.
Middle
HOLD
BOOL
ON= hold pointer
OFF= increment pointer
Bottom
RESET
BOOL
ON= reset pointer to zero
NOTE: You should use external logic in conjunction with the middle and the bottom inputs to confine the value in the destination pointer to a special reserved range.
Node
Node Type
Name
Data Type
Address Range
Meaning
Top
IN
SOURCE
ANY_ARRAY_UINT
%MW
The source table as a sequence of blocks, each of which has the length given by the value of the LENGTH parameter, declared as an ARRAY[1..LENGTH*n] OF_UINT, where n is the arbitrary table size.
The result of LENGTH*n is represented as a constant.
Middle
IN/OUT
DEST
ANY_ARRAY_UINT
%MW
The pointer to the source table followed by the destination block declared as an ARRAY[1+LENGTH] OF UINT.
Bottom
IN
LENGTH
UINT
1...100
The number of words in the destination block.
Valid range: 1 to 100.
Output Pin
Name
Data Type
Address Range
Meaning
Top
OUT
BOOL
ON indicates the operation succeeded.
Middle
ERR
BOOL
ON indicates the attempted operation is not possible.
Example
See below an example of L9_TBLK usage.
The destination block is 5 words long (%MW11...%MW15).
The source table starts at %MW20 and is segmented into a string of 5-word source blocks (%MW20...%MW24, %MW25...%MW29, etc.).
In the graphic below, you see what happens on the second transition of positive transition (P.T.) contact %I1.
The value inside the pointer (%MW10) increments to 1, and the data contained in the second source block (%MW25...%MW29) is copied into the 5-word destination block (%MW11...%MW15).
Coil %M1 goes ON when the L9_TBLK move is completed.
The L9_SUB function block is used to control the use of words in the source table. Here you restrict the table to 15 (3*5) words by clearing the value in the pointer word to 0 after 5 L9_BLKT transfers.