Ec6711 Embedded Lab Manual

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

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

ENGINEERING

LAB MANUAL
EC6711EMBEDDED LABORATORY
SEMESTER VII /YEAR-IV
(R-2013)

PREPARED BY VERIFIED BY APPROVED BY


Mr S. LOKESH AP/ECE
Mr. R. SRINATH, AP/ECE
VISION OF THE INSTITUTE
To Develop Globally Competitive Human Resource through Virtuous Enlightened Learning.

MISSION OF THE INSTITUTE


M1: To Impart Quality Technical Education and Research Orientation Enabling the Technocrats to
Fair Well in Global Competition.
M2: To Inculcate Committed Leadership Qualities through Ethical Practices.
M3: To Acquire Skills through Industry Practices and Develop the habit of life- long learning.

VISION OF THE DEPARTMENT


To Produce Competent and Responsible Engineers to meet the growing Challenges in the field of
Electronics and Communication Engineering

MISSION OF THE DEPARTMENT


M1: To impart strong technical competency to learners by using best pedagogical methods
M2: To provide industrial exposure to learners by collaboration with industries for training,
internships, and expert talks.
M3: To imbibe self- learning, collaborative learning, Ethical values and Environment awareness
through Co- curricular and Extra-curricular activities.

PROGRAMME EDUCATIONAL OBJECTIVES (PEO’s)


PEO1: Adapt to dynamically evolving technologies for a successful career in an
academia/Industry/Entrepreneur
PEO 2: Apply the knowledge of Electronics and communication Engineering to solve real world
problems.
PEO 3: Exhibit effective communication skills and can perform as a team player with leadership
traits.

2
PROGRAM OUTCOMES (PO’s)
Engineering Graduates will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specia lization to the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences,
and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
4. Conduct investigations of complex proble ms: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
7. Environme nt and sustainability: Understand the impact of the professional engineering solutions
in societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.

3
11. Project manage ment and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one‟s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.

PROGRAMME SPECIFIC OUTCOMES (PSO’s)

PSO 1: Develop Innovative Ideas for an existing / Novel problem through Information and
Communication technologies.

PSO 2: Apply the Analog and Digital system Design Principles and practices for Developing Quality
products.

4
EC6711 EMBEDDED LABOR ATORY L TP C
0032
OBJECTIVES:
The student s hould be made to:
 Learn the working of ARM processor
 Understand the Building Blocks of Embedded Systems
 Learn the concept of memory map and memory interface
 Know the characteristics of Real Time Systems
 Write programs to interface memory, I/Os with processor
 Study the interrupt performance

LIST OF EXPERIMENTS
1. Study of ARM evaluation system

2. Interfacing ADC and DAC.


3. Interfacing LED and PWM.
4. Interfacing real time clock and serial port.
5. Interfacing keyboard and LCD.
6. Interfacing EPROM and interrupt.
7. Mailbox.
8. Interrupt performance characteristics ofARM and FPGA.
9. Flashing of LEDs.
10. Interfacing stepper motor and temperature sensor.
11. Implementing zigbee protocol with ARM.

5
OUTCOMES:
At the end of the course, the student should be able to:
 Write programs in ARM for a specific Application.
 Interface memory and Write programs related to memory operations.
 Interface A/D and D/A convertors with ARM system.
 Analyze the performance of interrupt.
 Write programs for interfacing keyboard, display, motor and sensor.
 Formulate a mini project using embedded system.

6
COURSE OUTCOMES

COURSE COURSE
EC6711 Embedded Laboratory SEM 7
CODE NAME
On completion of the course, the students will be able to

CO1 Execute programs in ARM for a specific Application.


CO2 Interface memory, A/D and D/A convertors using ARM Processor.
CO3 Evaluate the interrupt functions in ARM Processor.
CO4 Demonstrate keyboard, display, motor and sensor interfacing using ARM.
CO5 Formulate a mini project using embedded system.

CO’S – PO’S & PSO’S MAPPING

CO/P PO PO PO PO PO PO PO PO PO PO1 PO1 PO1 PSO PSO


O 1 2 3 4 5 6 7 8 9 0 1 2 1 2
CO1 3 3 3 2 1 2 2 1 3 3
CO2 3 3 3 2 1 2 2 1 3 3
CO3 3 3 3 2 1 2 2 1 3 3
CO4 3 3 3 1 1 2 2 1 3 3
CO5 3 3 3 1 1 2 2 1 3 3

7
8
TABLE OF CONTENTS

S. No PARTICULARS PAGE
No
I INTRODUCTION - KEIL µVISION5 08

Ii INTRODUCTION - FLASH MAGIC 15

CYCLE – I EXPERIMENTS

1 Study of ARM Evaluation Systems 17

2 Interfacing of ADC and DAC 21

3 Interfacing of LED and PWM 24

4 Interfacing Real time Clock and Serial Port 27

5 Interfacing keyboard and LCD 30

6 Interfacing EPROM and interrupt 33

CYCLE – II EXPERIMENTS
7 Implementation of Mailbox Functions 37

8 Interrupt performance characteristics of ARM and FPGA. 40

9 Flashing of LEDs 43

10 Interfacing of stepper motor 47

11 Interfacing of LM35 Temperature Sensor 50

12 Implementing zigbee protocol with ARM 53

CONTENT BEYOND THE SYLLABUS


1 Interfacing Bluetooth module 57

2 Interfacing GSM module 60

3 Interfacing GPS module 64

9
INTRODUCTION - KEIL µVISION5
About “Project”:
What is a project?
A project is a file in which Keil uVision5 stores all information related to an
application. E.g. it storesthe name of „C‟ and/or Assembler source file, memory size to
be used and other options for compiler,assembler and linker.
Opening a project:
To open an existing project file, select Project / Open Project from the menu.
Creating a new project:
To create a new project, select Project / New µVision Project from the menu.
Closing project settings:
To close the project, select Project / Close Project from the menu.
Quick starts to create ‘C’ language applications:
1. Start the KeilµVision5 program (i.e. the Integrated Development Environment)
fromstart\Programs\KeilµVision5.
2. From Project menu, select Close project (if any project is open).
3. From Project menu, select New Project. The Open dialog window will be displayed.
Select thedesired path where you wish to create this new project. (For example, C:\SPJ).
CAUTION: Thepath and filename must not contain space or other special characters such
as tab, comma, semicolon, etc. In the “File name” field, type the name of the project,
without any extension. For example, youmay type “PROG1”. Then click on the “Open”
button.
4. The action in the previous step will display the “Select device for Target „Target 1‟ ”
dialogwindow. Here you have to select the micro-controller you are going to use. The
target microcontroller(must be a member of ARM family) is known, You have to load
“Legacy DeviceDatabase (RTE)” and then select the device you may select the
appropriate Manufacturer from thelist; and then select the appropriate micro -controller

8
from the device list. If the target microcontrolleris not known or if you cannot find it in the
list, then you may simply search “LPC2148”or select “NXP” as the manufacturer and
“LPC2148” as the micro-controller.
5. Then a dialog box will appear asking for adding Startup.s file in to the project. Click
on the “Yes” toit.
6. Click on “Source Group 1” to display that part of the dialog window. This window
will indicatethat IDE has automatically added 1 files in this new project: STARTUP.S The
STARTUP.s file isautomatically created by the IDE and is required for all C projects. Now
add the file select “File /New” then a dialog box will appear, give name to your file with
extension ( E.g. PROG1.c ) Thenadd files in this project, then right click on the “Source
Group 1” Folder,click on “Add existingFiles to Group „Source Group1‟ ” select the desired
filename and then click on “Add” button. Now the Project Settings dialog will indicate
that selected file has been added into the project. When
all necessary files have been added to the project, click “OK” button to create this new
project.
7. Now create the “Target” for the completion of the project, right c lick on the “Target 1”
folder in theproject explorer window. then click on “options for Target „Target 1‟ ”
,Then a dialog appearshaving 10 parts first is Device and last Utilities. Now select Output
and Checked the options“Create Hex File”. then go to “Linker” and check the option “Use
memory layout from targetdialog.”
8. From the Target menu, select Build. This will invoke the Compiler to compile the file
PROG1.C;and further (assuming no errors) invoke the linker to create the .HEX file. If
there are any errors orwarnings during the process of compiling, assembling or linking,
then those will be displayed in theoutput window (below the editor window). If there
are errors, then you may correct those by makingappropriate changes to the program;
select Save from File menu to save the changes and then againselect Build from Compile
menu. Repeat this until there are no errors.

9
9. You may inspect contents of the folder where your project files reside. When there are
no errors andbuild has completed successfully and then you will see a file name with
same name as the projectname and extension .HEX (in above example, PROG1.HEX).
This is the file that you will need touse to program your micro - controller.

10
11
12
8. Write the code in the editor window and save as shown below:

13
11. The hex file will be created in the specified folder” i.e. Blink” process such as
shown in the output window.
12. hex file will be created successfully in the destination folder.

14
INTRODUCTION - FLASH MAGIC

15
16
Exp.: 01 STUDY OFARM EVALUATION SYSTEM

Aim: To study of ARM process or system and describe the features of architecture.
ARCHITECTURE OF ARM PROCESSOR :
12.1. Features of ARM DEVELOPMENT KIT Processor:
 16-bit/32-bit ARM 7 TDMI-S microcontroller in a tiny LQFP64 package. 8Kb to 40kB of
on-chip static RAM and 32kB to 512kB of on-chip flash memory. 128- bit wide
interface/accelerator enables high-speed 60 MHz operation. In- System/In-Application
Programming (ISP/IAP) via on-chip boot loader software.
 Single flash sector/full chip erase in 400ms and programming of 256 bytes in1 ms.USB2.0
Full-speed compliant device controller with 2kB of end point RAM. The LPC2146/48
provides 8kB of on-chip RAM accessible to USB by DMA.
 One or two (LPC2141/42vs.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 capture and four compare channels each), PWM unit (six outputs) and
watchdog.
 Low power Real- Time Clock (RTC) with independent power and 32kHz clock input.
Multiple serial interfaces including two UARTs (16C550), two Fast I2C- bus (400kbit/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 5V tolerant fast general purpose I/O pins in a tiny LQ FP64 package. Upto 21
external interrupt pins available.
• 60MHz 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 1MHz
to25MHz. Power saving modes includes 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
interruptor BOD. Single power supply chip with POR and BOD circuits: CPU operating
voltage range of 3.0V to3.6V (3.3V±10%) with 5V tolerant I/O pads.

17
12.2. GeneralBlockDiagram:

1.2. Powe r Supply:


The external power can be AC or DC, with a voltage between (9V/12V, 1A
output) at 230V AC input. The ARM board produces +5V using an LM7805
voltage regulator, which provides supply to the peripherals.
LM1117 Fixed +3.3V positive regulator used for processor & processor related
peripherals.

1.4. Flash Programming Utility


NXP (Philips)
 N XP Semiconductors produce a range of Microcontrollers that feature
both on- chip
 Flash me mory and the abilit y to be reprogrammed using I n- System
Programming technology.

18
1.5. PinConfiguration:

1.6. On-boardPe riphe rals:


• 8-Nos. of Point LED‟s (Digita l Outputs)
• 8-Nos. of Digita l Inputs (slide switch)
• 2 LinesX16 Character LCD Display
• I2C Enabled 4 Digit Seven-segment displa y
• 128x64 Graphical LCD Displa y
• 4X4 Matrix keypa d
• Stepper Motor Interface
• 2 Nos. Relay Interface

• Two UART for serial port communication through PC


• Serial EEPROM
• On-chip Real Time Clock with battery backup

• PS/2 Keyboard interface (Optiona l)


• Temperature Sensor
• Buzzer (Alarm Interface)

• Traffic Light Module (Optiona l)

RESULT:

Thus the study of ARM processor has been done and ensured its composition with internal features
specifica lly.

19
Viva-voce

1) What are the basic units of ARM 7?


2) What is the address system supported by ARM?
3) Define RISK.
4) What are the instructions used to access the memory in ARM?
5) How are the instructions encoded in ARM machines?
6) What are the basic units of Microprocessor?
7) What is an Instruction?
8) What is clock cycle?
9) Define- RTOS
10) Define- Pipelining
11) What is cache bus?
12) What is cache miss?
13) What is meant by memory mapped I/O?
14) Define–interrupt
15) What is the function of device driver?
16) What is meant by Exception?
17) What is meant by little–endian mode?
18) What is meant by big–endian mode?
19) What is the function of CPSR?
20) What is register- indirect addressing?

20
Exp.: 02 INTERFACING OF ADC AND DAC
AIM:
To develop and verify the interfacing ADC and DAC with LPC 2148 ARM
microcontroller.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

21
Step 12: By giving a name with extension .c and save it.

Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

InterfacingADC:
Connections:
To give analog input from Potentiometer R15 present in Analog Input region on
ADTV1.1. Analog input range is from 0 to 1023.

22
Interfacing DAC:
Conne ctions:
Connect one pin of oscilloscope to TP2/DAC and another to GND.

VIVA-VOCE
1. What are the ADC operating modes in LPC2148?
2. What is meant by conversion time?
3. Why are internal ADCspreferred over external ADCs?
4. Why 16-bit ADC has more resolution than from 10-bit and 8-bit ADC?
5. What are ADC & its Resolution?
6. What is ADC operating frequency range?
7. What is Burst conversion mode?
8. What is the function of A/D Control Register?
9. What is the function of A/D Global Data Register?
10. What is the function of A/D Status Register?
11. What is analog-to-digital (ADC) conversion error?
12. What is the function of Sample-and-hold circuits in analog-to digital converters?
13. What is meant by flash analog-to-digital converter?
14. What is the disadvantage of the flash analog-to digital converter?
15. What is the data rate available for use on USB?

RESULT:

Thus the interfacing of ADC and DAC (In-built) with ARM processor has been
verified and observed the output successfully.

23
Exp.: 03 INTERFACING LED AND PWM

AIM:
To develop and verify the interfac ing LED and PWM with ARM DEVELOPMENT
KIT microcontroller using embedded C program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision5 icon on the desk top, it will
generate a window as shown below.

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

24
Step 12: By giving a name with extension .c and save it.

Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Connections:
Keep S4.3 switch in ON position.

RESULT:

Thus the interfacing of LED AND PWM (In-built) with ARM processor has been
verified and observed the output successfully.

25
VIVA-VOCE

1. What factors determine the LED dimming performance?


2. What is meant by analog dimming?
3. What is flickering effect?
4. What is the factor determines dimming of the LED?
5. Why Silicon is not suitable for fabrication of light-emitting diodes?
6. Why Silicon diode is less suited for low voltage rectifier operation?
7. What is the principle of zener diode?
8. What are the materials used to make LED?
9. What type of diodes is used in FM receivers?
10. Which diode suffers an avalanche breakdown?
11. What happens if the junction temperature of LED is increased?
12. How a transfer characteristic of a diode does is related?
13. What is the requirement of a clipping action of a diode?
14. What type of rectifier circuit requires four diodes?
15. Why are the pulse width modulated outputs required in most of the applications?
16. How do the variations in an average value get affected by PWM period?
17. Name the common formats availab le for LED display.
18. What are the types of seven segment display?
19. What is PWM?
20. What are the applications of PWM?

26
Exp.: 04 INTERFACING REAL TIME CLOCK AND SERIAL PORT

AIM: To develop and verify the interfacing Real Time Clock and Serial Port with ARM
DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1


2 Keil µVision5 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

Step 12: By giving a name with extension .c and save it.

27
Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Interfacing Real Time Clock on Serial UART:


Co nnectio ns:
No switches are there to turn ON/OFF I2C RTC:

RESULT:

Thus the Real time Clock on serial UART interfacing with ARM processor has been
verified and observed the output successfully.
28
VIVA-VOCE
1) What is I2Cand how does it work?
2) What are the features of I2Cin LPC2148 ARM7 microcontroller?
3) What is the function of I2C0CONSET register?
4) What is I2C0STAT?
5) What is the function of I2C0 Data Register?
6) What is RTC?
7) List the advantages of RTC
8) Through which port the date and time is displayed in RTC?
9) What is a serial port?
10) List the registers used to transfer data in serial port.
11) List the modes used for data transmission.
12) What is a simplex mode?
13) Which pin is used to transmit a character?
14) What is the baud rate of serial port?
15) What is the disadvantage of RS-232C?

29
Exp.: 05 INTERFACING KEYBOARD AND LCD
Aim:
To develop and verify the interfacing of Keyboard and LCD with ARM
DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1


2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

Step 12: By giving a name with extension .c and save it.

30
Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and click
on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Conne ctions:
16 Keys (SW2 to SW17) present in 4x4 Matrix Keypad region on ADT are connected to
P0.16 to P0.23.

RESULT:

Thus the interfacing of keyboard and LCD with ARM processor has been verified and
observed the output successfully.

31
VIVA-VOCE

1. What is Matrix keypad?


2. What is the concept behind key pad interface?
3. What are the functions of pull- up resistors?
4. What is key debouncing?
5. List the steps involved when the key in a 4x4keyboard matrix is being pressed.
6. What is the value obtained if no key is pressed?
7. What kind of interrupt is generated if a key has to be operated in an interrupt mode?
8. How will you identify that the key is pressed?
9. What are the steps involved in Keyboard Interfacing?
10. List the registers used to store the keyboard, display modes and other operations programmed
by CPU.
11. Name the mode of operation for debounce logic.
12. Name the mode when a data is entered from the left side of the display unit.
13. How many rows and columns are present in a 16x2 alphanumeric LCD?
14. How many data lines are there in a 16x2 alphanumeric LCD?
15. Which pin of the LCD is used for adjusting its contrast?
16. Which command of an LCD is used to shift the entire display to the right?
17. Which command is used to select the 2 lines and 5x7 matrix of an LCD?
18. What changes are to be made to send data to an LCD?
19. For reading operation from a LCD what changes in the software are introduced?
20. Which instruction is used to select the first row first column of a LCD?

32
Exp.: 06 INTERFACING EPROM AND INTERRUPT
AIM:
To develop and verify the interfacing EPROM and Interrupt with ARM
DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1


2 Keil µVision5 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

Step 12: By giving a name with extension .c and save it.

33
Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and click
on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

EPROM Interface:
Connections: Output:

No switches are there to turn ON/OFF I2C EPROM:

34
Interrupt Interface:

Connections:
To connect SW19.2 switch to EINT1 of LPC2148, keep it in ON position.

Output:
EINT1 is configured as Low-active, Level Sensitive. Therefore if SW18 switch is
pressed then D11 LED will glow for that much of time only.

Note: Keep SW19.2 switch in OFF position, after execution of program.

RESULT:

Thus the interfacing EPROM and Interrupt with ARM processor has been verified and
observed the output successfully.

35
VIVA-VOCE

1) How does I2C protocol work?


2) What is EEPROM?
3) What is meant by master slave mode?
4) Whatis meant bynon-volatilememory?
5) What is an interrupt?
6) How does an interrupt request works?
7) What is a nested interrupt?
8) What are the registers used for enabling an interrupt?
9) What is PROM?
10) What is EPROM?
11) What is mask ROM?
12) Which memory allows simultaneous read and write operations?
13) Which memory has the shortest access times?
14) Which interrupt has the highest priority?
15) What is non maskable interrupt?
16) Which is the first level of memory access by the microprocessor?
17) List the types of cache memories.
18) What is the use of an interrupt?
19) What is the use of converting an interrupt to threads in a microprocessor?
20) What are the bits used to control an external interrupts?

36
Exp.: 07 IMPLEMENTATION OF MAILBOX FUNCTIONS

AIM:To develop and verify the Implementation of Mailbox Functionswith ARM


DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

Step 12: By giving a name with extension .c and save it.


37
Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

BLOCK DIAGRAM:

RESULT:
Thus the interfacing of keyboard and LCD with ARM processor has been verified and
observed the output successfully.

38
VIVA-VOCE

1) What is IPC?
2) Define Queue.
3) What are the different types of mail box functions?
4) What is half duplex mode?
5) How many synchronous and asynchronous modes are there in serial port?
6) List the bits used to generate serial port interrupt
7) What is branch prediction?
8) Mention any two features of µC/OS –II.
9) Write the function for creating task in µC/OS–II.
10) Mention any two support devices for µC/OS–II.
11) How many user tasks can be handled by µC/OS–II?

39
Exp.: 08 INTERRUP T P ERFORMANCE CHARACTERISTICS OF ARM AND FPGA

AIM:To develop and verify the Interrupt Performance Characteristics of ARM with
FPGA with ARM DEVELOPMENT KIT microcontroller using embedded C program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1


2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

40
Step 12: By giving a name with extension .c and save it.

Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

RESULT:
Thus the interrupt performance characteristics of ARM and FPGA are studied. On
comparison, ARM counts at slow speed because it consumes more instruction cycle and
FPGA is more efficient for servicingand processing external interrupt pulses.

41
VIVA-VOCE

1. When is an Interrupt Request received?


2. What is ISR?
3. How do you initialize interrupt?
4. What is Vectored Interrupt Controller?
5. What are the kinds of protection available for SRAMS?
6. What is interrupt pipelining?
7. What is pipeline shutdown?
8. What is branch prediction?
9. What is the use of Neon Floating point engine?
10. What is the use of –vectorize option?
11. What is PTM?
12. What is ITM?
13. What is ETM?
14. What is I2S interface?
15. What is the use of “SWI‟ in ARM assembly?

42
Exp.: 09 FLASHING OF LEDs

AIM:To develop and verify the Flashing of LEDs with ARM DEVELOPMENT KIT
microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

43
Step 12: By giving a name with extension .c and save it.

Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Connections:

Keep SW19.2 switch in ON position.


8 LEDs (D11 to D18) present on ADT are connected toP1.16, P1.17, P1.8, P1.19,
P1.20, P1.21, P1.22 and P1.23 respectively by Common Anode method.

44
RESULT:
Thus the Flashing of LEDs with ARM processor has been verified and observed the
output successfully.

45
VIVA-VOCE

1. What is seven segment displays?


2. What are the different configurations of LED?
3. What is the function of GPIO?
4. What are the Pins which are used to connect LEDs?
5. How to identify 'Polarity' of LED?
6. Differentiate LED from LCD.
7. What is a use of Jumper?
8. How many numbers of LEDs present in Primer board?
9. Where LEDs are used?
10. What is the use of flash magic software?
11. Which port is used in ARM7 processor kit?
12. Which diode suffers an avalanche breakdown?
13. What happens if the junction temperature of LED is increased?
14. What is an anti collision rate light?
15. What is a fail-safe condition?

46
Exp.: 10 INTERFACING OF STEPPER MOTOR

AIM:To develop and verify the Interfacing of Stepper Motor with ARM
DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

Step 12: By giving a name with extension .c and save it.


47
Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Connections:
No Switches are there to Stepper Motor is connected to P0.28, P0.29, P0.30 and P0.31
through LEDs D7 to D10.
Connect the Stepper motor at connector X3.

48
VIVA-VOCE

1) Define GPIO.
2) What is the function of ULN2803?
3) How LPC2148 control stepper motor?
4) Which I/O port lines used to rotate stepper motor?
5) How stepper motor reacts for each pulse it receives?
6) What is serial communication?
7) What is parallel communication?
8) What is stepper motor & why it is named so?
9) How can be step angle is calculated?
10) What are the advantages and disadvantages of parallel communication?
11) What does instruction-pipelining mean?
12) What is the power supply required for ARM processor?
13) What is a unit for torque?
14) What is RPM rating for a DC motor?
15) What device that is used to obtain an accurate position control of rotating shafts in
terms of steps?

RESULT:
Thus the Interfacing of Stepper Motor with ARM processor has been verified and
observed the output successfully.

49
Exp.: 11 INTERFACING OF LM35 TEMPERATURE SENSOR

AIM:To develop and verify the Interfacing of Temperature Sensor (LM35) with ARM
DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.

Step 12: By giving a name with extension .c and save it.


50
Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project wind ow and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Connections:
TointerfaceLM35(presentinAna logInputregiononADTBoard)withP0.5

51
VIVA-VOCE

1) What is LM35?
2) Define ISP.
3) How many Analog-to-Digital Converters available as an inner peripheral in
LPC2148?
4) What is the main function of analog pin in LPC2148?
5) What is the output voltage produced by LM35for one degree temperature?
6) What is the difference between LM34 and LM35 sensors?
7) How many pins are available in LM35?
8) Why Vref is set of ADC 0848 to 2.56 V if analog input is connected to the LM35?
9) What is signal conditioning?
10) What is operating the operating temperature range inLM35?
11) Why LM35 is used to Measure Temperature?
12) What Does an LM35 Do?
13) List the devices used to sense temperature.
14) What is the purpose of a thermocouple?
15) What is the output voltage of a thermocouple?

RESULT:
Thus the Interfacing of Temperature Sensor (LM35) with ARM processor has been
verified and observed the output successfully.

52
Exp.: 12 IMPLEMENTING ZIGBEE PROTOCOL WITH ARM

AIM:To develop and verify the Implementation of Zigbee Protocol with ARM
DEVELOPMENT KIT microcontroller using embedded c program.

APPARATUS REQUIRED:
S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision5 IDE - 1

PROCEDURE:
Step 1: Give a double click on µvision 5 icon on the desk top, it will
generate a window as shown below

Step 2: To create new project go to project select new micro vision project.

Step 3: select a drive where you would like to create your project.

Step 4: Create a new folder and name it with your project name.

Step 5: Open that project folder and give a name of your project executable and
save it.

Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips

Step 7: Select your chip as ARM DEVELOPMENT KIT

Step 8: After selecting chip click on OK then it will display some window
asking to add STARTUP. Select YES.

Step 9: A target is created and startup is added to your project target.

Step 10: To write your project code select a new from menu bar.

Step 11: It will display some text editor, to save that select SAVE
option from menu bar.
53
Step 12: By giving a name with extension .c and save it.

Step 13: Write the code of your project and save it.

Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.

Step 15: It will display some window there select the file and
click on ADD option.

Step 16: It will be added to our target and it shows in the project
window.

Step 17: Select right click on target in the project window and select
“Options for Target.”

Step 18: It will show some window, in that go to output option and choose
Create Hex option by selecting that box.

Step 20: Now to compile your project go to Project select Build Target
option or press F7.

Step 21: Check the concern block of output and observe the results.

Connections:
Mount Xigbee on Xigbee socket/U3 .Switch ON S4.1 and S4.2(for UART1) Cxx
Indicates Co-OrdinatorXigbee.

Rxx Indicates Router Xigbee.

You should use two different xigbees(Rxx and Cxx)(Ex. R1 and C1) on two different
ADT boards.

54
VIVA-VOCE

How many UART ports available in LPC2148?


What is the main function of voltage convertors in UART?
Why Zigbee based is preferred for wireless communication?
What is the IEEE standard for Zigbee protocol?
Write the two modes of communication are used in a Zigbee network.
What is the function of a scheduler?
7. Mention any two features of µC/OS–II.
8. Write the function for creating task in µC/OS–II.
9. Mention any two support devices for µC/OS–II.
10. How many user tasks can be handled by µC/OS–II?

RESULT:
Thus the Implementation of Zigbee Protocol with ARM processor has been verified
and observed the output successfully.

55
CONTENT BEYOND THE

56
Exp.: 01 INTERFACING BLUETOOTH MODULE

AIM : To write an embedded C code for interfacing Bluetooth Module with ARM
CORTEX M3- LPC 2148.
CIRCUIT DIAGRAM:

PROCEDURE:
Give +3.3V power supply to LPC 2148 Primer Board; connect the 5V adapter
with Bluetooth module which is connected wit h the LPC 2148 Primer Board. There
are two Bluetooth modules are required. One is connected with LPC 2148 Primer
Board; other one is connect ed with PC. First connect the serial cable between LPC
2148 Primer board & PC. Then open t he Hyper Terminal screen, select which port
you are using and set the default sett ings. Now the screen should show some text
messages. If the messages are correctly displayed in Hyper Terminal, then only
connect the Bluetooth modules in LPC 2148 Primer Board UART0 & PC. If you
are no treading any data from UART0, then
57
you just check the jumper connections & just check the serial cable is working.
Otherwise you just check the code with debugging mode in Keil.
PROGRAM:
#defineCR0x0D
#include< LPC21xx.H>void
init_serial(vo id);
intputchar(intch);
intgetchar( void);
unsignedchar test;
intmain( vo id)
{
char*Ptr="***UART0Demo***\n\n\rType Characters to be echoed!!
\n\n\r"; VPBDIV=0x02;//Divide Pc lk by two
init_ser ial();
while(1)
{
while(*Ptr){putchar( *Ptr++);
}putchar(getchar()); //Echoterminal
}
}
voidinit_serial(vo id)
{
PINSEL0=0x00000005;//Enab leRxD0andTxD0
U0LCR=0x00000083;//8bits,noParity,1Stopbit
U0DLL=0x000000C3;//9600BaudRate@30MHzVPBClock
U0LCR=0x00000003;
}
intputchar(intch)
58
{
if(ch=='\n')
{
while(!(U0LSR&0x20));
U0THR=CR;
}
while(!(U0LSR&0x20));
return(U0THR=ch);
}
intgetchar( void)
{
while(!(U0LSR&0x01));
return( U0RBR);
}

RESULT:
Thus, interfacing of GSM module with ARM CORTEX M3-LPC 2148 using embedded
C code was executed and verified successfully.

59
Exp.: 02 INTERFACING GSM MODULE

AIM : To write an embedded C code for interfacing GSM Module with ARM
CORTEX M3- LPC 2148.
CIRCUIT DIAGRAM:

Procedure:
Give +3.3V power supply to LPC 2148 Primer Board; connect the +5V adapter
with GSM module which is connected with LPC 2148 Primer Board through UART0.
Open the Hyper Terminal screen, select which port you are using and set the default
settings. Now the screen should show some text messages.
The following Commands and sequence of events performed for sending text
message to a mobile phone through GSM Modem interfaced with microcontroller:
 First select t he text mode for SMS by sending the follo wing AT Command
to GSM Modem : AT+CMGF = 1 . This command configures the GSM
modem in t ext mode.
 Send the following AT Command for sending SMS message in t ext mode
along with mobile number to the GSM Modem : AT+CMGS
60
=+923005281046 . This command sends the mobile number of the
recipient mobile to the GSM modem.
 Send the text message string ("hello!") to the GSM Modem This is a
test message from UART".
 Send ASCII code for CTRL+Z i.e., 0x1A to GSM Modem to transmit the
message to mobile phone. After message string has been sent to the
modem, send CTRL+Z to the micro-controller, which is equivalent to
0x1A (ASCII value).
If you not reading any text from UART0, then you just check the jumper
connections & just check the serial cable is working. O therwise you just check the
code with debugging mode in Keil. If you want to see more details about debugging
just see the videos in below link.
Program:
#define CR 0x0D
#include < LPC21xx.H>
#include <stdio.h>
void getstring( unsigned char *);
int getchar (void) /* Read character from Serial Port */
void stat us_ok(void);
void Ser ial_Init( void);
void delay( unsigned int n);
void main( void)
{
unsigned int cnt=0x80,m;
char xx; Serial_Init ();
delay( 50);
while(1)
{
printf("AT\r"); // AT COMMAND FOR INITIALING status_ok();
printf("AT+IPR=9600\r"); // AT COMMAND FOR BAUD RATE
status_ok(); printf("AT+CMGR=2\r"); // Reading the message detail
// at Index 1 with phone number, data and time status_ok();

61
delay(250); printf("ATD9790550124; \r");// AT COMMAND FOR
CALL DIALING delay( 250); stat us_ok();
delay( 500);
delay( 500);
delay( 500);
delay( 500);
delay( 500);
delay( 500);
printf("ATH\r"); // AT COMMAND FOR CALL DISCONNECTING
delay( 250);
stat us_ok();
delay( 500);
delay( 500);
printf("ATDL\r"); // AT COMMAND FOR REDIALING delay(250);
status_ok();
delay( 500);
delay( 500);
printf("ATH\r"); // AT COMMAND FOR ANSWERING THE CALL
delay( 250);
stat us_ok();
delay( 500);
delay( 500);
}
}
void getstring( unsigned char *array)
{
unsigned char temp=0, i=0;
do { temp = getchar();
*array++ = temp;
}
while((temp != '\r') && (temp !=
'\n'));
*array = '\0';
}
int getchar (void) /* Read character from Serial Port */
{

62
while (!(U0LSR & 0x01));
return ( U0RBR);
}
void stat us_ok(void)
{ getstring( y);
while(!(strstr(y,"OK")))
getstring( y);
pointr = strstr( y,"OK");
lcd_cmd( 0xc0);
lcd_dat a(*po intr++);
lcd_data(*po intr);
delay( 500);
lcd_cmd( 0x01);
}
void Ser ial_Init( void)
{
PINSEL0 |= 0X00000005; // Enable Txd0 and Rxd0
U0LCR = 0x00000083; //8-bit data, no parity, 1-stop bit
U0DLL = 0x00000061; //for Baud rate=9600, DLL=82
U0LCR = 0x00000003; //DLAB = 0;
}
void delay( unsigned int n)
{
unsigned int i,j;
for(i= 0;i<n;i++)
{
for(j= 0;j<12000;j++)
{;
} }}

Result:
Thus, interfacing of GSM module with ARM CORTEX M3- LPC 2148 using
embedded C code was executed and verified successfully

63
Exp.: 03 INTERFACING GPS MODULE

AIM : To write an embedded C code for interfacing GPS Module with ARM CORTEX
M3- LPC 2148.
CIRCUIT DIAGRAM:

Give +3.3V power supply to LPC 2148 Primer Board; connect +5V adapter with
GPS module is connected with the LPC 2148 Primer Board. Open the Hyper
Terminal screen, select which port you are using and set the default settings. Now
the screen should show some text messages.

If you are no treading any data from UART0, then you just check the jumper
connections & just check the serial cab le is working. Otherwise you just check the
code with debugging mode in Keil. If you want to see more details about debugging
just see the videos in belo w link.

64
Program:

#defineCR0x0D
#include< LPC21xx.H>void
init_serial(vo id);
intputchar(intch);
intgetchar( void);
unsignedchartest;
intmain( void)
{
char*Ptr="***UART0Demo***\n\n\rTypeCharacterstobeechoed!!\n\n
\r"; VPBDIV=0x02;//DividePclkbytwoinit_serial();
while(1)
{
while(*Ptr)
{
putchar( *Ptr++);
}
putchar(getchar()); //Echoter minal
}
}
voidinit_serial( void)
{
PINSEL0=0x00000005;//Enab leRxD0andTxD0
U0LCR=0x00000083;//8bits,noParity,1Stopbit
U0DLL=0x000000C3;/ /9600BaudRate@30MHzVPBClock
U0LCR=0x00000003;
}
intputchar(intch)
{
if(ch=='\n')
{
while(!(U0LSR&0x20));
U0THR=CR;
}

65
while(!(U0LSR&0x20));
return(U0THR=ch);
}
intgetchar( void)
{
while(!(U0LSR&0x01));
return(U0RBR);
}

Result:

Thus, interfacing of GPS module with ARM CORTEXM3-LPC 2148 us ing


embedded C code was executed and verified successfully.

66

You might also like