Omron CJ - REFERENCE MANUAL 10-2009 Reference Manual page 452

Table of Contents

Advertisement

3. Instructions
BDSL
BDSL(473) converts the double singled binary
data in S+1 and S to signed BCD data and
writes the result in D+1 and D according to the
format setting in the control word (C).
The following table shows the possible signed binary values for each signed BCD format. An error will
occur if the source data is not within the allowed range for the specified signed BCD format.
Setting
C=0000
C=0001
C=0002
C=0003
Precautions
Values of -0 in the source data will be treated as 0 and will not cause an error.
Hint
Some Special I/O Units require signed BCD data inputs. BCDS(471)/BDSL(473) can be used to
convert signed binary data for output to these Units.
Sample program
BCDS
When 0.00 is ON, it is first checked if the data range of D100 is based on the data format specification
0001. Here the check result is okay, so the signed binary data in data memory D100 is converted to
signed BCD and output to D200.
0.00
BDSL
When CIO 0.00 is ON in the following example, the double signed binary data in D101 and D100 are
checked against the format specified in the control word (0003). The source data is correct, so the
double signed binary data in D101 and D100 is converted to double signed BCD and output to D201
and D200.
0.00
414
Signed binary values
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
S: D100
Signed binary data
E 0 C 1
BCDS
1
D100
D: D200
D200
F 9 9 9
Signed BCD data (–7999)
S+1: D101
F F 8 B
D100
D+1: D201
D200
F 7 6 5
Signed binary
Signed BCD
Signed BCD
Signed binary
Signed BCD values
–999 9999 to –1
0 to 999 9999
–7999 9999 to –1
0 to 7999 9999
–999 9999 to –1
0 to 9999 9999
–1999 9999 to –1
0 to 9999 9999
S: D100
Double signed binary data
3 4 4 F
D: D200
4 3 2 1
Double signed BCD data
(–7,654,321)
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Signed BCD format
specified in C

Advertisement

Table of Contents
loading

Table of Contents