CPM2A/CPM2C Communications Functions
Example Program for
FCS
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
400 *FCSCHECK
410 L = LEN ( RESPONSE$ ) '
420 Q = 0 : FCSCK$ = " "
430 A$ = RIGHT$ ( RESPONSE$ , 1)
440 PRINT RESPONSE$ , A$ , L
450 IF A$ = "*" THEN LENGS = LEN ( RESPONSE$ ) – 3
460 FCSP$ = MID$ ( RESPONSE$ , LENGS + 1 , 2 ) '
470 FOR
I = 1
TO
480
Q = ASC ( MID$ ( RESPONSE$ , I , 1 ) )
490 NEXT I
500 FCSD$ = HEX$ ( Q )
510 IF LEN ( FCS0$ ) = 1
520 IF FCSD$ < > FCSP$
530 PRINT " FCSD$ = " ; FCSD$ , " FCSP$ = " ; FCSP$ , " FCSCK$ = " ; FCSCK$
540 RETURN
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
240
This example shows a BASIC subroutine program for executing an FCS check
on a frame received by the host computer.
Normal reception data includes the FCS, delimiter or terminator, and so on.
When an error occurs in transmission, however the FCS or some other data may
not be included. Be sure to program the system to cover this possibility.
. . . . . . . . . . . . . . . . . . . . . . . . .
ELSE LENGS = LEN ( RESPONSE$ ) – 2
LENGS '
. . . . . . . . . . . . . . . . . . . . . . . . .
THEN
FCSD$ = " 0 " + FCSD$ '
THEN
FCSCK$ = " ERR "
Data transmitted and received
FCS data received
. . . . . . . . . .
Number of characters in FCS
XOR
Q
. . . . . . . . .
Section
4-3
FCS result
Need help?
Do you have a question about the CPM1 - PROGRAMING MANUAL 02-2001 and is the answer not in the manual?