Transcript
Page 1: Data Handling Instructions
Page 2: Data Handling Instructions

Chapter

14Data Handling

Instructions

Page 3: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Objectives

• Use PLC instructions for moving data from one register to another.

• Create stacks for storing and retrieving data from PLC memory.

• Move data between tables.• Use PLC instructions for number system

conversion.

Page 4: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Data Handling Instructions

• Reading, storing, retrieving, and writing of data on ports and registers.

• Moving or copying data to another register or file.

• Converting data to a different number system.

• Performing a logic operation on data.

Page 5: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Data Handling Instructions (Cont.)

• Move (MOV).• Masked move (MVM).• FIFO load (FIFO).• FIFO unload (FFU).• LIFO load (LIFO).• LIFO unload (LFU).• Copy file (COP).• Fill file (FLL).

• Convert to BCD (TOD).• Convert from BCD

(FRD).• Convert from radians to

degrees (DEG).• Convert from degrees

to radians (RAD).

Page 6: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Index Register

• Sometimes simply called a pointer.• A register that holds an address of a

data. • Used to move a word into a specific

address.• Data is placed in another data register.

Page 7: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Move (MOV) Instruction

• Transfers a number into a register.• Transfers content of a register to another

register.

Page 8: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Ladder Logic Diagram Using Index Register

Page 9: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Masked Move (MVM) Instruction

• Hides or masks a portion of data prior to transferring it into a register.

Page 10: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Masked Move Example

• Using masked move (MVM) instruction to read data from input module two (I:2)

• Mask the lower byte of the data prior to transferring it into address B3:0.

Page 11: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Masked Move Example (Cont.)

• Input module two (I:2) data ANDed with mask number FF00h to set lower bytes to zero.

• Bits in the upper byte have same state as bits in I:2 module’s upper byte.

Page 12: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO

• Like pallets, data registers can be stored and retrieved in two different ways:– First-in-first-out (FIFO).– Last-in-first-out (LIFO).

Page 13: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

• Concept of storing and retrieving pallets is similar to the way data is placed in and retrieved from a stack.

• A stack in PLC or computer terms:– A group of consecutive data registers, or

words, placed temporarily in a memory location, or buffer.

Page 14: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

Page 15: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

• When stacking data: – Stack grows larger as data registers are

placed in stack.– Stack grows smaller as data registers are

retrieved from stack.

Page 16: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

Page 17: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

• In FIFO operation, first item in stack is first item out of stack.

• In LIFO operation, last item in stack is first item out of stack.

• Push operation – placing an item in a stack.

• Pop operation – retrieving an item from a stack.

Page 18: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

• Allen-Bradley SLC 500 PLCs have four instructions for LIFO and FIFO operations:– FIFO load (FFL).– FIFO unload (FFU).– LIFO load (LFL).– LIFO unload (LFU).

Page 19: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FIFO and LIFO (Cont.)

• In PLC systems, stacks are created when stacks of integer words (i.e., double-byte data) are stored in the memory buffer.

• Data can be transferred into a register or another memory location from the stack.

Page 20: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

FFL Load Instruction

Page 21: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

LFL Load Instruction

Page 22: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Copy File and Fill File Instructions

• Data handling instructions used to store blocks of data in a PLC file:– Copy file (COP).– Fill file (FLL).

• Can use these instructions to manually enter a file with constant numbers or data from another file.

Page 23: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Data Conversion

• Data conversion instructions used to convert content of a PLC register from:– One number system to another number

system.– One unit system to another unit system.

Page 24: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Data Conversion Instructions

• TOD instruction:– Converts binary number in source

register to binary coded decimal (BCD).– Places result in destination register.

• FRD instruction:– Converts BCD number in source register

to binary.– Places result in the destination register.

Page 25: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Data Conversion Instructions (Cont.)

• DEG instruction:– Converts angle value from radians to

degrees.– RAD instruction converts value of an

angle from degrees to radians.

Page 26: Data Handling Instructions

Permission granted to reproduce for educational use only.© Goodheart-Willcox Co., Inc.

Convert to BCD (TOD) and Convert from BCD (FRD)


Top Related