Go Down

Topic: LIbrary for the DS28CM00 identification chip (Read 227 times) previous topic - next topic

robtillaart

Jul 24, 2017, 02:47 pm Last Edit: Jul 24, 2017, 02:48 pm by robtillaart
Published my library for the DS28CM00 on https://github.com/RobTillaart/Arduino/tree/master/libraries/DS28CM00. 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.


Code: (ds28cm00.h) [Select]
#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
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up