|
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 )
|