0% found this document useful (0 votes)
57 views

2023-24 Lab Manual EE2314 Embedded Systems PTK

Uploaded by

Rahul Kamdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

2023-24 Lab Manual EE2314 Embedded Systems PTK

Uploaded by

Rahul Kamdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Laboratory Manual

Academic Session 2023-24

B.Tech. Electronics Engineering (V sem)

Course Code:EE2314

Course Name: Embedded Systems Lab

Prepared by

Dr. P. T. Karule

Department of Electronics Engineering


Yeshwantrao Chavan College of Engineering
(An Autonomous Institution affiliated to Rashtrasant Tukadoji Maharaj Nagpur University)
Hingna Road, Wanadongri, Nagpur - 441 110
Introduction to ARM7
The LPC2141/42/44/46/48 microcontrollers are based on a 16-bit/32-
bit ARM7TDMI-S CPU with real-time emulation and embedded trace
support, that combine microcontroller with embedded high speed flash
memory ranging from 32 kB to 512 kB. A 128-bit wide memory interface
and unique accelerator architecture enable 32-bit code execution at the
maximum clock rate. For critical code size applications, the alternative 16-
bit Thumb mode reduces code by more than 30 % with minimal
performance penalty. Due to their tiny size and low power consumption,
LPC2141/42/44/46/48 are ideal for applications where miniaturization is a
key requirement, such as access control and point-of-sale. Serial
communications interfaces ranging from a USB 2.0 Full-speed device,
multiple UARTs, SPI, SSP to I2C-bus and on-chip SRAM of 8 kB up to 40
kB, make these devices very well suited for communication gateways and
protocol converters, soft modems, voice recognition and low end imaging,
providing both large buffer size and high processing power. Various 32-bit
timers, single or dual 10-bit ADC(s), 10-bit DAC, PWM channels and 45
fast GPIO lines with up to nine edge or level sensitive external interrupt pins
make these microcontrollers suitable for industrial control and medical
systems.

Features
 16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.
 8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of on-chip
flash memory.
 128-bit wide interface/accelerator enables high-speed 60 MHz operation.
 In-System Programming/In-Application Programming (ISP/IAP) via on-
chip boot loader software. Single flash sector or full chip erase in 400 ms
and programming of 256 bytes in 1 ms.
 Embedded ICE RT and Embedded Trace interfaces offer real-time
debugging with the on-chip Real Monitor software and high-speed
tracing of instruction execution. USB 2.0 Full-speed compliant device
controller with 2 kB of end point RAM. In addition, the LPC2146/48
provides 8 kB of on-chip RAM accessible to USB by DMA.
 One or two (LPC2141/42 vs. LPC2144/46/48) 10-bit ADCs provide a
total of 6/14 analog inputs, with conversion times as low as 2.44 μs per
channel.
 Single 10-bit DAC provides variable analog output (LPC2142/44/46/48
only).
 Two 32-bit timers/external event counters (with four captures and four
compare channels each), PWM unit (six outputs) and watchdog.
 Low power Real-Time Clock (RTC) with independent power and 32 kHz
clock input.
 Multiple serial interfaces including two UARTs (16C550), two Fast
I2C-bus (400 kbit/s), SPI and SSP with buffering and variable data length
capabilities.
 Vectored Interrupt Controller (VIC) with configurable priorities and vector
addresses.
 Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny
LQFP64 package.
 Up to 21 external interrupt pins available.
 60 MHz maximum CPU clock available from programmable on-chip PLL
with settling time of 100 μs.
 On-chip integrated oscillator operates with an external crystal from 1
MHz to 25 MHz.
 Power saving modes include Idle and Power-down.
 Individual enable/disable of peripheral functions as well as peripheral
clock scaling for additional power optimization.
 Processor wake-up from Power-down mode via external interrupt or BOD.
 Single power supply chip with POR and BOD circuits:
 CPU operating voltage range of 3.0 V to 3.6 V (3.3 V ± 10 %) with 5 V
tolerant I/O pads.

Architecture of ARM7 (LPC2148)


Pin Diagram
EE2314: PE-1- Embedded Systems Lab
B. Tech. (EE) V Sem Sec (A & B)
Experiment List (Academic Session 2023-24)
All programs to be compiled and executed using Keil uVision4 IDE
Course Outcome:
After completion of lab work student will be able to
 Write program in assembly and C language to complete the given task.
 Design Effective algorithm for specific experiment.
 Interface I/O devices with LPC2148 for a given specific application.
 Use modern tools like Keil uVision 4 IDE and Proteus SW for compilation and Simulation.
Getting started with ARM LPC2148 using Keil uVision IDE
 Install and setup the µVision IDE by Keil.

Using µVision IDE for

Assembly Language Program


For Experiment no. 1 to 6
We will create a simple project to add two nos. Following are steps which show how to create
and built project using the Keil uVision IDE:

1. Open Keil µVision from the icon created on your desktop.

2. Go to the Project tab. Select New µVision Project ...from that menu.
3. Create New Project window will pop up. Select the folder where you want to create
project and give a suitable name to the project. Then click on Save. (Exp3add)

4. Select Device for Target: ‘Target1’...window will pop up next. Select NXP then
LPC2148 and click on OK
5. A window will pop up asking whether to copy Startup.s to project folder and add file to
project. Click on No (for Assembly language programs).

6. The project name and its folders can be seen on the left side in the project window after
the previous step is completed as shown below.

7. Now go to File tab and add New file from the menu.
8. Write program in text window and save with extension .asm (e.g. exp3add.a)

9. To change font size: click on configuration


10. Select font size: click on OK

11. Right click on source group1 to add file exp3add.a


12. Select asm source file from folder >> exp3add.a >>click on add

13. File is added to source group (exp3add.a) Now compile >> Translate >> Build

14. To execute program: goto >> Debug >> start debug session >> Click OK (evaluation mode)
15. To view memory data : goto View >> memory window

15. To view memory data : Enter address 0x40000000 and data also
Using µVision IDE for

C Language Program
For Experiment no. 7 to 12
We will create a simple project to blink led. Following are steps which show how to create
and built project using the Keil uVision IDE:
1. Open Keil µVision from the icon created on your desktop.

2. Go to the Project tab. Select New µVision Project ...from that menu.

3. Create New Project window will pop up. Select the folder where you want to create
project and give a suitable name to the project. Then click on Save. (blinkled)
4. Select Device for Target: ‘Target1’...window will pop up next. Select NXP then
LPC2148 and click on OK

5. A window will pop up asking whether to copy Startup.s to project folder and add file to
project. Click on Yes (for C language programs).

6. The project name and its folders can be seen on the left side in the project window after
the previous step is completed.
7. Now go to File tab and add New file from the menu.
8. Write program in text window and save with extension .c (e.g. ledblink.c)
9. Right click on source group1 to add file ledblink.c

10. File is added to source group (ledblink.c) Now to build target hex file (compile)
Goto >> Project >>

11. Select output and give hex file name


12. Now compile >> Translate >> Build
13. To execute program: goto >> Debug >> start debug session >> Click OK (evaluation mode)
14. To view port data: click on peripheral >> GPIO >> Port 0

15. To execute click on Run

16. Check output of Port 0


Experiment No. 1 (a)
Problem:-Write program to perform addition of two 16 bit bit nos. and store result in R5

Software used:-KeilμVision4IDE

Hardware used: - Nil

Interfacing Circuit: - Nil

Purpose of registers and memory used for program:

R1and R2 are used to store operand 1 and operand 2


R5 is used to store result

Program with comments: -

AREA program, code, readonly


ENTRY
MOV R1, #0X3000 ;Get operand 1 value in R1
MOV R2, #0X1000 ;Get operand 2 value in R2
ADD R5, R1, R2 ; Perform addition R1 + R2 and store result in R5
L BL ; Stop
END

Data present in memory (Before execution of program): Not applicable

Memory Address Data

Data present in registers (Before execution of program):

Registers Data
R1 0x0000
R2 0x0000
R5 0x0000

Data present in memory (After execution of program): Not Applicable

Memory Address Data


Data present in registers (After execution of program):

Registers Data
R1 0x3000
R2 0x1000
R5 0x4000

Screen shot of Simulation Window:


Experiment No. 1 (b)
Problem:-Write program to perform subtraction of two 16 bit bit nos. and store result in R5

Software used:-KeilμVision4IDE

Hardware used: - Nil

Purpose of registers and memory used for program:

R1and R2 are used to store operand 1 and operand 2


R5 is used to store result

Program with comments: -

AREA program, code, readonly


ENTRY
MOV R1, #0X3000 ; Get operand 1 value in R1
MOV R2, #0X1000 ;Get operand 2 value in R2
SUB R5, R1, R2 ; Perform subtraction R1 - R2 and store result in R5
L BL ; Stop
END

Data present in memory (Before execution of program): Not applicable

Memory Address Data

Data present in registers (Before execution of program):

Registers Data
R1 0x0000
R2 0x0000
R5 0x0000

Data present in memory (After execution of program): Not Applicable

Memory Address Data


Data present in registers (After execution of program):

Registers Data
R1 0x3000
R2 0x1000
R5 0x2000

Screen shot of Simulation Window:


Experiment No. 3
Problem:-Write program to add two nos. x and y present in memory at address 4000000H and
40000004H and store in memory 40000008H

Software used:-KeilμVision4IDE

Hardware used: - Nil

Interfacing Circuit: - Nil

Purpose of registers and memory used for program:

R0 is used as memory pointer (40000000H)


R1and R2 are used to store operand 1 and operand 2
R3 is used to store result
Memory Location used 40000000H ..

Program with comments: -

AREA program, code, readonly


ENTRY
MOV R0, #0x40000000 ; R0 = 40000000H addr of operand 1
LDR R1, [R0], #4 ; Get operand 1 in R1 and R0=40000004H addr of operand 2
LDR R2, [R0], #4 ; Get operand 2 in R2 and R0=40000008H addr of result mem
ADD R3, R1, R2 ; Add R1 and R2 store result in R3
STR R3, [R0] ; Store result in memory 40000008H
L B L ; Stop
END

Data present in memory (Before execution of program):

Memory Address Data


40000000H X = 03
40000004H Y = 04
40000008H 0X00

Data present in registers (Before execution of program):

Registers Data
R0 0x0000
R1 0x0000
R2 0x0000
R3 0x0000

Data present in memory (After execution of program):

Memory Address Data


40000000H 0x03
40000004H 0x04
40000008H 0x07
Data present in registers (After execution of program):

Registers Data
R0 0x40000008
R1 0x03
R2 0x04
R3 0x07

Screen shot of Simulation Window:


Experiment No. 7
Problem:- Draw Interfacing of LED with LPC2148 and write program to blink LED connected to port
pin P0.7 of LPC2148

Software used:-KeilμVision4IDE

Hardware used: - LPC2148, LED

Interfacing Circuit: -

C language program with comments: -

/* P. T. KARULE */
/* Roll No. */
#include <lpc214x.h> //include header files for LPC-214x series
int j;
unsigned int
main ()
{
IO0DIR = (1<<7); //Configure the pin P0.10 as OUTPUT;
while(1) // While loop to execute program continueously
{
IO0SET = (1<<7) ; // Make the pin P0.10 HIGH (LED ON)
for(j=0;j<=100000;j++); // delay in sec
IO0CLR = (1<<7); // Make the pin P0.10 LOW (LED OFF)
for(j=0;j<=100000;j++); // delay in sec
}
}
Screen shot of Simulation Window:

You might also like