5 Categories and Use of Basic Application Instructions API 125 Operands: S : Source device D : Operation result Explanations: 1. Perform natural logarithm (LN) operation on operand S : LN[ S +1, S ]=[ D +1, D ] 2. F refers to floating point input. Be sure to add a decimal point when using it. 3. Only 32-bit instructions DLN and DLNP are applicable. 4. Only a positive number is valid for S . Register D has to be 32-bit format. Operation is conducted in floating point value, so the value in S needs to be converted into floating value before natural logarithm operation. 5. If S is not a positive value, operational error will occur, and the instruction will not be executed.
The operational error flag will be ON, and the error code H’0E19 will be recorded. 6. e D = S . The content of D = LN S, where the value in S is specified by users. 7. Flags: a) If the absolute value of the result exceeds the max floating point value, carry flag will be ON. b) If the absolute value of the result is less than min. floating point value, borrow flag will be ON. c) If the conversion result is 0, zero flag will be ON. Program Example: 1. When M0 = ON, convert (D1, D0) to binary floating value and save the result in (D11, D10). 2. When M1= ON, perform natural logarithm operation with (D11, D10) as the antilogarithm.
The value is saved in register (D21, D20) in binary floating format. 3. When M2 = ON, convert the value in (D21, D20) into decimal floating point value and save the result in (D31, D30). (At this time, D31 indicates powers of 10 for D30). M0 M1 M2 Points to note: For floating point operations, see “5.3 Numeric Values for Data Processing” .
DVP-PM Operation Instruction 5-104 Mnemonic Operands Function Float Natural Logarithm Operation Controllers 20PM 10PM D LN P 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 Borrow flag M1809 M1969 Carry flag M1810 M1970 Operation error M1793 M1953 DFLT D0 D10 DLN D10 D20 DEBCD D20 D30