Pré-visualização | Página 39 de 50
0 0 0 x x x x x x x x x x x x x x 1 0 x 0 0 0 1 x x x x x x x x x x x x x 1 0 0 x 0 0 1 0 x x x x x x x x x x x x 1 0 0 0 x 0 0 1 1 x x x x x x x x x x x 1 0 0 0 0 x 0 1 0 0 x x x x x x x x x x 1 0 0 0 0 0 x 0 1 0 1 x x x x x x x x x 1 0 0 0 0 0 0 x 0 1 1 0 x x x x x x x x 1 0 0 0 0 0 0 0 x 0 1 1 1 x x x x x x x 1 0 0 0 0 0 0 0 0 x 1 0 0 0 x x x x x x 1 0 0 0 0 0 0 0 0 0 x 1 0 0 1 x x x x x 1 0 0 0 0 0 0 0 0 0 0 x 1 0 1 0 x x x x 1 0 0 0 0 0 0 0 0 0 0 0 x 1 0 1 1 x x x 1 0 0 0 0 0 0 0 0 0 0 0 0 x 1 1 0 0 x x 1 0 0 0 0 0 0 0 0 0 0 0 0 0 x 1 1 0 1 x 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x 1 1 1 1 Entering Parameters • Source is the address of the word to be encoded. Only one bit of this word should be on at any time. If more than one bit in the source is set, the destination bits are set based on the least significant bit that is set. If a source of zero is used, all of the destination bits are reset and the zero bit is set. • Destination is the address that contains the bit encode information. Bits 4–15 of the destination are reset by the ENC instruction. Updates to Arithmetic Status Bits The arithmetic status bits are found in Word 0, bits 0–3 in the status file. After an instruction is executed, the arithmetic status bits in the status file are updated: With this Bit: The Controller: S:0/0 Carry (C) always resets. S:0/1 Overflow (V) sets if more than one bit in the source is set; otherwise reset. The math overflow bit (S:5/0) is not set. S:0/2 Zero (Z) sets if destination value is zero. S:0/3 Sign (S) always resets. 3 ENC ENCODE 1 of 16 to 4 Source Dest Output Instruction PrefaceInstruction Set Reference Manual 4–14 Copy File (COP) and Fill File (FLL) Instructions The destination file type determines the number of words that an instruction transfers. For example, if the destination file type is a counter and the source file type is an integer, three integer words are transferred for each element in the counter-type file. After a COP or FLL instruction is executed, index register S:24 is cleared to zero. Using COP This instruction copies blocks of data from one location into another. It uses no status bits. If you need an enable bit, program an output instruction (OTE) in parallel using an internal bit as the output address. The following figure shows how file instruction data is manipulated. Source Destination File to File Entering Parameters Enter the following parameters when programming this instruction: • Source is the address of the file you want to copy. You must use the file indicator (#) in the address. When using either an SLC 5/03 (OS301 or higher), SLC 5/04 (OS401), or SLC 5/05 processor, floating point and string values are supported. • Destination is the starting address where the instruction stores the copy. You must use the file indicator (#) in the address. When using either an SLC 5/03 (OS301 or higher), SLC 5/04 (OS401), or SLC 5/05 processor, floating point and string values are supported. 3333 333 COP COPY FILE Source Dest Length FLL FILL FILE Source Dest Length Output Instructions Data Handling Instructions 4–15 • Length is the number of elements in the file you want to copy. – For SLC processors, if the destination file type is 3 words per element (Timer or Counter), you can specify a maximum length of 42. If the destination file type is 1 word per element, you can specify a maximum length of 128 words. – MicroLogix 1000 controllers, see the table below: If the destination file then you can specify a maximum length of:If the destination file type is a: Discrete Controllers Analog Controllers Output 1 5 Input 2 8 Status 33 — Bit 32 — Timer 40 — Counter 32 — Control 16 — Integer 105 Note The maximum lengths apply when the source is of the same file type. All elements are copied from the source file into the destination file each time the instruction is executed. Elements are copied in ascending order. If your destination file type is a timer, counter, or control file, be sure that the source words corresponding to the status words of your destination file contains zeros. Be sure that you accurately specify the starting address and length of the data block you are copying. The instruction will not write over a file boundary (such as between files N16 and N17) at the destination. An error occurs if a write is attempted over a file boundary. You can perform file shifts by specifying a source element address one or more elements greater than the destination element address within the same file. This shifts data to lower element addresses. PrefaceInstruction Set Reference Manual 4–16 Using FLL This instruction loads elements of a file with either a program constant or value from an element address. The instruction fills the words of a file with a source value. It uses no status bits. If you need an enable bit, program a parallel output that uses a storage address. The following figure shows how file instruction data is manipulated. Source Destination Word to File Entering Parameters Enter the following parameters when programming this instruction: • Source is the program constant or element address. The file indicator (#) is not required for an element address. When using either an SLC 5/03 (OS301 or higher), SLC 5/04 (OS401), or SLC 5/05 processor, floating point and string values are supported. • Destination is the destination starting address of the file you want to fill. You must use the file indicator (#) in the address. When using either an SLC 5/03 (OS301 or higher), SLC 5/04 (OS401), or SLC 5/05 processor, floating point and string values are supported. Data Handling Instructions 4–17 • Length is the number of elements in the file you want filled. – For SLC processors, if the destination file type is 3 words per element (Timer or Counter), you can specify a maximum length of 42. If the destination file type is 1 word per element, you can specify a maximum length of 128 words. – For MicroLogix 1000 controllers, see the table below: If the destination file then you can specify a maximum length of:If the destination file type is a: Discrete Controllers Analog Controllers Output 1 5 Input 2 8 Status 33 — Bit 32 — Timer 40 — Counter 32 — Control 16 — Integer 105 All elements are filled from the source value (typically a constant) into the specified destination file each scan the rung is true. Elements are filled in ascending order. The instruction will not write over a file boundary (such as between files N16 and N17) at the destination. An error is declared if a write is attempted over a file boundary. PrefaceInstruction Set Reference Manual 4–18 Move and Logical Instructions Overview The following general information applies to move and logical instructions. Entering Parameters • Source is the address of the value on which the logical or move operation is to be performed. The source can be a word address or a program constant, unless otherwise described. If the