Pré-visualização | Página 35 de 50
N10:0| || | 0| || |Expression | || |SQR ((N7:1 ** 2) + (N7:2 **| || |2)) | || +–––––––––––––––––––––––––––+ || Rung 2:2 ||–––––––––––––––––––––––––––––––––––––+END+––––––––––––––––––––––––––––––––––––|| | where c = (a2 + b2)� �(N7:1)2 + (N7:2)2N10:0 = Math Instructions 3–27 Swap (SWP) Use this instruction to swap the low and high bytes of a specified number of words in a bit, integer, ASCII, or string file. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Entering Parameters Enter the following parameters when programming this instruction: • Source can only be an indexed word address. • Length refers to the number of words to be swapped, regardless of the file type. The address is limited to integer constants. For bit, integer, and ASCII file types, the length range is 1 to 128. For the string file type, the length range is 1 to 41. Note that this instruction is restricted to a single string element and cannot cross a string element boundary. The following example shows how the SWP instruction works. Before: ST10:1 = abcdefghijklmnopqrstuvwxyz After ST10:1 = badcfehgjilknmporqtsvuxwzy 333 SWAP Source Length SWP Output Instruction SWAP Source #ST10:1.1 Length 13 SWP PrefaceInstruction Set Reference Manual 3–28 Arc Sine (ASN) Use the ASN instruction to take the arc sine of a number (source in radians) and store the result (in radians) in the destination. The source must be greater than or equal to –1 and less than or equal to 1. The resulting value in the destination is always greater than or equal to –Pi/2 and less than or equal to Pi/2, where Pi = 3.141592. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) sets if the result is negative; otherwise resets. Arc Cosine (ACS) Use the ACS instruction to take the arc cosine of a number (source in radians) and store the result (in radians) in the destination. The source must be greater than or equal to –1 and less than or equal to 1. The resulting value in the destination is always greater than or equal to 0 and less than or equal to Pi, where Pi = 3.141592. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) always resets. 333 ARC SINE Source Dest ASN Output Instruction 333 ARC COSINE Source Dest ACS Output Instruction Math Instructions 3–29 Arc Tangent (ATN) Use the ATN instruction to take the arc tangent of a number (source) and store the result (in radians) in the destination. The resulting value in the destination is always greater than or equal to –Pi/2 and less than or equal to Pi/2, where Pi = 3.141592. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) sets if the result is negative; otherwise resets. Cosine (COS) Use the COS instruction to take the cosine of a number (source in radians) and store the result in the destination. The source must be greater than or equal to –205887.4 and less than or equal to 205887.4. The greatest accuracy is achieved when the source is greater than –2 Pi and less than 2 Pi, where Pi = 3.141592. The resulting value in the destination is always greater than or equal to –1 and less than or equal to 1. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) sets if the result is negative; otherwise resets. 333 ARC TANGENT Source Dest ATN Output Instruction 333 COSINE Source Dest COS Output Instruction PrefaceInstruction Set Reference Manual 3–30 Natural Log (LN) Use the LN instruction to take the natural log of the value in the source and store the result in the destination. The source must be greater than zero. The resulting value in the destination is always greater than or equal to –87.33654 and less than or equal to 88.72284. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) sets if the result is negative; otherwise resets. Log to the Base 10 (LOG) Use the LOG instruction to take the log base 10 of the value in the source and store the result in the destination. The source must be greater than zero. The resulting value in the destination is always greater than or equal to –37.92978 and less than or equal to 38.53184. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) sets if the result is negative; otherwise resets. 333 NATURAL LOG Source Dest LN Output Instruction 333 LOG BASE 10 Source Dest LOG Output Instruction Math Instructions 3–31 Sine (SIN) Use the SIN instruction to take the sine of a number (source in radians) and store the result in the destination. The source must be greater than or equal to –205887.4 and less than or equal to 205887.4. The greatest accuracy is achieved when the source is greater than –2 Pi and less than 2 Pi, where Pi = 3.141592. The resulting value in the destination is always greater than or equal to –1 and less than or equal to 1. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401), and SLC 5/05 processors. Updates to Arithmetic Status Bits With this Bit: The Processor: Carry (C) always resets. Overflow (V) sets if an overflow is generated or an unsupported input is detected; otherwise resets. Zero (Z) sets if the result is zero; otherwise resets. Sign (S) sets if the result is negative; otherwise resets. Tangent (TAN) Use the TAN instruction to take the tangent of a number (source in radians) and store the result in the destination.