Digilent PmodCMPS Reference Digilent PmodCMPS Reference MMaannuuaall Revision: September 9, 2013 1300 NE Henley Court, Suite 3 Note: This document applies to REV B of the board. Pullman, WA 99163 (509) 334 6306 Voice (509) 334 6300 Fax Overview The Digilent PmodCMPS features the popular Honeywell HMC5883L 3-axis digital compass and can add 2 compass heading readings to any Digilent host board with an I C interface. Pmod CMPS Features Include: 2 I C communication interface with daisy chain connectors 8 gauss field detection external header for access to DRDY (data ready) pin optional pull-up resistors for SCL and SDA pins 160 Hz maximum data output rate Functional Description The PmodCMPS can be configured to run in single measurement or continuous measurement mode. Each mode has different maximum output rates. The magnetic field measured on each axis is represented as a signed 16-bit word with the five most significant bits being the sign bits. There are two eight bit registers for each axis. Once one data register is read, the other five data registers must be read before any new data can be written to those registers. The internal address pointer automatically increments when a register is successfully read from. Once the address pointer is incremented past 0x09, it will roll over to 0x03, which represents the first axis output data register. 2 I C Interface 2 The PmodCMPS is an I C slave device that is compatible with standard and fast modes (100 kHz and 400 kHz, respectively). The 7-bit address of the PmodCMPS will be 0x1E. This address corresponds to 0x3C for a write 2 operation and 0x3D for a read operation. Details on the I C operations are provided below: Write 2 A write operation can be initiated with a Start condition on the I C bus, followed by 0x3C. When writing to a register, the desired registers address must be sent as the next byte after the PmodCMPS acknowledges that it has been addressed. The bytes sent by the master to the PmodCMPS are shown below: 1. 7-bit addresss of the PmodCMPS + write bit (0) 2. Address of internal register to write to 3. Data Doc: 502-285 page 1 of 2 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Digilent PmodCMPS Read 2 A read operation can be initiated with a Start condition on the I C bus, followed by 0x3D. After the PmodCMPS th acknowledges that it has been addressed on the 9 clock pulse, the data to be read will be output from the device on the next 8 clock pulses. The data sent will be from the address pointed to by the internal address pointer. This will have either been automatically incremented from the previous read operation, or set by the previous write operation. 1. 7-bit address of the PmodCMPS + read bit (1) 2. Master reads data byte sent from PmodCMPS 3. (Loop) Note that step three is necessary when reading the 6 axis data registers. The master should read all six data registers at once. Set Address Pointer The address pointer can be set to any register by only completing steps one and two from the write procedure (listed above). After the PmodCMPS acknowledges the register address, the master should create a Stop 2 condition on the I C bus. Note: For more information on the operation of the PmodCMPS, please see the HMC5883L data sheet available from www.honeywell.com. www.digilentinc.com page 2 of 2 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.