Digilent Pmod CMPS2 Panduan Referensi - Halaman 7
Jelajahi secara online atau unduh pdf Panduan Referensi untuk Aksesori Digilent Pmod CMPS2. Digilent Pmod CMPS2 12 halaman.
Pmod CMPS2™ Reference Manual
I2CReadMultiple(6); //read six bytes, sending an ACK to the slave device betwe
en each byte received and a NACK after the last byte
20. Convert the readings into usable data. More details are available in the Data Conversion section.
21. Wait 1/3 of the acquisition time (by default 2.64 ms) before performing another measurement.
2.4
Applications Information
The Pmod CMPS2 is an ideal Pmod to use as a compass. Like all compasses, it is recommended that the Pmod
CMPS2 is calibrated before using the module.
2.4.1 Calibration
To calibrate the magnetometer, the offset associated with the magnetic sensors and the environment needs to be
calculated and removed from future measurements.
The internal offset can be calculated and accounted for through the following method:
1. Power on the Pmod CMPS2 and wait for 10 mS before further operation.
2. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
3. Wait to receive an ACK from the Pmod CMPS2.
4. Send the Internal Control Register 0 (address 0x07) as the register to communicate with
I2CWrite(0x07); //address 0x07 corresponds to Control Register 0
5. Wait to receive an ACK from the Pmod CMPS2.
6. Write the command to recharge the capacitor to prepare for the SET action.
I2CWrite(0x80); //0x80 refills the capacitor
7. Wait to receive an ACK from the Pmod CMPS2.
8. Delay at least 50 mS to allow the Pmod CMPS2 to finish preparing.
9. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
10. Wait to receive an ACK from the Pmod CMPS2.
11. Send the Internal Control Register 0 (address 0x07) as the register to communicate with
I2CWrite(0x07); //address 0x07 corresponds to Control Register 0
12. Wait to receive an ACK from the Pmod CMPS2.
13. Write the command to start a SET action.
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Page 7 of 12