Number Representation - Siemens CPU 948 Programming Manual

Simatic s5 s5-155u
Table of Contents

Advertisement

STEP 5 Programming Language
2.1.4

Number Representation

Numerical input on the PG
Permitted operations
2 - 8
To allow the CPU to logically combine, modify or compare numerical
values, these values must be located in the accumulators (working
registers of the CPU) as binary numbers.
Depending on the operations to be carried out, the following number
representations are permitted in STEP 5:
Binary numbers:
16-bit fixed point numbers
32-bit fixed point numbers
32-bit floating point numbers (with a 24-bit
mantissa)
Decimal numbers: BCD-coded numbers (sign and 3 digits)
When you use a programmer to input or display number values, you
set the data format on the programmer (e.g. KF or fixed point) in
which you intend to enter or display the values. The programmer
converts the internal representation into the form you have requested.
You can carry out all arithmetic operations with the 16-bit fixed
point numbers and floating point numbers, including comparison,
addition, subtraction, multiplication and division.
Note
Do not use BCD-coded numbers for arithmetical operations, since
this leads to incorrect results.
Use 32-bit fixed point numbers to execute comparison operations.
These are also necessary as an intermediate level when converting
numbers in BCD code to floating point numbers. With the operations
+D and -D they can also be used for addition and subtraction.
The STEP 5 programming language also has conversion operations that
enable you to convert numbers directly to the most important of the other
numerical representations.
CPU 948 Programming Guide
C79000-G8576-C848-04

Advertisement

Table of Contents
loading

Table of Contents