Unit - Omron CJ Series Operation Manual

Sysmac temperature control units
Hide thumbs Also See for CJ Series:
Table of Contents

Advertisement

Sample Programs
Converting Data from Signed Binary to Signed BCD
Summary
This program converts binary setting/monitor values from signed binary (4 digits) to signed BCD (8 digits).
• When the most significant bit (leftmost bit) in a word is 1, that word is treated as 2's complement binary
data.
• With signed BCD, the leftmost digit indicates the sign (0 for +, F for -) and the remaining 7 digits contain the
BCD value.
Example Unit Settings

• Unit:

CJ1W-TC001 Temperature Control Unit
• Unit number:
00 (See note 1.)
• Data format:
16-bit binary (See note 2.)
Note 1. The unit number switches are on the front of the Unit. Refer to 2-3-3 Unit Number Switches for details.
2. Turn ON pin 3 of the DIP switch to select the binary data format.
Example Program
CIO 2003 (Loop 1 PV)
Execution
condition
ERR
88
MOV(021)
2003
16-bit binary data
D00000
MOV(021)
#0000
Clears the highest
word to 0000.
D00001
ANDW(034)
#8000
D00000
D00002
=
NEG(060)
If the leftmost bit is
1, add 1 and
D00000
reverse bit status.
D00000
MOV(021)
If the leftmost bit is
1, transfer F000 to
#F000
the highest word.
D00001
BCD(024)
Converts to BCD.
D00000
D00000
XFER(070)
Outputs signed
#0002
BCD data to
CIO 0200 and
D00000
CIO 0201.
0200
CIO 0201 (Result) CIO 0201 (Result)
2 words
If the leftmost bit of the binary data
is 1 (negative data), this program
section takes the complement of
the data and writes F000 to the
leftmost result word.
This instruction converts the 16-bit
binary data to BCD.
This instruction outputs the signed
BCD data to CIO 0200 and
CIO 0201.
Appendix B

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cj1w-tc seriesSysmac cj series

Table of Contents