2 Instructions
2-256 CP1E CPU Unit Instructions Reference Manual(W483)
Function
FCS(180) calculates the FCS value for W units
of data beginning with the data in R1, converts
the value to ASCII code, and outputs the result
to D (for bytes) or D+1 and D (for words). The
settings in C+1 determine whether the units
are words or bytes, whether the data is binary
(signed or unsigned) or BCD, and whether to
start with the right or left byte of R1 if bytes are
being added.
When bit 13 of C+1 has been set to 1,
FCS(180) operates on bytes of data. In this
case, bit 12 determines whether the calculation
starts with the rightmost byte of R1 (bit 12 = 1)
or the leftmost byte of R1 (bit 12 = 0).
Sample program
When CIO 0.00 is ON in the following example, FCS(180) calculates the FCS value for the 10 bytes of
data beginning with the rightmost byte of D100 and writes the result to D200.
R1
Calculation
W (Table length)
ASCII conversion
FCS value
D
015
C: D300
015
015
141312 11 10 9 8 7
87
6 5 4 3 2 1
000A
015 8 7
FCS
D300
D100
D200
0.00
C
R1
D
Always 0.
Units
1: Bytes
Starting byte (Effective only if bit 13 is 1.)
1: Rightmost byte
Always 0.
Table length
10 bytes
0 2
0 4
0 6
0 8
0 0
3 0
0 1
0 3
0 5
0 7
0 0
3 8
C+1: D301
D: D200
R1: D100
D101
D102
D103
D104
D105
The FCS value for the
shaded bytes is calculated
and converted to ASCII.