
7-6
Section
Details of BASIC Commands
157
fcs
Syntax:
FCS
(<string expression>[, <fcs type>])
Description:
Function. Calculates the frame checksum of a string expression.
The
FCS
is calculated by performing one of the following operations on all bytes in the string
expression.
The type of
FCS
calculation is selected by <fcs type>. This is an integer value in the range: [0…9].
The following calculations can be performed. The type of the return depends on whether a
BINARY
or
ASCII
calculation is requested.
BINARY
calculations return integers and
ASCII
calculations return character strings.
FCS code data
<fcs type>
Calculation method
Data type
Number of
bytes
0
Binary
1
1
LRC
ASCII
2
2
Binary
2
3
CRC-CCITT
ASCII
4
4
Binary
1
5
SUM (1 byte)
ASCII
2
6
Binary
2
7
SUM (2 bytes)
ASCII
4
8
Binary
2
9
CRC-16
ASCII
4
Remarks:
Note:
1.
The calculation logic for CRC-CCITT is XMODEM.
2.
The calculation logic for CRC-16 is MODBUS. For example, character string data is
handled as follows:
Examples:
>
10 B$ = “RD89”
>
20 PRINT FCS(B$, 1)
>
RUN
17
See also:
“1 2 3 4” = 31 32 33 34
x
n
+ x
n-1
…x
1
= x
0
Summary of Contents for C200H-ASC11
Page 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Page 2: ...iv...
Page 4: ...vi...