Digilent Pmod CMPS2 Manuale di riferimento - Pagina 6

Sfoglia online o scarica il pdf Manuale di riferimento per Accessories Digilent Pmod CMPS2. Digilent Pmod CMPS2 12.

Digilent Pmod CMPS2 Manuale di riferimento
Pmod CMPS2™ Reference Manual
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 take a measurement by setting bit 0 high followed by a STOP bit.
I2CWrite(0x01); //0x01 initiates a data acquisition
7. Delay at least 7.92 mS by default to allow the Pmod CMPS2 to finish collecting data.
8. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
9. Wait to receive an ACK from the Pmod CMPS2.
10. Send the Status Register (0x03) as the register to read
I2CWrite(0x03); //indicate you wish to interact with address 0x03
11. Provide a START condition and call the device ID with a read bit
I2CBegin(0xA1); //device ID 0x30 with a read (1) bit
12. Wait to receive an ACK from the Pmod CMPS2.
13. 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.
14. Provide a START condition and call the device ID with a write bit
I2CBegin(0xA0); //device ID 0x30 with a write (0) bit
15. Wait to receive an ACK from the Pmod CMPS2.
16. 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
17. Provide a START condition and call the device ID with a read bit
I2CBegin(0xA1); //device ID 0x30 with a read (1) bit
18. Wait to receive an ACK from the Pmod CMPS2.
19. Cycle the SCL line to receive the data bits from the X, Y, and Z registers in the SDA line, providing an ACK
between each data byte. The Pmod CMPS2 address pointer automatically moves to each consecutive
byte. End the communication by sending a NACK followed by a STOP command.
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.
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Page 6 of 12