370
Sample Programs Appendix B
Program Example
• Data Flow (Unit Number 0): Word 2001 (A/D Conversion Value)
→ Word 0200 (Calculation Result)
(1) The negative number portion is added to the conversion value (word 2001).
(2) The binary data is scaled to a range of 0 to 4000.
(3) The scaling results are multiplied by 4400.
(4) The square root is calculated, and the result is output to word 0200.
DM Area Settings
Input signal range: 0 to 10 V / 1 to 5 V / 4 to 20 mA
If the result of the binary-to-BCD conversion is negative, an error will be generated by the ROOT(072) instruc-
tion.
With a signal range of –10 to 10 V, scaling is executed by augmenting the negative portion (–10 V –5%). In this
program example, the value of D00000 is converted to 0898. Refer to Scaling on page 366 for details.
Mean Value Processing
Data is taken for the set number of samplings and the mean value is calculated.
Unit Settings
+(400)
2001
D00000
D00001
ROOT(072)
D00006
0200
SCL(194)
D00001
D00002
D00006
*B(424)
D00006
#4400
D00006
Execution condition
Conversion value +
Negative number
Scaling is executed using
augmented value. Result is
output to word D00006.
Result of step #2 (above)
is multiplied by 4400.
Square root is calculated, and
result is output to word 0200.
(1)
(2)
(3)
(4)
D00000: 00C8
D00001: (Used for calculation)
D00002: 0000
D00003: 0000
D00004: 4400
D00005: 1130
D00006: (Used for calculation)
Digital value for −5%
Conversion value +C8 (−5% portion)
Lower limit: BCD
Lower limit +C8 (−5% portion): Binary
Upper limit: BCD
Upper limit +C8 (−5% portion): Binary
Used with SCL(194)
instruction
Item Setting contents Actual settings
Unit CS1W-AD081-V1 ---
Unit number #0 Unit number switch: 00
Operation mode Normal mode Back-panel DIP switch: All OFF
Input number Input 1 used D20000 = 0001
Input signal range Input number 1, 0 to 10 V D20001 = 0001