Digilent Pmod CMPS2 Reference Manual - Page 8

Browse online or download pdf Reference Manual for Accessories Digilent Pmod CMPS2. Digilent Pmod CMPS2 12 pages.

Digilent Pmod CMPS2 Reference Manual
Pmod CMPS2™ Reference Manual
I2CWrite(0x20); //0x20 starts the SET action
14. Wait to receive an ACK from the Pmod CMPS2.
15. Delay at least 1 mS to allow the Pmod CMPS2 to finish the SET action.
16. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
17. Wait to receive an ACK from the Pmod CMPS2.
18. Send the Internal Control Register 0 (address 0x07) as the register to communicate with
I2CWrite(0x07); //address 0x07 corresponds to Control Register 0
19. Wait to receive an ACK from the Pmod CMPS2.
20. Write the command to take a measurement by setting bit 0 high followed by a STOP bit.
I2CWrite(0x01); //0x01 initiates a data acquisition
21. Delay at least 7.92 mS by default to allow the Pmod CMPS2 to finish collecting data.
22. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
23. Wait to receive an ACK from the Pmod CMPS2.
24. Send the Status Register (0x03) as the register to read
I2CWrite(0x03); //indicate you wish to interact with address 0x03
25. Provide a START condition and call the device ID with a read bit
I2CBegin(0xA1); //device ID 0x30 with a read (1) bit
26. Wait to receive an ACK from the Pmod CMPS2.
27. Cycle the SCL line to receive the Status Register data on the SDA line. Keep reading the Status Register by
repeating steps 8 through 13 until bit 0 is set to '1', indicating that the data on all 3 axes as available to be
read.
28. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
29. Wait to receive an ACK from the Pmod CMPS2.
30. Send the first register address corresponding to Xout LSB (0x00) as the register to be read.
I2CWrite(0x00); //address 0x00 as the first register to be read
31. Provide a START condition and call the device ID with a read bit
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.
Arrow.com.
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Page 8 of 12