Siemens Simatic S7-300 Service Manual Page 120

  • Download
  • Add to my manuals
  • Print
  • Page
    / 272
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 119
Floating-Point Math Instructions
Statement List (STL) for S7-300 and S7-400 Programming
8-10
A5E00706960-01
8.4 Floating-Point Math Instructions: Extended
8.4.1 SQR Generate the Square of a Floating-Point Number (32-Bit)
Format
SQR
Description of instruction
SQR
(generate the square of an IEEE-FP 32-bit floating-point number) calculates
the square of a floating-point number (32-bit, IEEE-FP) in ACCU 1. The result is
stored in accumulator 1. The instruction influences the CC 1, CC 0, OV, and OS
status word bits.
The contents of accumulator 2 (and also the contents of accumulator 3 and
accumulator 4 for CPUs with four ACCUs) remain unchanged.
Result
The result in ACCU 1 is CC 1 CC 0 OV OS Note
+qNaN 1 1 1 1
+infinite 1 0 1 1 Overflow
+normalized 1 0 0 -
+denormalized 0 0 1 1 Underflow
+zero 0 0 0 -
-qNaN 1 1 1 1
Example
STL Explanation
OPN DB17 //Open data block DB17.
L DBD0 //The value from data double word DBD0 is loaded into ACCU 1. (This
value must be in the floating-point format.)
SQR //Calculate the square of the floating-point number (32-bit, IEEE-FP)
in ACCU 1. Store the result in ACCU 1.
AN OV //Scan the OV bit in the status word for "0."
JC OK //If no error occurred during the SQR instruction, jump to the OK jump
label.
BEU //Block end unconditional, if an error occurred during the SQR
instruction.
OK: T DBD4 //Transfer the result from ACCU 1 to data double word DBD4.
Page view 119
1 2 ... 115 116 117 118 119 120 121 122 123 124 125 ... 271 272

Comments to this Manuals

No comments