LIbrary for the DS28CM00 identification chip

Published my library for the DS28CM00 on Arduino/libraries/DS28CM00 at master · RobTillaart/Arduino · GitHub. Version 0.1.0.

Datasheet: http://www.mouser.com/ds/2/256/DS28CM00-102134.pdf

The DS28CM00 (DS28 for short) is an I2C (and SMBus) chip that holds an “unique” ID. This ID is 8 bytes in size, byte[0] is always 0x70 and byte[7] is a CRC over byte 0…6. So in fact 48 bits make up the ID whichis good for 2.81E14 possible numbers. Those who are familiar with the DS18B20 temperature sensors will recognize the scheme. I could use a DS18 for identification, but the DS28 is far cheaper and smaller. It can therefor be added to almost any PCB / project.

The DS28 can operate at 100KHz and 400KHz but above that I had problems communicating. As I did not use pullup resistors, this is what I could expect. Included in the library are two test sketches, one that shows its normal use, and a second that collects some performance figures. The interface is pretty straightforward see below.

#ifndef DS28CM00_H
#define DS28CM00_H
//
//    FILE: DS28CM00.h
//  AUTHOR: Rob Tillaart
// PURPOSE: Library for the DS28CM00 unique identification chip.
// VERSION: 0.1.0
// HISTORY: See DS28CM00.cpp
//     URL:
//
// Released to the public domain
//

#include <Wire.h>

#include "Arduino.h"

#define DS28CM00_LIB_VERSION      "0.1.0"
#define DS28CM00_I2C_MODE         0x00
#define DS28CM00_SMBUS_MODE       0x01

class DS28CM00
{
public:
  explicit DS28CM00();

  void begin();
  bool getUID(uint8_t *);

  bool setI2CMode()           { return setMode(DS28CM00_I2C_MODE); };
  bool setSMBusMode()         { return setMode(DS28CM00_SMBUS_MODE); };
  bool getMode(uint8_t &mode);

private:
  bool setMode(uint8_t m);
};

#endif

// END OF FILE

As always remarks are welcome,

Regards,
Rob