Skip to content

CRC

Cyclic Redundancy Code

This string function conducts a logical operation on the binary form of a string value, byte by byte, and returns a two-byte ASCII cyclic redundancy code. CRC provides some communication error checking on a given string value with the probability of uniqueness being 1 in 65536.

CRC (string-value [,2-byte-string] [,ERR=line-ref|,ERC=error-code])
string-value
is any string.
2-byte-string
is a two-byte string to be included in this CRC operation that is used to carry forward the result of a previous CRC operation.
line-ref
is the program line number or label to branch to if an error is produced by this function.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

This function is normally used in checking for errors in data transmission.

The logical operation of this function is a complex exclusive OR, in a predetermined pattern, on each bit in the binary form of the string-value.

This function is associative, allowing results to be accumulated for use in later CRC functions. For this capability, the optional 2-byte-string can be specified.

CRC ("C")

returns the characters “qA” or $F141$ which represent the result of the CRC operation.

LET A$ = CRC (B$+C$)

is equivalent to:

LET A$ = CRC (B$)
LET A$ = CRC (C$,A$)

LRC function

From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF