
369
Sample Programs
Appendix B
Program Example
• Data Flow (Unit Number 0):
Word 2001 (A/D Conversion Value)
→
Words 0201 and 0200 (Conversion Result)
(1) If the leftmost bit is a 1 (negative number) in 16-bit binary data, the data is reversed and the leftmost word
becomes F000.
(2) 16-bit binary data is converted to BCD.
(3) Signed BCD data is output to words 0200 and 0201.
Square Root Calculation
Data expressed as quadratic curves, such as thermocouple inputs, is converted and output to linear data (0000
to 4000).
Unit Settings
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
ANDW(034)
#8000
D00000
D00002
=
ERR
MOV(021)
2001
D00000
MOV(021)
#0000
D00001
NEG (060)
D00000
D00000
MOV(021)
#F000
D00001
BCD(024)
D00000
D00000
XFER(070)
#0002
D00000
0200
Execution condition
16-bit binary data
Clears leftmost word to 0000
Adds 1 and reverses
leftmost bit if it is not 0.
Sends F000 to leftmost word if
the leftmost bit is not 0.
Converts to BCD.
Outputs signed BCD data to
words 0200 and 0201.
(1)
(2)
(3)
Summary of Contents for CJ1W-AD041-V1
Page 3: ...iv...
Page 5: ...vi...
Page 9: ...x TABLE OF CONTENTS...
Page 15: ...xvi...
Page 99: ...76 Handling Errors and Alarms Section 2 8...
Page 191: ...168 Handling Errors and Alarms Section 4 8...
Page 243: ...220 Handling Errors and Alarms Section 5 8...
Page 381: ...358 Handling Errors and Alarms Section 7 10...
Page 385: ...362 Dimensions Appendix A...
Page 395: ...372 Sample Programs Appendix B...
Page 396: ...373 Appendix C Data Memory Coding Sheets...
Page 417: ...394 Data Memory Coding Sheets Appendix C...
Page 425: ......