$29.99
1
ELEC 3300
LAB 6: I2C APPLICATION ON HMC5883L Digital Compass IC
A. OBJECTIVE:
1. To familiarize yourself with the I2
C Communication using STM32.
2. To understand the HMC5883L Digital Compass IC module.
B. PRE-LAB ASSIGNMENT:
1. Study the information about MINI-V3 Development Board from the course website.
2. Study the I2C Section of the Reference Manual of STM32.
3. Study the Tutorial for LAB6.
4. Study the HMC5883L datasheet.
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 LAB6 generate a Project
for LAB6 Task 1 to Task 2 using CubeMX. Please be reminded to set the external clock and
debugger interface in CubeMX
D. EXPERIMENT
In this LAB, there are 2 tasks.
Task 1 – Display Compass Result on LCD
Task 2 – Build your 7-segment display circuit according to your student ID and display the last
digit of the Digital Compass on the 7-segment display.
E. PROCEDURES
In this LAB, we will use the I2
C function from the MINI-V3 development board to
communicate to the HMC5883L Digital Compass IC module. For the details, please refer back
to Tutorial for LAB6.
Task 1 – Display Compass Result on LCD
Refer to the information in Tutorial for LAB6, write a program to display angle information
from the digital compass. With the component side facing up, you should be able to get 0 – 359
degrees reading when the compass is rotating clockwise. Below is an example.
You are welcomed to design your own output, say N 20o
E, but at least the reading should be
consistent.
Show your result to TA.
2
Task 2 – Build your 7-segment display circuit according to your student ID and display the last
digit of the Digital Compass on the 7-segment display.
In order to let you familiar with the board.
You are required to display the last digit using a 7-segment LED.
(e.g. if LCD is displaying 236, the 7-segment LED should display ‘6’)
You will be given a Common Anode 7-segment LED
Basically you need to control the 7 pins on and off.
You need to build your own decoding table.
(i.e. how to display 1, 2, 3, 4 … 0)
Connect the Vcc of the 7-segment to 3.3V with a resistor.
Your Student ID ________________________________
Pin Set Actual Pin
Number on
STM32
Default Function of
the pin on 100pin
STM32F103VET6
I/O Function Alternate
Functions
Function on the
MINI V3
Development
Board
Can use for
7-segment
LED?
A
B
C
D
E
F
G
Show your table, program, hardware and final result to TA.
20472522
22 Versa No No
sina.sc2asu ckcameuadatabus5 Yes 52 PB13 Yes usans as t
12michin cno
cus.mg
camera
usarha e2ns.us
25 PAZ Yes Arcus un camera7270KRST
yes nns.ae
mnz.cuisiswDtoJ7AG
72 PA13 Yes No 7ms debugger
4 PB10 Yes 2in soll cameradatabus2 NO
usartsex bergusedforzzy
No
04 PET Yes TRACED't 212Data
EsmeAzl Noexternalconnector
Zo fizzy No No
In substitution I use
original
PAH PAS PA6 PAY IPA 8 PAZ PBB
ai PAZ e PAI
bi pA4 fi PAS
c PAS g PBB
d PAG