$29.99
1
ELEC 3300
LAB 5: ADC FUNCTIONS
A. OBJECTIVE:
1. To familiarize yourself with the MINI-V3 Development Board.
2. To understand programming of the ADC function.
B. PRE-LAB ASSIGNMENT:
1. Study the information about MINI-V3 Development Board from the course website.
2. Study the ADC Section of the Reference Manual of STM32.
3. Study the Tutorial for LAB5.
C. LAB SETUP DETAILS
1. Connect the Fire Debugger according to the information about Fire debugger. Make sure
that the Green LED of the Fire Debugger is ON.
2. Follow the Tutorial for CubeMX, and information on Tutorial for LAB5 generate a Project
for LAB5 Task 1 to Task 4 using CubeMX. Please be reminded to set the external clock and
debugger interface in CubeMX
D. EXPERIMENT
In this LAB, there are 4 tasks.
Task 1 – Display Single ADC Conversion result of the external VR on LCD when K2 is
pressed.
Task 2 – Display Continuous Conversion ADC results of the external VR on LCD.
Task 3 – LDR Measurements.
Task 4 – Light Intensity System.
E. PROCEDURES
This LAB is an extension from LAB2 and LAB3, it will use the LCD to display the ADC
information and K2 for input. You need to refer to Tutorial for LAB2 and LAB3 for corresponding
information.
Task 1 – Display Single ADC Conversion result of the external VR on LCD when K2 is
pressed.
You need to write a program to display an ADC conversion result in both decimal and hex.
The converted value will be updated when K2 is pressed.
You are required to use Single Conversion Mode of ADC to finish Task 1.
You need to show to your TA your main.c for verifying the mode used.
Show your result to TA with your code.
Task 2 – Display Continuous Conversion ADC results of the external VR on LCD.
Change your program such that the LCD will be able to update the result at a certain period
without pressing K2.
You are required to use Continuous Conversion Mode of ADC to finish Task 2.
You need to show to your TA your main.c for verifying the mode used.
Show your result to TA with your code.
2
Task 3 – LDR Measurements.
Step 1: Replace your Variable Resistor circuit with a LDR circuit.
Figure 1: Light Dependent Resistor Circuit
Step 3: Run your program, observe LCD display and the value shown on Display
Step 4: Cover the Light Sensor by hand.
What is the value shown on LCD Display? ____________________________
Step 5: Use some light to shine on the Light Sensor
What is the value shown on LCD Display? ____________________________
Step 6: Stop the your program and swap the position of the sensors. i.e.
Figure 2: Swapped LDR Circuit
Step 7: Run your program, observe LCD display and the value shown on Display
Step 8: Observe LCD display and the value shown on Display
Channel input
depends on
your Student ID
Channel input
depends on
your Student ID
3200
no
3
Step 9: Cover the Light Sensor by hand.
What is the value shown on LCD Display? ____________________________
Step 10: Use some light to shine on the Light Sensor
What is the value shown on LCD Display? ____________________________
What is the relationship between the intensity to the resistance of LDR?
_______________________________________________________________________
Show your result to TA.
Task 4 – Light Intensity System.
Using your knowledge from Task 3 and LAB2, together with the RGB LED on MINI V3
Development Board, implement a five-level Light Intensity System such that..
Light Intensity
Very Dark Dark Medium Bright Very Bright
RGB LED
Color WHITE RED GREEN BLUE OFF
You can use either Figure 1 or Figure 2 on Page 2 of the LAB sheet to implement the
system, as long as it follows above requirement.
You are free to choose the boundary for the system, but you need to clearly show the TA the
five different levels according to the above requirement during the demo.
Show your result to TA with your code.
920
3770
if intensity
decrease resistance increase
intensity increase resistance decrease
Use fig 2
NO for 1400 how 2600 bro
l l l l l 1
OFF WHITE
bright c y
dark