CE 433 Spring 2022 SPI Tutorial Taylor Nakai tsnakai@fortlewis.edu
Introduction: In
this homework, we worked on the basics and implementing the PmodALS
ambient light sensor so that an 8-bit binary number (0-255) light
intensity number is read in. SPI is a synchronous communication
protocol allowing for data to be transmitted and received at the same
time. To be able to use the PmodALS ambient light sensor, we had to use
the SPI Light Sensor module, the SPI Leader Receiver module, the Binary
to BCD module, the Seven Segment Driver module, and the Decoder Seven
Segment module. We were tasked with displaying the 8-bit value on the
Seven Segment Display and the LEDs of the Basys 3.
Task 1: In
Task 1, had us go over some basics associated with SPI. We learned
about how many wires are required for SPI, how the data packet size is
not constant in SPI, how SCK is generated, and the transmission and
reception operations assciated with SPI. Figure 1 shows the MOSI of the
leader and follower. Figure 2 shows the MISO of the leader and the
follower.
Figure 1. Code implementing the MOSI of the leader and follower.
Figure 2. Code implementing the MISO off the leader and follower.
Task 2: In Task 2, we were given the task of displaying the 8-bit ambient light sensor value on the Seven Segment Display and the LEDs of the Basys 3. To
be able to use the PmodALS ambient light sensor, we had to use the SPI
Light Sensor module, the SPI Leader Receiver module, the Binary to BCD
module, the Seven Segment Driver module, and the Decoder Seven Segment
module. Figure 3 is the code needed to be able to use the ambient light
sensor, the only module not shown is the SPI Leader Receiver which is
shown above in Figure 2.
Figure 3. Code needed to be able to use the ambient light sensor.
Figure 4. Demonstation of using the ambient light sensor with the Basys 3. Discussion: By
completing this homwork, it allowed me to become more comfortable using
the ambient light module, the SPI protocals associated with the Basys3.
I really enjoyed doing this homework as learning more about SPI was
interesting and seeing the ambient light value displayed on the LEDs
and Seven Segment Display. I really liked this tutorial as it was
something that I never have explored. Overall, I think this homework
was a great introduction into using the SPI protocal that the Basys3
has to offer. ....................................................