Embedded Lab Manual
Embedded Lab Manual
Embedded Lab Manual
DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING
LABORATORY MANUAL
Name : _______________________________________
Register No. : _______________________________________
Section : _______________________________________
VISION
To train the students to sell his brawn and brain to the highest bidder but to never put a price tag on
heart and soul
VISION
To impart professional education integrated with human values to the younger generation, so as to
shape them as proficient and dedicated engineers, capable of providing comprehensive solutions to the
challenges in deploying technology for the service of humanity
MISSION
To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
1. Fundamentals
To provide students with a solid foundation in Mathematics, Science and fundamentals of
engineering, enabling them to apply, to find solutions for engineering problems and use this knowledge
to acquire higher education
2. Core Competence
To train the students in Electronics and Communication technologies so that they apply their
knowledge and training to compare, and to analyze various engineering industrial problems to find
solutions
3. Breadth
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for the real time problems in industry, and to design products
4. Professionalism
To inculcate professional and effective communication skills, leadership qualities and team spirit in
the students to make them multi-faceted personalities and develop their ability to relate engineering
issues to broader social context
5. Lifelong Learning/Ethics
To demonstrate and practice ethical and professional responsibilities in the industry and society in
the large, through commitment and lifelong learning needed for successful professional career
b) To design a component, a system or a process to meet the specific needs within the realistic
constraints such as economics, environment, ethics, health, safety and manufacturability
c) To demonstrate the competency to use software tools for computation, simulation and testing of electronics
and communication engineering circuits
g) To communicate in verbal and written form with fellow engineers and society at large
h) To understand the impact of Electronics and Communication Engineering in the society and demonstrate
awareness of contemporary issues and commitment to give solutions exhibiting social responsibility
COURSE OBJECTIVES
COURSE OUTCOMES
CONTENTS
Sl. No. Name of the Experiment Page No.
CYCLE 1 – EXPERIMENTS
1 Study of ARM evaluation system 8
2 Analog to Digital Convertor interfacing 17
3 Generation of ramp and square wave using on-Chip DAC 20
4 LED dimming using PWM 23
5 Interfacing real time clock and serial port 26
6 Interfacing keypad and LCD 29
7 Interfacing EPROM and interrupt 32
CYCLE 2 – EXPERIMENTS
8 Implementation of Mailbox Function using LPC 2148 36
9 Interrupt Performance Characteristics of Arm and FPGA 38
10 Flashing of LEDs 41
11 Stepper Motor Interface with ARM – 7 LPC2148 44
12 LM35 Temperature Sensor Interface with ARM – 7 LPC2148 48
Implementation of Wireless Communication Protocol using ZIGBEE Wireless
13 51
Module
ADDITIONAL EXPERIMENTS BEYOND THE SYYLABUS
14 Buzzer Interface with ARM – 7 55
15 Relay interface with ARM– 7 58
GENERAL PROCEDURE
2. In-System/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 1ms.
3. 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.
4. USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM. In addition, the LPC2146/8
provides 8 kB of on-chip RAM accessible to USB by DMA.
5. One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a total of 6/14analog inputs, with
conversion times as low as 2.44 us per channel.
7. Two 32-bit timers/external event counters (with four capture and four compare channels each), PWM unit
(six outputs) and watchdog.
8. Low power real-time clock with independent power and dedicated 32 kHz clock input.
9. Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus (400 kbit/s), SPI and SSP with
buffering and variable data length capabilities.
10. Vectored interrupt controller with configurable priorities and vector addresses.
11. Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.
12. Up to nine edge or level sensitive external interrupt pins available.
13. On-chip integrated oscillator operates with an external crystal in range from 1 MHz to30 MHz and with
an external oscillator up to 50 MHz
14. Power saving modes include Idle and Power-down.
15. Individual enable/disable of peripheral functions as well as peripheral clock scaling for additional power
optimization.
16. Processor wake-up from Power-down mode via external interrupt, USB, Brown-Out Detect (BOD) or
Real-Time Clock (RTC).
Transformer: It is used to step down 230V AC to 9V AC supply and provides isolation between power grids
and circuit.
Rectifier: It is used to convert AC supply into DC.
Filter: It is used to reduce ripple factor of DC output available from rectifier end.
Regulator: It is used to regulate DC supply output.
The value of capacitors C20 & C21 depends upon the frequency of crystal Y3. General circuit and
its equivalent circuit is as shown below.
UART:
LPC 2148 has inbuilt ISP which means we can program it within the system using serial
communication on COM0. It has also COM1 for serial communication. MAX 232/233 IC must be used for
voltage logic conversion. Related connections are as given below.
Once the above listed circuit design is ready, we are ready to go further.
15 Format No.: DCE/Stud/LM/34/Issue: 00/Revision: 00
15 Format No.: DCE/Stud/LM/34/Issue: 00/Revision: 00
Result:
Arm Evaluation system and its configuration of LPC2148 has been studied fully.
Outcome:
Studied Configuration and parts of ARM LPC2148
Viva-voce
Aim:
To write a program for an on chip ADC using LPC2148 ARM processor
Apparatus Required:
1. LPC2148 ARM development board
2. Flash Magic software
3. Interfacing cables
4. PC
Theory:
Analog to Digital converter (ADC) is a device that converts continuously varying analog signals from
instruments that monitor such conditions as movement, temperature, sound, etc., into binary code for the
computer. It may be either a single chip or can be one circuit within a chip. Analog to Digital conversion is
the process of changing continuously varying data, such as voltage, current, or shaft rotation, into discrete
digital quantities that represent the magnitude of the data compared to a standard or reference at the
moment the conversion is made. According to the method of conversion, ADCs can be classified into
Direct-Conversion ADCs, Successive Approximation ADCs, Integrating ADC and Sigma-Delta ADCs.
The LPC 2148 has 10-bit successive approximation analog to digital converter. Basic clocking for the
A/D converters is provided by the VPB clock. A programmable divider is included in each converter, to
scale this clock to the 4.5 MHz (max) clock needed by the successive approximation process. A fully
accurate conversion requires 11 of these clocks. The ADC cell can measure the voltage on any of the ADC
input signals. It is noted that these analog inputs are always connected to their pins, even if the Pin function
Select register assigns them to port pins. A simple self-test of the ADC can be done by driving these pins
as port outputs.
Result:
Thus, digital reading of the corresponding analog input on LCD has been performed successfully.
Outcome:
Interface A/D convertors with ARM system
Viva-voce
1. What are the ADC operating modes in LPC2148?
2. What is meant by conversion time?
3. Why are internal ADCs preferred over external ADCs?
4. Why has 16-bit ADC 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?
Apparatus Required:
1. LPC2148 ARM development board
2. Flash Magic software
3. Interfacing cables
4. CRO
Theory:
A digital-to-analog converter is a device for converting a digital signal into an analog signal (current or
voltage). Digital-to-Analog Converters are the interface between the abstract digital world and the analog
real world. Simple switches, a network of resistors, current sources or capacitors may be used to
implement this conversion. A DAC inputs a binary number and outputs an analog voltage or current signal.
The Microchip Technology Inc. MCP4921 is 2.7 – 5.5V, low-power, 12-Bit Digital-to-Analog Converter
(DAC) with SPI interface. The MCP4921 DAC provides high accuracy and low noise performance for
industrial applications where calibration or compensation of signals is required. With an SPI connection
there is always one master device (usually a microcontroller) which controls the peripheral devices.
Typically there are three lines common to all the devices,
Master In Slave Out (MISO) – The Slave line for sending data to the master,
Master Out Slave In (MOSI) – The Master line for sending data to the peripherals,
Serial Clock (SCK) – The clock pulses which synchronize data transmission generated by the
master and slave
Slave Select pin – the pin on each device that the master can use to enable and disable specific
devices. When a device Slave Select pin is low, it communicates with the master. When it is high, it ignores
the master. In SPI, the clock signal is controlled by the master device LPC2148. All data is clocked in and
out using this pin. These lines need to be connected to the relevant pins on the LPC21xx processor. Any
unused GIO pin can be used for CS, instead pull this pin high. Conversion speed is the time it takes for the
Circuit diagram:
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Thus ramp wave and square wave on oscilloscope have been performed successfully.
Outcome:
Interface A/D and D/A convertors with ARM system
3. Which pin provides a voltage reference level for the D/A converter?
5. What is GIO?
7. What is the major advantage of the R/2R ladder digital-to-analog (DAC), as compared to a binary-
weighted digital-to-analog DAC converter?
Aim:
To write a program to generate ramp or square wave using on-chip DAC
Apparatus Required:
1. LPC2148 ARM development board
2. Flash Magic software
3. Interfacing cables
4. CRO
Theory:
A PWM block, like a Timer block , has a Timer Counter and an associated Pre-scale Register along
with Match Registers. These work exactly the same way as in the case of Timers. Match Registers 1 to 6
(except 0) are pinned on LPC214x i.e. the corresponding outputs are diverted to actual Pins on LPC214x
MCU. The PWM function must be selected for these Pins to get the PWM output.
The basic setup is to simply replace Servo by a LED and no external 5V source is needed. The
anode of LED is connected to P0.0 and cathode to ground. Pulse Widths corresponding to the switches
connected to P0.1/2/3/4 will be 2.5ms/5ms/7.5ms/10ms respectively. As the Pulse Width Increases LED
will keep on getting brighter and the reverse will happen if Pulse Width is decreased.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Thus pulse Width Modulation output has been displayed in LED and verified successfully.
Outcome:
Write programs in ARM for a specific Application
Apparatus Required:
1. LPC2148 ARM development board
2. Stepper motor
3. Interfacing cables
4. PC
Theory:
A clock, which is based on the interrupts at preset intervals, is Real Time Clock (RTC). An interrupt
service routine executes on each timeout (overflow) of this clock. This timing device once started never
resets or never reloaded with another value. Once it is set, it is not modified later. It is used in a system to
save the time and date.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Thus date and time on screen has been performed successfully.
Outcome:
Interface memory and Write programs related to memory operations
Aim:
To write a program to interface 4 x 4 matrix keypad
Apparatus Required:
1. LPC2148 ARM development board
2. Interfacing cables
3. PC
Theory:
In matrix keypad, keys are connected in rows and columns. When any switch is pressed, rows and
columns come into contact, which is that detected by controller to identify which key has been pressed. A
4×4 matrix keypad consists of 4 rows and 4 columns. There is a switch connecting each row and column.
So the combinations of rows and columns make up the 16 inputs.Initially all the switches are open (not
connected). When any one button is pressed, the switch is closed (connected),hence there is a connection
between the row and column. The first 4 pins are connected to the column as INPUT. The other 4 pins are
connected to the row as OUTPUT. Matrix keypad is a good substitution to normal push button.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
In this program after pressing any key from SW0 to SW15, its code will be displayed on 16x2 LCD.
Viva-voce
Aim:
To write a program to interface EEPROM using I2C protocol
Apparatus Required:
1. LPC2148 ARM development board
2. Interfacing cables
3. PC
Theory:
I2C (Inter Integrated Circuit):
The I2C (Inter-IC) bus is a bi-directional two-wire serial bus that provides a communication link between
integrated circuits (ICs).I2C is a synchronous protocol that allows a master device to initiate communication
with a slave device. Data is exchanged between these devices.
EEPROM:
EEPROM (electrically erasable programmable read-only memory) is user-modifiable read-only
memory (ROM) that can be erased and reprogrammed (written to) repeatedly through the application of
higher than normal electrical voltage. It is a type of non-volatile memory used in computers and other
electronic devices to store small amounts of data that must be saved when power is removed, e.g.,
calibration tables or device configuration
Read, write and Erase EEPROM by using I2C in LPC2148 Primer Board. Wiring up an I2C based
EEPROM to the I2C port is relatively simple. The basic operation of the I2C based EEPROM's is to send a
command, such as WRITE, followed by an address and the data. In WRITE operation, the EEPROM is
used to store the data. In LPC2148 Primer Kit, 2 nos. of EEPROM lines are controlled by I2C Enabled
drivers. I2C Lines serial clock SCL (P0.2), serial data SDA (P0.3) connected to the I2C based serial
EEPROM IC. The EEPROM read & write operations are done in LPC2148 Primer Kit by using these SDA &
SCL I2C lines.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To down load and run this program: Refer General procedure given in Page No: 60
Result:
Thus, I2C based EEPROM interface has been successfully verified on Win x talk terminal.
Viva-voce
Apparatus Required:
1. LPC2148 ARM development board
2. Interfacing cables
3. PC
Theory:
System or the user code can send a message by the core services. A typical mail message, also
known as the exchange of information, refers to a task or an ISR using a pointer variable, through the core
services to put a message (that is, a pointer) into the mailbox. Similarly, one or more tasks can receive this
message by the core services. The tasks sending and receiving the message promise that the content that
the pointer points to is just that piece of message.
The mailbox of CooCox CoOS is a typical message mailbox which is composed of two parts: one is
the information which expressed by a pointer of void; the other is the waiting list which composed of the
tasks waiting for this mailbox. The waiting list supports two kinds of sorting: FIFO and preemptive priority.
The sorting mode is determined by the user when creating the mailbox.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure in Page No: 58
To down load and run this program: Refer General procedure in Page No: 60
Result:
Thus, the mailbox was created in Micro C/OS –II and implemented using LPC2148.
Outcome:
Interface memory and Write programs related to memory operations
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?
Aim:
To study the performance characteristics of ARM and FPGA
Apparatus Required:
1. LPC2148 ARM development board
2. Flash Magic software
3. Interfacing cables
4. CRO
Theory:
External Interrupts:
An interrupt caused by an external source such as the computer operator, external sensor or
monitoring device, or another computer. Interrupts are special events that require immediate attention.
Interfacing External Interrupts with LPC2148:
When an external interrupt signal occurs in LPC2148 Primer Board, the message "LOW" will be
displayed on PC. The interrupt signal occurs using switches. When the switch is pressed to LOW, then the
external interrupt occurs. The Vectored Interrupt Controller (VIC) takes 32 interrupt request inputs and
programmable assigns them into 3 categories, FIQ, vectored IRQ, and non-vectored IRQ. The ARM7
LPC2148 Primer board has two numbers of External Interrupts, connected with I/O Port lines (P0.14 &
P0.15) as switches.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Outcome:
Analyze the performance of interrupt
Viva-voce
Theory:
LED (Light Emitting Diodes) is the most commonly used components, usually for displaying pins digital
states. Typical uses of LEDs include alarm devices, timers and confirmation of user input such as a mouse
click or keystroke. Interfacing LED with LPC2148 Flash a LED using LPC2148 Primer Board. It works by
turning ON a LED & then turning it OFF & then looping back to START. However the operating speed of
microcontroller is very high so the flashing frequency will also be very fast to be detected by human eye.
The ARM7 LPC2148 Primer board has eight numbers of point LEDs, connected with I/O Port lines (P1.16 –
P1.23) to make port pins high.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
I2C based seven segment LED display interface has been displayed successfully.
Outcome:
Write programs in ARM for a specific Application
Aim:
To write a program to interface stepper motor using ARM processor
Apparatus Required:
1. LPC2148 ARM development board
2. Stepper motor
3. Interfacing cables
4. PC
Theory:
A stepper motor can be viewed as a DC motor with number of poles (on both rotor and stator).
Additionally, soft magnetic material with many teeth on the rotor and stator cheaply multiplies the number of
poles (reluctance motor). Like an AC synchronous motor, it is ideally driven by sinusoidal current, allowing
a step less operation, but this puts some burden on the controller. When using an 8-bit digital controller,
256 micro steps per step are possible. As a digital-to-analog converter produces unwanted ohmic heat in
the controller, pulse-width modulation is used to regulate the mean current. Simpler models switch voltage
only for doing a step, thus needing an extra current limiter: for every step, they switch a single cable to the
motor. Bipolar controllers can switch between supply voltage, ground, and unconnected. Unipolar
controllers can only connect or disconnect a cable, because the voltage is already hard wired. Unipolar
controllers need center tapped windings. It is possible to drive unipolar stepper motors with bipolar drivers.
The idea is to connect the output pins of the driver to 4 transistors. The transistor must be grounded at the
emitter and the driver pin must be connected to the base. Collector is connected to the coil wire of the
motor. Stepper motors are rated by the torque they produce. Synchronous electric motors using soft
magnetic materials (having a core) have the ability to provide position holding torque (called detent torque,
and sometimes included in the specifications) while not driven electrically. To achieve full rated torque, the
coils in a stepper motor must reach their full rated current during each step. The voltage rating (if there is
one) is almost meaningless. The motors also suffer from EMF, which means that once the coil is turned off
it starts to generate current because the motor is still rotating. There needs to be an explicit way to handle
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Thus stepper motor interface has been successfully implemented in clockwise and anticlockwise
direction.
Outcome:
Write programmes for interfacing motor
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?
Apparatus Required:
1. LPC2148 ARM development board
2. Temperature sensor
3. Interfacing cables
4. PC
Theory:
Temperature Sensor:
The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly
proportional to the Celsius (Centigrade) temperature. The output of the sensor is converted to digital output
that is easy to connect with microcontroller. Temperature sensor has three terminals and required
Maximum of 5.5 V supply. This type of sensor consists of a material that performs the operation according
to temperature to vary the resistance. This change of resistance is sensed by circuit and it calculates
temperature. When the voltage increases then the temperature also rises. We can see this operation by
using a diode.
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 LPC 2148?
5) What is the output voltage produced by LM35 for one degree temperature?
6) What is the difference between LM 34 and LM 35 sensors?
7) How many pins are available in LM35?
8) Why Vref is set of ADC0848 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 in LM35?
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?
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Thus the wireless communication protocol using Zigbee wireless module is implemented Zigbee
protocol was implemented using LPC2148.
Outcome:
Formulate a mini project using embedded system
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Buzzer will turn ON and OFF and it has been successfully implemented.
Outcome:
Write programs in ARM for a specific Application
1. Define Buzzer.
2. Which pin in ARM can be used to modulate Buzzer?
3. What is the function Flash magic software?
4. How the Buzzer can be disconnected in LPC2148?
5. How the volume of sound will be changed in Buzzer?
6. What is a buzzer
7. What are the applications of buzzer?
8. How buzzer is used in embedded system?
9. What is race round condition?
10. What is digital signal controller?
11. What are the features of buzzer circuit?
12. What is a semaphore?
13. What is mutexes?
14. What is the role of segment register?
15. What is watch dog timer?
Aim:
To write a program to interface 2 relays with LPC 2148
Apparatus required:
1. LPC2148 ARM development board
2. Flash Magic software
3. Interfacing cables
Theory:
A relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a
switch, but other operating principles are also used, such as solid-state relays. Relays are used where it is
necessary to control a circuit by a low-power signal (with complete electrical isolation between control and
controlled circuits), or where several circuits must be controlled by one signal. The first relays were used in
long distance telegraph circuits as amplifiers: they repeated the signal coming in from one circuit and re-
transmitted it on another circuit. Relays were used extensively in telephone exchanges and early
computers to perform logical operations.
Procedure:
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 58
To Edit / Compile / generate Hex file: Refer General procedure given in Page No: 60
Result:
Relays will become ON and OFF continuously. Hence it is successfully implemented.
Outcome:
Write programs in ARM for a specific Application
ARM7 LPC 2148 Processor based Industrial Fault detection and announciator
ARM7 LPC 2148 Processor based Cell Phone Controlled Two Axis robotics with AI
ARM7 LPC 2148 Processor based Cell Phone Controlled Three Axis robotics with AI