EasyManua.ls Logo

Siemens SIMATIC S7-200 - Integer to Byte; Conversion Example

Siemens SIMATIC S7-200
606 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
IEC 1131-3 Instructions
10-33
S7-200 Programmable Controller System Manual
A5E00066097-02
Integer to Byte
The Integer to Byte function converts the integer value
(IN) to a byte value and loads the result into the variable
specified by OUT.
Error conditions that set ENO = 0: SM1.1 (overflow),
SM4.3 (run-time), 0006 (indirect address)
This function affects the following Special Memory bits:
SM1.1 (overflow).
Inputs/Outputs Operands Data Types
IN VW, IW, QW, MW, SW, SMW, LW, T ,C, AIW, AC, Constant,
*VD, *LD, *AC
INT
OUT VB, IB, QB, MB, SB, SMB, LB, AC, *VD, *LD, *AC BYTE
Conversion Example
LAD
%I0.0
I_TO_DI
EN
IN OUT
MUL
EN
IN OUT
EN
IN1
IN2
OUT
ROUND
EN
IN OUT
%VW20 %AC1
%AC1
%VD0
%VD0
%VD4
%VD8
%VD8 %VD12
Clear accumulator 1.
Load counter value
(number of inches)
into AC1.
Convert to a real number.
Multiply by 2.54 to change
to centimeters.
Convert back to an integer.
BCD_TO_I
EN
IN OUT%VW100 %VW100
ENO
ENO
ENO
ENO
ENO
DI_TO_R
MUL
Network 1
Network 2
%I3.0
Figure 10-12 Example of Real Number Conversion Instruction for LAD
L
A
D
F
B
D
I_TO_B
EN
IN OUT
ENO
222 224
221 226

Table of Contents

Other manuals for Siemens SIMATIC S7-200

Related product manuals