Omron CP1E-NA@@D@-@ Computer Hardware User Manual


 
2 Instructions
2-278
CP1E CPU Unit Instructions Reference Manual(W483)
Sample program
In the following example, it is assume that an analog signal from 1 to 5 V is converted and input to D0
as 0000 to 0FA0 hexadecimal. SCL(194) is used to convert (scale) the value in CIO 200 to a value
between 0 and 300 BCD.
When CIO 0.00 is ON, the contents of D0 is scaled using the linear function defined by point A (0000,
0000) and point B (0FA0, 0300). The coordinates of these points are contained in D100 to D103, and
the result is output to D200.
Reference:
An Analog Input Unit actually inputs values from FF38 to 1068 hexadecimal for 0.8 to 5.2 V. SCL(194),
however, can handle only unsigned binary values between 0000 and FFFF hexadecimal, making it
impossible to use SCL(194) directly to handle signed binary values below 1 V (0000 hexadecimal), i.e.,
FF38 to FFFF hexadecimal. In an actual application, it is thus necessary to add 00C8 hexadecimal to
all values so that FF38 hexadecimal is represented as 0000 hexadecimal before using SCL(194), as
shown in the following example.
Contents of D200 (R)
Contents of D0 (S)
Point B
Point A
SCL
D0
D100
D200
0.00
S
P1
R
P1: D100
P1+1:D101
P1+2:D102
P1+3:D103
Ar(BCD)
As(BIN)
Br(BCD)
Bs(BIN)
0300
0000
0000Hex
1V
0FA0Hex
5V
0000
0000
0300
0FA0
+
200
#000C8
D0
SCL
D0
D100
D200
5.2V
5V
1V
0.8V
1068 Hex
0FA0 Hex
0000 Hex
FF38 Hex
1130Hex
1068Hex
00C8Hex
0000Hex
+00C8 Hex
The value in CIO
0200 plus 00C8
hexadecimal
P1: D100
P1+1:D101
P1+2:D102
P1+3:D103
Ar(BCD)
As(BIN)
Br(BCD)
Bs(BIN)
0000Hex
0.8V
0300
0000
0315
1068Hex
5V
00C8Hex
1V
1130Hex
5.2V
Contents of D 200 (R)
Point B
Point A
Contents of D0 (S)
Point A (00C8 Hex 0000 (BCD))
Point B (1068 Hex 0300 (BCD))
0000
00C8
0300
1068