HMC5883
16 www.honeywell.com
DZRA7
DZRA6
DZRA5
DZRA4
DZRA3
DZRA2
DZRA1
DZRA0
(0)
(0)
(0)
(0)
(0)
(0)
(0)
(0)
DZRB7
DZRB6
DZRB5
DZRB4
DZRB3
DZRB2
DZRB1
DZRB0
(0)
(0)
(0)
(0)
(0)
(0)
(0)
(0)
Table 19: Data Output Z Registers A and B
Data Output Register Operation
When one or more of the output registers are read, new data cannot be placed in any of the output data registers until all
six data output registers are read. This requirement also impacts DRDY and RDY, which cannot be cleared until new
data is placed in all the output registers.
Status Register
The status register is an 8-bit read-only register. This register is used to indicate device status. SR0 through SR7
indicate bit locations, with SR denoting the bits that are in the status register. SR7 denotes the first bit of the data stream.
SR7
SR6
SR5
SR4
SR3
SR2
SR1
SR0
(0)
(0)
(0)
(0)
(0)
REN (0)
LOCK (0)
RDY(0)
Table 20: Status Register
Location
Name
Description
SR7 to
SR3
0
These bits must be cleared for correct operation.
SR2
REN
Regulator Enabled Bit. This bit is set when the internal
voltage regulator is enabled. This bit is cleared when the
internal regulator is disabled.
SR1
LOCK
Data output register lock. This bit is set when this some but
not all for of the six data output registers have been read.
When this bit is set, the six data output registers are locked
and any new data will not be placed in these register until
on of four conditions are met: one, all six have been read
or the mode changed, two, a POR is issued, three, the
mode is changed, or four, the measurement is changed.
SR0
RDY
Ready Bit. Set when data is written to all six data registers.
Cleared when device initiates a write to the data output
registers, when in off mode, and after one or more of the
data output registers are written to. When RDY bit is clear
it shall remain cleared for a minimum of 5 μs. DRDY pin
can be used as an alternative to the status register for
monitoring the device for measurement data.
Table 21: Status Register Bit Designations
HMC5883
www.honeywell.com 17
Identification Register A
The identification register A is used to identify the device. IRA0 through IRA7 indicate bit locations, with IRA denoting the
bits that are in the identification register A. IRA7 denotes the first bit of the data stream. The number in parenthesis
indicates the default value of that bit.
The identification value for this device is stored in this register. This is a read-only register.
Register values. ASCII value H
IRA7
IRA6
IRA5
IRA4
IRA3
IRA2
IRA1
IRA0
0
1
0
0
1
0
0
0
Table 22: Identification Register A Default Values
Identification Register B
The identification register B is used to identify the device. IRB0 through IRB7 indicate bit locations, with IRB denoting the
bits that are in the identification register A. IRB7 denotes the first bit of the data stream.
Register values. ASCII value 4
Table 23: Identification Register B Default Values
Identification Register C
The identification register C is used to identify the device. IRC0 through IRC7 indicate bit locations, with IRC denoting the
bits that are in the identification register A. IRC7 denotes the first bit of the data stream.
Register values. ASCII value 3
Table 24: Identification Register C Default Values
IRB7
IRB6
IRB5
IRB4
IRB3
IRB2
IRB1
IRB0
0
0
1
1
0
1
0
0
IRC7
IRC6
IRC5
IRC4
IRC3
IRC2
IRC1
IRC0
0
0
1
1
0
0
1
1
HMC5883
18 www.honeywell.com
I
2
C COMMUNICATION PROTOCOL
The HMC5883 communicates via a two-wire I2C bus system as a slave device. The HMC5883 uses a simple protocol
with the interface protocol defined by the I2C bus specification, and by this document. The data rate is at the standard-
mode 100kbps or 400kbps rates as defined in the I2C Bus Specifications. The bus bit format is an 8-bit Data/Address
send and a 1-bit acknowledge bit. The format of the data bytes (payload) shall be case sensitive ASCII characters or
binary data to the HMC5883 slave, and binary data returned. Negative binary values will be in two’s complement form.
The default (factory) HMC5883 7-bit slave address is 0x3C for write operations, or 0x3D for read operations.
The HMC5883 Serial Clock (SCL) and Serial Data (SDA) lines have optional internal pull-up resistors, but require resistive
pull-ups (Rp) between the master device (usually a host microprocessor) and the HMC5883. Pull-up resistance values of
about 10k ohms are recommended with a nominal 1.8-volt digital supply voltage (DVDD). Other values may be used as
defined in the I2C Bus Specifications or with the internal 50k ohm pull-up resistors (SDAP, SCLP) that can be tied to
DVDD.
The SCL and SDA lines in this bus specification can be connected to a host of devices. The bus can be a single master to
multiple slaves, or it can be a multiple master configuration. All data transfers are initiated by the master device which is
responsible for generating the clock signal, and the data transfers are 8 bit long. All devices are addressed by I2C’s
unique 7 bit address. After each 8-bit transfer, the master device generates a 9 th clock pulse, and releases the SDA line.
The receiving device (addressed slave) will pull the SDA line low to acknowledge (ACK) the successful transfer or leave
the SDA high to negative acknowledge (NACK).
Per the I2C spec, all transitions in the SDA line must occur when SCL is low. This requirement leads to two unique
conditions on the bus associated with the SDA transitions when SCL is high. Master device pulling the SDA line low while
the SCL line is high indicates the Start (S) condition, and the Stop (P) condition is when the SDA line is pulled high while
the SCL line is high. The I2C protocol also allows for the Restart condition in which the master device issues a second
start condition without issuing a stop.
All bus transactions begin with the master device issuing the start sequence followed by the slave address byte. The
address byte contains the slave address; the upper 7 bits (bits7-1), and the Least Significant bit (LSb). The LSb of the
address byte designates if the operation is a read (LSb=1) or a write (LSb=0). At the 9 th clock pulse, the receiving slave
device will issue the ACK (or NACK). Following these bus events, the master will send data bytes for a write operation, or
the slave will clock out data with a read operation. All bus transactions are terminated with the master issuing a stop
sequence.
I2C bus control can be implemented with either hardware logic or in software. Typical hardware designs will release the
SDA and SCL lines as appropriate to allow the slave device to manipulate these lines. In a software implementation, care
must be taken to perform these tasks in code.
OPERATIONAL EXAMPLES
The HMC5883 has a fairly quick stabilization time from no voltage to stable and ready for data retrieval. The nominal 8.3
milli-seconds with the factory default single measurement mode means that the six bytes of magnetic data registers
(DXRA, DXRB, DZRA, DZRB, DYRA, and DYRB) are filled with a valid first measurement.
To change the measurement mode to continuous measurement mode, after the 8.3 milli-second power-up time send the
three bytes:
0x3C 0x02 0x00
This writes the 00 into the second register or mode register to switch from single to continuous measurement mode
setting. With the data rate at the factory default of 15Hz updates, a 67 milli-second typical delay should be allowed by the
I2C master before querying the HMC5843 data registers for new measurements. To clock out the new data, send:
0x3D, and clock out DXRA, DXRB, DZRA, DZRB, DYRA, and DYRB located in registers 3 through 8. The HMC5883 will
automatically re-point back to register 3 for the next 0x3D query. All six data registers must be read properly before new
data can be placed in any of these data registers.

103040000

Mfr. #:
Manufacturer:
Seeed Studio
Description:
Magnetic Sensor Development Tools Xadow - Compass
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet