5 Categories and Use of Basic Application Instructions Operands: S : Source device (0 °≦ S < 360 ° ) D : Operation result Explanations: 1. COS instruction performs cosine operation on S and stores the result in D 2. F refers to floating point input. Be sure to add a decimal point when using it. 3. Only 32-bit instructions DCOS and DCOSP are applicable. 4. The value in S can be set as radian or degree by Radian/Degree selection flag M1760/M1920 = OFF indicates radian mode. RAD = degree Чπ /180. M1760/M1920 = ON indicates degree mode. Degree range: 0 °≦ degree < 360 ° 5. If the result = 0, zero flag will be ON. 6. Flags: 7.
See the figure below for the relation between the radian and the operation result:. R S: Radian S -2 3 2 -2 2 - - Program Example 1: Radian/degree selection flag = OFF indicates radian mode. When X0 = ON, DCOS instruction conducts cosine operation on binary floating value in (D1, D0) and stores the COS value in (D11, D10) in binary floating format. M1002 X0 RAD value (Degree 180) binary floating point / X π COS value binary floating point Program Example 2: Radian/degree selection flag = ON indicates degree mode.
When X0 = ON, DCOS instruction performs cosine DVP-PM Operation Instruction 5-112 API Mnemonic Operands Function Controllers 20PM 10PM 131 D COS P Cosine Type OP Bit Devices Word Devices Program Steps X Y M S F H KnX KnY KnM KnS T C D V Z D S * * D * OX O100 Zero flag M1808 M1968 Radian/Degree flag M1760 M1920 1 0 3 2 2 2 -1 RST Degree/radian flag DCOS D0 D10 D 1 D 0 D 1 D 10