25
4
4
.
.
4
4
D
D
i
i
g
g
i
i
t
t
a
a
l
l
A
A
c
c
c
c
e
e
l
l
e
e
r
r
o
o
m
m
e
e
t
t
e
e
r
r
D
D
e
e
m
m
o
o
n
n
s
s
t
t
r
r
a
a
t
t
i
i
o
o
n
n
This demonstration shows a bubble level implementation based on a digital accelerometer. We use
I
2
C protocol to control the ADXL345 digital accelerometer, and the APDS-9300 Miniature Ambient
Light Photo Sensor. The LCD displays the interface of our game. When tilting the
VEEK-MT-C5SOC, the ADXL345 measures the static acceleration of gravity. In our Nios II
software, we compute the change of angle in the x-axis and y-axis, and show angle data in the LCD
display. The value of light sensor will change as the brightness changes around the light-sensor.
Figure 4-9
shows the hardware system block diagram of this demonstration. The system is clocked
by an external 50MHz Oscillator. Through the internal PLL module, the generated 150MHz clock is
used for Nios II processor and other components, and there is also 10MHz for low-speed
peripherals.
Figure 4-9 Block diagram of the digital accelerometer demonstration
Demonstration Source Code
••••
Project directory: G_sensor
••••
Bit stream used: G_sensor.sof
••••
Nios II Workspace: G_sensor\Software