![Terasic DE10-Standard Скачать руководство пользователя страница 98](http://html.mh-extra.com/html/terasic/de10-standard/de10-standard_user-manual_1088534098.webp)
DE10-Standard
User Manual
97
www.terasic.com
January 19, 2017
the system are:
1.
Open I2C bus driver "/dev/i2c-0": file = open("/dev/i2c-0", O_RDWR);
2.
Specify G-sensor's I2C address 0x53: ioctl(file, I2C_SLAVE, 0x53);
3.
Specify desired register index in g-sensor: write(file, &Addr8, sizeof(unsigned char));
4.
Read one-byte register value: read(file, &Data8, sizeof(unsigned char));
The G-sensor I2C bus is connected to the I2C0 controller, as shown in the
Figure 6-7
. The driver
name given is '/dev/i2c-0'.
Figure 6-7 Connection of HPS I2C signals
The step 4 above can be changed to the following to write a value into a register.
write(file, &Data8, sizeof(unsigned char));
The step 4 above can also be changed to the following to read multiple byte values.
read(file, &szData8, sizeof(szData8)); // where szData is an array of bytes
The step 4 above can be changed to the following to write multiple byte values.
write(file, &szData8, sizeof(szData8)); // where szData is an array of bytes
G-sensor Control
The ADI ADXL345 provides I2C and SPI interfaces. I2C interface is selected by setting the CS pin
to high on the DE1_SoC board.
The ADI ADXL345 G-sensor provides user-selectable resolution up to 13-bit
±
16g. The
resolution can be configured through the DATA_FORAMT(0x31) register. The data format in this
demonstration is configured as:
Full resolution mode
±
16g range mode
Left-justified mode
The X/Y/Z data value can be derived from the DATAX0(0x32), DATAX1(0x33), DATAY0(0x34),
Содержание DE10-Standard
Страница 1: ...DE10 Standard User Manual 1 www terasic com January 19 2017 ...
Страница 7: ...DE10 Standard User Manual 6 www terasic com January 19 2017 ...
Страница 105: ...DE10 Standard User Manual 104 www terasic com January 19 2017 Figure 6 14 LCD display for the LCD Demonstration ...
Страница 121: ...DE10 Standard User Manual 120 www terasic com January 19 2017 Figure 8 4 Select Devices page ...