show the entry list
STEP 7 Micro/WIN -- Creating S7 programs -- Calling blocks and functions
How do you reset the high-speed counters of the S7-200?
Using an S7-200 without twilight switch, how do you have shutters open at sunrise and close at sunset?
How do you count values over 16 bits with the S7-200?
How can you limit the pitch of jumps with S7-200?
How do you configure the positioning module EM253 so that the connected stepper motor can proceed in both directions?
How do you position a servo drive axis using the S7-200 pulse interface?
How do you create a bar display in TD 200 or TD 200C?
How can you optimize use of timers in STEP 7 Micro/WIN?
How do you determine the frequency of a pulse sequence and speeds?
How can you scale analog values with S7-200 in conjunction with CPU224XP and expansion modules EM 231, EM 232 and EM 235?
How do you convert a binary number into Gray code (or vice versa) in STEP 7 Micro/WIN?
How do you convert the number format DOUBLE INTEGER into BCD code (or vice versa) in STEP 7 Micro/WIN?
How do you form the absolute and negative values of numbers in STEP 7 Micro/WIN?
Why does the PID controller created by the instruction wizard sometimes not work?
What do you have to do in the SIMATIC S7-200 in order to edit part of the program once after restarting?
Which library with the inverse functions to the trigonometric functions (sine, cosine, tangent) is available for STEP 7-Micro/WIN?
Scaling the setpoint and actual values in the STEP 7 Micro/WIN V4 wizards for PID control loops
Positioning Wizard for PTO/PWM in STEP 7 Micro/WIN V4.0
How to implement a three step control with PID-loop in the S7-200 via STEP 7-Mirco/WIN?
How do you form the absolute and negative values of numbers in STEP 7 Micro/WIN?
Part number:

Instructions
The functions for forming the absolute (ABS) and negative (NEG) values of numbers are not in the standard library of STEP 7 Micro/WIN. But you can program them using the integrated functions. The the download below you can add the sign operations via the "Sign Operation" library in STEP 7 Micro/WIN version V3.2.4.27 and higher.

Description of the "Sign Operation" library
The "Sign Operation" library contains function blocks for forming the absolute and negative values respectively for the floating point number (real), integer and double integer formats.


Fig. 01: Sign Operation library in STEP 7 Micro/WIN

Absolute value (ABS)
The absolute value functions ABS_R, ABS_I and ABS_DI form the absolute values of the input for the number formats REAL, INTEGER and DOUBLE INTEGER.
Formula: y = |x|


Fig. 02: The function blocks ABS_R, ABS_I and ABS_DI in the program block
 
Function Parameter Data type Operands
ABS_R IN [REAL] VD, ID, QD, MD, SD, SMD, LD, AC, Constant, *VD, *LD, *AC
OUT [REAL] VD, ID, QD, MD, SD, SMD, LD, AC, *VD, *LD, *AC
ABS_I IN [INT] VW, IW, QW, MW, SW, SMW, LW, T, C, AIW, Constant, AC, *VD, *AC, *LD
OUT [INT] VW, T, C, IW, QW, SW, MW, SMW, LW, AC, *VD, *AC, *LD
ABS_DI IN [DINT] VD, ID, QD, MD, SD, SMD, LD, AC, HC, Constant, *VD, *LD, *AC
OUT [DINT] VD, ID, QD, MD, SD, SMD, LD, AC, *VD, *LD, *AC
Table 01: Configuration of the function blocks ABS_R, ABS_I and ABS_DI

Negative value (NEG)
The negative values NEG_R, NEG_I and NEG_DI form the negative value of the input for the number formats REAL, INTEGER and DOUBLE INTEGER:
Formula: y = - x


Fig. 03: The function blocks NEG_R, NEG_I and NEG_DI in the program block
 
Function Parameter Data type Operands
NEG_R IN [REAL] VD, ID, QD, MD, SD, SMD, LD, AC, Constant, *VD, *LD, *AC
OUT [REAL] VD, ID, QD, MD, SD, SMD, LD, AC, *VD, *LD, *AC
NEG_I IN [INT] VW, IW, QW, MW, SW, SMW, LW, T, C, AIW, Constant, AC, *VD, *AC, *LD
OUT [INT] VW, T, C, IW, QW, SW, MW, SMW, LW, AC, *VD, *AC, *LD
NEG_DI IN [DINT] VD, ID, QD, MD, SD, SMD, LD, AC, HC, Constant, *VD, *LD, *AC
OUT [DINT] VD, ID, QD, MD, SD, SMD, LD, AC, *VD, *LD, *AC
Table 02: Configuration of the function blocks NEG_R, NEG_I and NEG_DI

Enable bit EN
The boolean input EN (enable) enables the function in each case.

Output enable bit ENO
Due to the asymmetry of the definition range, the minimum (maximum negative) boundaries of INTEGER and DOUBLE INTEGER cannot be converted into positive values!
For these function blocks the output bit ENO (enable output) gives information about error-free execution: As long as the function is enabled via EN and is processed without error, the ENO bit is set (true). If errors occur (e.g. overrun), ENO is not set (false) and the OUT result is not be evaluated.

The following value range restrictions result from this for the functions ABS_I, ABS_DI, NEG_I and NEG_DI:
 
INTEGER:  -2^15-1 = -32.767 <= x <= 32.767 = 2^15-1
DOUBLE INTEGER:  -2^31-1 = -2.147.483.647 <= x <= 2.147.483.647 = 2^31-1

The STEP 7 Micro/WIN library as zip file
Copy the file "SignOperation.zip" to a separate directory and extract the file. You can then integrate the "Sign Operation.mwl" library, which can be used in version V3.2.4.27 and higher of STEP 7 Micro/WIN, into your S7-200 project.

Notes

  • Information on inserting libraries in STEP 7 Micro/WIN is available in 
    Entry ID: 16689345

SignOperation.zip ( 3 KB )

 Entry ID:25939521   Date:2012-05-03 
I regard this article....as helpfulas not helpful                                 
mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Help
Online Help
Guided Tour