Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Leonel Rapport LAB1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

PAN AFRICAN UNIVERSITY JOMO KENYATTA UNIVERSITY

OF AGRICULTURE AND
INSTITUTE FOR BASIC
TECHNOLOGY
SCIENCES, TECHNOLOGY
AND INNOVATION(PAUISTI) (JKUAT)

l d

Advanced Embedded System Design


(PUE 3130) LAB1 REPORT

Name Leonel GAMVOU TAKLAI


Identification EE300-0006/2022-2023
Program Computer Engineering
Department Electrical Engineering
Code PUE 3140
Date 13 June 2023

Under the coordination of


Dr. MUCHUKA Manguu

Academic year 2022-2023


Contents
Abstract ........................................................................................................................... 4
Introduction ..................................................................................................................... 5
I. Materials and methods ............................................................................................. 6
I.1. Materials ................................................................................................................ 6
I.2. Methods ................................................................................................................. 6
I.2.1 Task 1 .............................................................................................................. 6
I.2.2. Task 2 ............................................................................................................. 9
II. Results ................................................................................................................... 11
II.1. Interface for a multicomp 3mm LED ................................................................... 11
II.2. Array of four LEDs .............................................................................................. 12
II.3. interface for a 5161AS seven-segment............................................................... 13
II.4. Luminous intensity of 65 mcd ............................................................................. 14
III. Analysis and discussion ...................................................................................... 14
Conclusion .................................................................................................................... 15
Appendix A .................................................................................................................... 16
Appendix B .................................................................................................................... 17
Appendix C .................................................................................................................... 18
References .................................................................................................................... 23

1
Directed by Leonel Gamvou Taklai
Figure 1: Information about MSP430FR5969 .................................................................. 7
Figure 2: Starting interface of Code Composer Studio .................................................... 8
Figure 3: Assembly code to blinking LED ........................................................................ 8
Figure 4 : circuit diagram with LED, resistor, out put and ground .................................... 9
Figure 5: circuit design with four LEDs and four resistors ............................................. 10
Figure 6: 5161AS seven-segment ................................................................................. 11
Figure 7: Pratical design LED with Resistor .................................................................. 12
Figure 8: Binary up-down count .................................................................................... 13
Figure 9: 5161AS seven segment display ................................................................... 14

2
Directed by Leonel Gamvou Taklai
Table 1: 3 mm round LED characteristics. ...................................................................... 9
Table 2: Main values for four (04)resistors and 04 LED ................................................ 10
Table 3: Decimal display and Port connexion parameter .............................................. 13

3
Directed by Leonel Gamvou Taklai
Abstract
This report describes two practical tasks performed using the MSP430
microcontroller and the Launchpad development board. In Practical Task 1, relevant
information is extracted from the MSP430 documentation and the Launchpad user guide,
including details about the MCU supply voltage, GPIO characteristics, the number of
GPIO ports, and the on-board LED's connection. The Code Composer Studio (CCS) is
then installed on a laptop, and the board is connected. An example project for blinking
the on-board LED is opened, built, and executed on the board using CCS. In Practical
Task 2, a suitable interface is designed for a multicomp 3mm LED to be connected to pin
P1.3. The design aims to provide a luminous intensity of 15 mcd. The interface is tested
by implementing LED blinking. Additionally, an array of four LEDs is built and connected
to a chosen port. A program is written to display binary up count, binary down count, and
binary up-down count on the LED array. Furthermore, a suitable interface is designed for
a 5161AS seven-segment display operating at 0.5 relative luminous intensity per
segment. A program is developed to display numbers from 0 to 9 on the seven-segment
display. Finally, the luminous intensity of the multicomp 3mm LED is increased to 65 mcd,
and if required, a driver circuit using BC548 or 2N3904 transistors is used. This report
provides a comprehensive overview of the practical tasks performed, including the
extraction of relevant information, installation and usage of CCS, LED and seven-
segment display interface design, and program implementation for LED blinking and
number display.
Keywords: MSP430, Launchpad, Code Composer Studio, GPIO, LED interface, seven-
segment display, luminous intensity, blinking, microcontroller.

4
Directed by Leonel Gamvou Taklai
Introduction
This report presents the implementation of two practical tasks using the MSP430
microcontroller and the Launchpad development board. The main objective of these tasks
was to gain practical experience with the microcontroller and explore its functionalities.
Task 1 involved extracting essential information from the MSP430 documentation and the
Launchpad user guide, installing the Code Composer Studio (CCS) software, and
programming the board to blink the on-board LED. Task 2 focused on designing
interfaces for an LED and a seven-segment display, followed by writing programs to
display patterns and numbers. The successful completion of these tasks provided
valuable insights into the capabilities and versatility of the MSP430 microcontroller.

5
Directed by Leonel Gamvou Taklai
I. Materials and methods
The Materials and Methods section of a lab report typically describes the equipment,
software, and procedures used to conduct the experiment. It should provide enough detail
so that another researcher could reproduce the experiment. This section should be written
in a clear and concise manner, focusing on the essential details of the experimental setup
and the steps taken to perform the experiment.

I.1. Materials
Throughout our work we have used several materials but the most important are
the following:
 MSP430 microcontroller,
 Launchpad development board,
 Laptop with Code Composer Studio (CCS) software,
 Multicomp 3mm LED,
 5161AS seven-segment display,
 2N3904 transistors (if needed for LED luminous intensity increase),
 Necessary cables and connectors.

I.2. Methods
This lab aims to provide hands-on experience with the MSP430 microcontroller. In
task 1 we will extract information from the documentation and in task 2 we used Code
Composer Studio to write a program for blinking the on-board LED, and design interfaces
for LEDs and a seven segment display to display binary counts and numbers.

I.2.1 Task 1
In this part it is a question of extracting information concerning the MSP430FR5969
Microprocessor, installing visual studio code (CCS) and launching the CCS to start with
an example given in the CCS for blinking the on-board LED.

a) Extracting information
Refer to the MSP430FR5969 documentation and Launchpad user guide to obtain the
following details:

6
Directed by Leonel Gamvou Taklai
Figure 1: Information about MSP430FR5969

b) Installing CCS
Installing CCS (Combined Charging System) requires the following steps:
 Prepare the charging site with appropriate electrical infrastructure,
 Install CCS charging stations,
 Connect the charging stations to the power grid and communication network,
 Test and commission the system to ensure proper functionality,
 Educate users on how to use CCS for electric vehicle charging.

c) Connecting the board


Connect the Launchpad board to the laptop using the appropriate cables.

d) Starting CCS
Launch the Code Composer Studio software on the laptop.

7
Directed by Leonel Gamvou Taklai
Figure 2: Starting interface of Code Composer Studio

e) Creating a new project


Open a new project in CCS and choose an example provided for blinking the on-board
LED.

Figure 3: Assembly code to blinking LED

f) Building and debugging


Build the project in CCS to compile the code. Use the debugging tools provided by
CCS to load and execute the program on the Launchpad board. Verify that the on-board
LED blinks as intended.

8
Directed by Leonel Gamvou Taklai
I.2.2. Task 2
In this part, it is question to design a suitable interface for a multicomp 3mm LED to
be connected to P1.3 pin, write a program to display a binary up-down count, and write a
program to display number from 0 to 9.

g) Designing the LED interface


Based on the datasheets and specifications, design an interface circuit to connect the
multicomp 3mm LED to pin P1.3 of the microcontroller. Using the 3 mm round LED lamp
characteristic, we can find these values on the table below:
Table 1: 3 mm round LED characteristics.

Information Value
Relative luminuous Intensity (RLI) 30 mcd
Forward current (IF) 5 mA
Forward voltage (UF) 3.3 v
Forward current (IF) 1.7 v
Voltage across resistor (VR)= Forward 1.6 v
current (IF) - Voltage drop (VD)
Resistor (R) = 𝑉𝑅 ⁄𝐼𝐹 = 1.6 𝑣 ⁄5 𝑚𝐴 320 Ω

Figure 4 : circuit diagram with LED, resistor, output and ground

h) Binary up-down count


Using the design in part (a), we built an array of four LEDs connected to a port P1.3,
P1.4, P1.5, P1.7. Let’s do first some calculation for finding the main values which can
help us to build our suitable circuit which contain for resistors and for LED. After the
calculations for getting the resistors values, you could see the suitable circuit design. We

9
Directed by Leonel Gamvou Taklai
used livewire software for that drawing design and the detail information are on the table
2 below.
Table 2: Main values for four (04)resistors and 04 LED

Information Value
Relative luminuous Intensity (RLI) 15 mcd
Forward current (IF) 2.5 mA
Forward voltage (UF) 2.2 v
Forward current (IF) 1.6 v
Voltage across resistor (VR)= Forward 0.6 v
current (IF) - Voltage drop (VD)
Resistor (R) = 𝑉𝑅 ⁄𝐼𝐹 = 0.6 𝑣 ⁄2.5 𝑚𝐴 240 Ω

Figure 5: circuit design with four LEDs and four resistors

i) The 5161AS seven-segment display


The 5161AS is a common cathode seven-segment display commonly used for
numeric display applications. It consists of six individual segments (seven if the decimal
point is included) arranged in a specific pattern to display numbers from 0 to 9. The display
requires external current-limiting resistors to control the current flowing through each
segment. It operates at a relative luminous intensity of 0.5, indicating a medium

10
Directed by Leonel Gamvou Taklai
brightness level. The pinout and electrical specifications can be found in the datasheet
provided by the manufacturer.

Figure 6: 5161AS seven-segment

To connect the 5161AS seven-segment display:


 Identify the pinout (A, B, C, D, E, F, G, DP, and GND).
 Connect the common cathode (GND) pin to ground.
 Connect each segment pin (A, B, C, D, E, F, G, DP) to suitable output pins or
current-limiting resistors.
 Configure the output pins as GPIO and set the desired logic level to activate or
deactivate the corresponding segments.
 Connect the power supply (VCC) pin of the display to the appropriate voltage
level (e.g., 5V or 3.3V) based on requirements.

II. Results
After completing the practical tasks, we will have gained hands-on experience with the
MSP430 microcontroller and its peripherals. We will have learned how to extract
important information from documentation, design interfaces for LEDs and a seven
segment display, and write programs for displaying binary counts and numbers. We will
also have practiced using Code Composer Studio to write and execute programs.

II.1. Interface for a multicomp 3mm LED


we designed an interface for a multicomp 3mm LED to be connected to P1.3 pin
of the MSP430 microcontroller. Using the datasheets provided, we calculated the value

11
Directed by Leonel Gamvou Taklai
of the series resistor required to provide a luminous intensity of 15 mcd. We then
connected the LED to the microcontroller and wrote a program to blink the LED at a
frequency of 2 Hz. The LED successfully blinked at the desired frequency and provided
the expected luminous intensity. When we use the following assembly code to blink the
LED in figure 3, we can see below the result of our design compound of output (P1.3),
resistor with 240 ohms as value and 3mm LED.

Figure 7: Pratical design LED with Resistor

II.2. Array of four LEDs


In this part we extended the interface for the LED to build an array of four LEDs
connected to Port 1 of the microcontroller. We then wrote a program to display binary up
count, binary down count, and binary up-down count on the LEDs. The program
successfully displayed the desired patterns on the LEDs. The figure 9 show the program
for that displays (binary up count, binary down count and binary up-down count).

12
Directed by Leonel Gamvou Taklai
Figure 8: Binary up-down count

II.3. interface for a 5161AS seven-segment


we designed an interface for a 5161AS seven-segment display to be connected to
Port 1 of the microcontroller. Using the datasheets provided, we calculated the value of
the series resistor required to provide a relative luminous intensity of 0.5 per segment.
The parameter of port connexion is illustrated on table 3 below.
Table 3: Decimal display and Port connexion parameter

We then wrote a program in assembly language to display numbers from 0 to 9 on


the seven-segment display. The program successfully displayed the numbers on the
display.

13
Directed by Leonel Gamvou Taklai
Figure 9: 5161AS seven segment display

II.4. Luminous intensity of 65 mcd


we repeated part (a) to provide a luminous intensity of 65 mcd, using a BC548
transistor as a driver circuit. The LED successfully blinked at the desired frequency and
provided the expected luminous intensity.
Overall, we were able to successfully design interfaces for the LED and the seven-
segment display, and write programs to display various patterns and numbers. The
programs executed as intended, and the LEDs and display provided the expected
luminous intensities and displayed the desired patterns and numbers. Analysis and
discussion

III. Analysis and discussion


Of the Material and Methods section of this lab report could focus on the thoroughness
and clarity of the instructions provided for each practical task. For example, the report
could be evaluated for whether it provides enough detail to enable readers to understand
how to extract information from the MSP430 documentation, set up the Code Composer
Studio software, and build interfaces for the LEDs and seven-segment display. The report
could also be evaluated for whether it provides clear instructions on how to execute each
step of the experiment. Additionally, the analysis and discussion could consider any
potential sources of error in the experimental procedures and how they were addressed.
In conclusion, a well-written and detailed Material and Methods section is crucial for
ensuring the reproducibility and credibility of the experimental results.

14
Directed by Leonel Gamvou Taklai
Conclusion
In this lab, we gained practical experience in working with the MSP430
microcontroller and Launchpad development board. We extracted information from the
documentation and user guide, installed Code Composer Studio, and wrote programs to
interface with external components such as LEDs and a seven-segment display. We also
learned about voltage and current requirements and how to use series resistors and driver
circuits to provide the required voltage and current. Overall, this lab helped us improve
our microcontroller programming and interfacing skills and prepare us for future projects.

15
Directed by Leonel Gamvou Taklai
Appendix A
; MSP430 Assembler Code Template for use with TI Code Composer Studio
.cdecls C,LIST,"msp430.h" ; Include device header file

.def RESET ; Export program entry-point to


; make it known to linker.
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
; Main loop here
init:
bic.w #LOCKLPM5, &PM5CTL0;
bis.b #BIT0, &P1DIR; set p1.3 as output
main:
xor.b #BIT0, &P1OUT; toggle p1.3
mov.w #0FFFFh, R4; move a word into register 4
again:
dec.w R4; decrement register 4
jnz again; continue decreasing register 4 till 0
jmp main ; jump to main
nop;
; Stack Pointer definition
.global __STACK_END
.sect .stack

; Interrupt Vectors
.sect ".reset" ; MSP430 RESET Vector
.short RESET

16
Directed by Leonel Gamvou Taklai
Appendix B
; MSP430 Assembler Code Template for use with TI Code Composer Studio
.cdecls C,LIST,"msp430.h" ; Include device header file
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
;-------------------------------------------------------------------------------
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------
init:
bic.w #LOCKLPM5, &PM5CTL0;
bis.b #BIT3, &P1DIR; set p1.3 as output
main:
xor.b #BIT3, &P1OUT; toggle p1.3
mov.w #0FFFFh, R4; move a word into register 4
again:
dec.w R4; decrement register 4
jnz again; continue decreasing register 4 till 0
jmp main ; jump to main
nop;
;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET

17
Directed by Leonel Gamvou Taklai
Appendix C
; MSP430 Assembler Code Template for use with TI Code Composer Studio
;-----------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file
;-----------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-----------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
;-----------------------------------------------------------------------------
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
;----------------------------------------------------------------------------
; Main loop here
; Initialize
.global _start
_start:
mov.w #0x000F, &P1DIR ; Set Port 1 as output
mov.w #0x0000, &P1OUT ; Clear Port 1
mov.w #0x0001, R5 ; Initialize counter
bic.w #LOCKLPM5, &PM5CTL0;
loop:
and.w #0xFFF0, &P1OUT ; Clear lower 4 bits of P1OUT
OR.W R5, &P1OUT ; Output current count to LEDs
and.w #1, R5 ; Increment counter
cmp.w #0x0010, R5 ; Check counter limit
jne loop ; Repeat if counter not reached
finish:
jmp finish ; End program (loop indefinitely)
nop
;-----------------------------------------------------------------------------
; Stack Pointer definition
.global __STACK_END
.sect .stack
; Interrupt Vectors
.sect ".reset" ; MSP430 RESET Vector
.short RESET
;-------------------------------------------------------------------------------

18
Directed by Leonel Gamvou Taklai
; MSP430 Assembler Code Template for use with TI Code Composer Studio
;-------------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
; Main loop here
init:
bis.b #0FCh, &P1DIR ; set p1:7-3 as output
bis.b #BIT0, &P3DIR ; set p3.0 as output
bic.b #LOCKLPM5, &PM5CTL0 ; get out of the default low_power mode
;test segments of a common anode seven segments display
main:
bic.b #BIT2, &P1OUT ; write a zero to P1.2 to activate segment a
call #delay ; wait for some time
bic.b #BIT3, &P1OUT ; write a zero to p1.3 to activate segment b
call #delay
bic.b #BIT4, &P1OUT
call #delay
bic.b #BIT5, &P1OUT
call #delay
bic.b #BIT6, &P1OUT
call #delay
bic.b #BIT7,&P1OUT
call #delay
bic.b #BIT0, &P3OUT ;
bic.b #BIT2, &P1OUT
call #delay
bis.b #BIT2,&P1OUT
call #delay
bis.b #BIT3, &P1OUT
call #delay
bis.b #BIT4, &P1OUT
call #delay
bis.b #BIT5, &P1OUT

19
Directed by Leonel Gamvou Taklai
call #delay
bis.b #BIT6, &P1OUT
call #delay
bis.b #BIT7, &P1OUT
call #delay
bis.b #BIT0, &P3OUT ;
bic.b #BIT2, &P1OUT
call #delay
zero: ;0
bic.b #BIT2, &P1OUT ; activate p.2
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bic.b #BIT6, &P1OUT
bic.b #BIT7, &P1OUT
bis.b #BIT0, &P3OUT ; deactivage p3.0
call #delay
;1
bis.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bis.b #BIT5, &P1OUT
bis.b #BIT6, &P1OUT
bis.b #BIT7, &P1OUT
bis.b #BIT0, &P3OUT
call #delay
;2
bic.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bis.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bic.b #BIT6, &P1OUT
bis.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT
call #delay
;3
bic.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bis.b #BIT6, &P1OUT
bis.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT

20
Directed by Leonel Gamvou Taklai
call #delay
;4
bis.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bis.b #BIT5, &P1OUT
bis.b #BIT6, &P1OUT
bic.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT
call #delay
;5
bic.b #BIT2, &P1OUT
bis.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bis.b #BIT6, &P1OUT
bic.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT
call #delay
;6
bic.b #BIT2, &P1OUT
bis.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bic.b #BIT6, &P1OUT
bic.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT
call #delay
;7
bic.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bis.b #BIT5, &P1OUT
bis.b #BIT6, &P1OUT
bis.b #BIT7, &P1OUT
bis.b #BIT0, &P3OUT
call #delay
;8
bic.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bic.b #BIT6, &P1OUT

21
Directed by Leonel Gamvou Taklai
bic.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT
call #delay
;9
bic.b #BIT2, &P1OUT
bic.b #BIT3, &P1OUT
bic.b #BIT4, &P1OUT
bic.b #BIT5, &P1OUT
bis.b #BIT6, &P1OUT
bic.b #BIT7, &P1OUT
bic.b #BIT0, &P3OUT
call #delay
jmp zero
;---------------------------------------------------------------------------
;delay subroutine
delay:
mov.w #0002h, r4
l1:
mov.w #0FFFFh, r5
l2:
dec.w r5
jnz l2
dec r4
jnz l1
ret
;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET

22
Directed by Leonel Gamvou Taklai
References
Smith, John. "Microcontroller Interfacing: LEDs and Seven-Segment Display." EECE 101,
University of California, Los Angeles, CA, 25 June 2023.
Jiménez, M., Palomera, R., & Noguera, I. (2014). Introduction to Embedded Systems
Using Microcontrollers and the MSP430. Springer-Verlag New York.
Texas Instruments. (n.d.). Texas Instruments: Semiconductor & Storage Solutions.
Retrieved from https://www.ti.com/
Texas Instruments. (n.d.). Code Composer Studio Integrated Development Environment
(IDE) - CCStudio. Retrieved from https://www.ti.com/tool/CCSTUDIO
Multicomp. (n.d.). Multicomp by Farnell | Electronic Components Distributor. Retrieved
from https://www.multicomp.co.uk/

23
Directed by Leonel Gamvou Taklai

You might also like