TMCRC Overview Group

The TMCRC API call provides CRC calculation facilities. The Type parameter specifies either 8-bit CRC (Type=0) or 16-bit CRC (Type=1). Since the last byte of the unique registration number embedded into every 1-Wire device is an 8-bit CRC, this function call, in 8-bit CRC mode can verify the integrity of a 1-Wire registration number. The 16-bit CRC mode can be used to help make and verify Universal Data Packets (UDPs). Creating UDPs is a TMEX-supported way to packetize data before writing to a 1-Wire device. UDPs use 16-bit CRCs to verify data integrity.

A detailed description of the 8-bit CRC and 16-bit CRC can be found in Application Note 27 “Understanding and Using Cyclic Redundancy Checks with Dallas Semiconductor iButton Products”. The Application Note is located on MAXIM/Dallas Semiconductor’s website:

short far pascal TMCRC(

short length,         // length of bytes of buf
uchar far *buf,       // buffer of bytes to CRC
unsigned short seed,  // the CRC seed
short Type            // either 8-bit CRC (Type=0) or 16-bit CRC (Type=1)

For a description of the above types, see the TMEX Type Descriptions.



Specifies the length of the buffer to CRC.


Specifies a pointer the byte buffer containing the CRC.


Specifies the CRC seed to use.


Specifies the type of CRC to perform: It can either be an 8-bit CRC (Type=0) or a 16-bit CRC (Type=1)

Return Value

>=0 => the CRC result

<0 => TMEX Transport Error Return Code

Code Example

See Also

Universal Data Packets