Omron CP - PROGRAMMING MANUAL 05-2007 Programming Manual page 457

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Conversion Instructions
Flags
Example
0.00
3-11-16 SIGNED BINARY-TO-BCD: BCDS(471)
Purpose
424
C = 0003 (Input Data Range: –1999 9999 to 9999 9999 BCD)
S + 1
3 digits BCD, 12 bits
0 to 9: Fourth digit BCD
A: Negative (–1)
F: Negative (–)
B to E: Error
The following table shows the possible BCD values for each signed BCD for-
mat and the corresponding signed binary values.
Setting
Signed BCD values
C=0000
–999 9999 to –1
0 to 999 9999
C=0001
–7999 9999 to –1
0 to 7999 9999
C=0002
–999 9999 to –1
0 to 9999 9999
C=0003
–1999 9999 to –1
0 to 9999 9999
Name
Label
Error Flag
ER
Equals Flag
=
Negative Flag
N
When CIO 0.00 is ON in the following example, the double signed BCD data
format and range in D101 and D100 are checked against the format specified
in the control word (0002). The source data is correct, so the double signed
BCD data in D101 and D100 is converted to double signed binary and output
to D201 and D200.
S+1: D101
F 3 4 5
D100
D+1: D201
D200
F F C B
Converts one word of signed binary data to one word of signed BCD data.
FF67 6981 to FFFF FFFF
0000 0000 to 0098 967F
FB3B 4C01 to FFFF FFFF
0000 0000 to 04C4 B3FF
FF67 6981 to FFFF FFFF
0000 0000 to 05F5 E0FF
FECE D301 to FFFF FFFF
0000 0000 to 05F5 E0FF
Operation
ON if C is not within the specified range of 0000 to 0003.
ON if C=0002 and the leftmost digit of S+1 is A to E.
ON if C=0003 and the leftmost digit of S+1 is B to E.
ON if the content of S+1 and S is not BCD.
OFF in all other cases.
ON if D and D+1 contain 0000 0000 after execution.
OFF in all other cases.
ON if bit 15 of D+1 is ON after execution.
OFF in all other cases.
S: D100
6 7 8 9
Double signed BCD data
(–3,456,789)
D: D200
4 0 E B
Double signed binary data
Section 3-11
Signed binary values

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents