Leonel Rapport LAB1
Leonel Rapport LAB1
Leonel Rapport LAB1
OF AGRICULTURE AND
INSTITUTE FOR BASIC
TECHNOLOGY
SCIENCES, TECHNOLOGY
AND INNOVATION(PAUISTI) (JKUAT)
l d
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.
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
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.
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 Ω
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 Ω
10
Directed by Leonel Gamvou Taklai
brightness level. The pinout and electrical specifications can be found in the datasheet
provided by the manufacturer.
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.
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.
12
Directed by Leonel Gamvou Taklai
Figure 8: Binary up-down count
13
Directed by Leonel Gamvou Taklai
Figure 9: 5161AS seven segment display
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
; 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