T ABLE M OVE

T ABLE M OVE

A table move instruction transfers data from a block or table to a register or word in memory. There are two types of table move instructions: table-to- register (TABLE-REG) and register-to-table (REG-TABLE). The main characteristic of a table move block is the manipulation of a pointer register, which specifies the particular table location in which the register or word value will be stored. Figure 9-102 shows a table move block.

10 TABLE

REG 100

10 REG TABLE 100

Control Reg 2000

Enable

Control Reg 3000 Enable

Reg 2000 table

12 Reset Reg 3000

12 Reset Length 08

Pointer

Pointer

Pointer register points to

Pointer register points to

4th location (Reg 2003)

3rd location (Reg 2002)

and transfers its contents

and transfers its contents

Table to register 3000.

Table to register 3000.

Pointer register points to

Pointer register points to

5th location (Reg 2004)

4th location (Reg 2003)

Table and transfers its contents

Table and transfers its contents

Reg 2000

to register 3000.

Reg 2000

to register 3000. 4 Reg 1000

Figure 9-102. (a) Table-to-register and (b) register-to-table functional block.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Languages 9

The transition of the control input from OFF to ON enables a table move instruction, which then increments the contents of the pointer register every time the middle input, the increment (INCR) pointer, transitions from OFF to ON. The bottom input of the table move block resets the pointer to zero (initialize to top of table). If data must be stored to or retrieved from a specific table location, the pointer register can be loaded with the appropriate value, which points to the specified location. A set parameter or move register instruction loads this information prior to the table move.

Referencing Figure 9-102, the length specifies the number of word locations in the table to be moved (8 in this example), beginning at the starting location (register 2000). After the table move block transfers the data from these eight locations, it energizes the top output. It energizes the middle output when the pointer register has reached the end of the table.

Applications of the table move instruction include the loading of new data into a table, the storage of input information (e.g., analog) from special modules, and the input of error information from a controlled process. It is also useful when changing preset parameters in timers and counters and when simultaneously driving a group of 16 outputs through I/O registers. A table move instruction is also used when looking up values in a table for comparison, linear interpolation, etc.

E X AM PLE 9 -1 1

A batching system operates during an eight-hour shift, where several batch sizes are processed at the rate of approximately one batch per hour. Implement instructions to store the batch information, including the batch size in gallons and the time of day when the batch was finished. Register 1000 holds the value of the total batch, while register 1500 holds the time of day (in hours and minutes) in BCD format (HHMM).

S OLU T I ON

Figure 9-103 illustrates a register-to-table instruction that will transfer the outputs of registers 1000 and 1500, using the same pointer register to store the information to two tables simultaneously. This ensures that the pointer points to a batch amount that corresponds to the time of the batch (see Figure 9-104). The Batch Done signal, perhaps coming from the opening of the discharge valve, triggers the register-to-table instruction. Once the storing of the register into the table has taken place, the instruction’s enable/done output increments the pointer. The pointer is incremented in only one of the blocks to avoid a double

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Languages 9

increment. The increment occurs after both register-to-table instruc- tions have been executed to ensure that the data is stored by the same pointer counter. Note that the Batch Done signal is a transitional contact, so the register-to-table instruction only transfers the register data once to its appropriate table location.

Batch Done

Control Reg 1000

Pointer 2000

Incr Reg 3000

Batch Done

Control Reg 1500

Incr Reg 4000

Figure 9-103. Register-to-table instruction used for storing batch information.

Table

Table

8-Hour Shift

Time of Day

(in hr: min) Figure 9-104. Table 3000 stores batch sizes and table 4000 stores the time of day

(in gallons)

the batches were completed.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Languages 9