Skip to Main Content
The 1-Wire protocol provides a reliable means of detecting many types of errors that may occur in the bit stream it controls. It does so by carrying out cyclic redundancy check (CRC) calculations on data to be transmitted from 1-Wire and iButton slave devices, and appending the result to the data for onward transmission to the bus master as a block. Where the user of a 1-Wire or iButton device wishes to replicate the 1-Wire protocol in software, a number of application notes describe how to calculate 1-Wire CRC values. However, depending on the software implementation platform being used, these notes may not suffice for the average electronics systems engineer. This paper breaks down and compares a number of popular CRC calculation methods into basic tasks that may be interpreted for use in a programmable device that functions as a 1-Wire bus master; with a view to aid in further understanding of general CRC concepts. These tasks, which may also be extended to CRC calculations based on other generator polynomials, were verified by developing firmware routines that were run in a PIC 16F628A microcontroller functioning as the bus master to a single DS18S20 1-Wire Digital Thermometer.