3. Instructions
674
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Example Programming
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.
(BCD)
(BIN)
(BCD)
(BIN)
P1: D100
P1+1: D101
P1+2: D102
P1+3: D103
P1
R
Contents of D200 (R)
Contents of D0 (S)
Point B
Point A
D100
D200
D0
0.00
(BCD)
(BIN)
(BCD)
(BIN)
P1: D100
P1+1: D101
P1+2: D102
P1+3: D103
+
+00C8 Hex
200
D0
D0
D100
D200
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))
The value in CIO
0200 plus 00C8
hexadecimal