Sensors
Sensors
Part Quantity
Launchpad 1
SHARP 2Y0A21 infrared (IR) proximity sensor 1
4-Digit, 7-Segment Display 1
220Ω Resistor 4
1KΩ Resistor 4
2KΩ Resistor 1
2N3906 Transistor 4
Introduction
This is a programming homework. You must submit your code to Gradescope by Thursday,
October 13th, 2022 by 10:00pm. Only submit the files indicated below. You should also
demo your code to the one of the course staff members on or before Monday, October 17th
during one of the available slots. You can only demo once. More instructions about the demos
will be announced during class and on Piazza.
Learning Objectives:
Learn the proper use of shift registers.
Getting Started:
1. For each task, create a new project in CCS, as explained in the tutorial on the website.
2. Submit only the source code files that you modified (i.e., not the entire project, binaries,
etc).
2. We expect that your implementation exactly matches the specifications indicated below.
3. Although we might be lenient with unspecified behaviors, you should justify your imple-
mentation choices.
4. If you are unsure about the specifications, you should ask questions on Piazza or directly
to the course staff.
5. Reading, understanding, and eliciting the requirements and specifications is also part of
the assignment.
1
15-348 Homework 5 Page 2 of 6
There are two types of single-digit 7-segment displays: common anode and common cathode.
In common anode displays, the anode of the LEDs is connected to one pin (usually connected to
a power source). In common cathode displays, the cathodes are connected to one pin (usually
connected to ground). Our display is common anode. There are six input pins (power pins)
that serve to power each digit and the extra points. The other 10 pins are “ground pins”,
meaning that when connected to ground, the corresponding LEDs light up.
2
15-348 Homework 5 Page 3 of 6
• 1 ground pins for each segment (A-G) (pins 14, 16, 13, 3, 5, 11, and 15)
• 1 power and ground pin for the apostrophe (pins 10 and 9).
3
15-348 Homework 5 Page 4 of 6
4
15-348 Homework 5 Page 5 of 6
5
15-348 Homework 5 Page 6 of 6
Additional Guidance
Hardware Testing
This lab includes multiple components that are interfaced together in ways that can be tricky
to get right. Make sure to test each functional unit separately. For example, connect the
power lines from your display to the transistors, connect all the ground lines to ground, and
try turning on individual digits by manually connecting a transistor base to low.
If you build the entire circuit and then try to use it, things are unlikely to work and you
will spend many, many hours looking for the mistakes.
General Tips
• Work incrementally, testing each small piece of functionality as you go. For example,
your first step might be simply seeing if you can toggle an output pin from 1 to 0 and see
the voltage change on the multimeter.
• If you spend too long debugging something, and can’t find the problem, start over. Rewire
your circuit and rewrite the code from scratch. It shouldn’t take you that long the second
time, and you may be surprised to find that it works.