You are on page 1of 37

COLLEGE OF ENGINEERING AND TECHNOLOGY,

KOTHANDARAMAN NAGAR, DINDIGUL-624622.

DEPARTMENT OF ECE
ACADEMIC YEAR 2016-2017
REGULATION 2013

EC6711 EMBEDDED SYSTEMS LABORATORY

COLLEGE OF ENGINEERING AND TECHNOLOGY,


KOTHANDARAMAN NAGAR, DINDIGUL-624622.

Department of Electronics & Communication Engineering


EC6711 EMBEDDED SYSTEMS LABORATORY
LAB MANUAL

ACADEMIC YEAR 2016 2017


ODD SEMESTER
IV YEAR VII SEM REG 2013

STAFF IN CHARGE

HOD / ECE

INSTRUCTION TO THE STUDENTS


1. Come with uniform & Shoes to all Lab Classes.
2. Boys should tuck-in their shirts & Girls should wear overcoat.
3. Remove footwears when getting into the Computer Labs.
4. Come for the Practical Classes in time.
5. Go through the Lab Manual and come prepared for doing the experiment.
6. Start doing experiments only after getting permission from the respective faculty.
7. Handle Instruments with care.
8. Report immediately to the Staff-in-charge if there is any damage to the
equipments/ Machines/ Accessories.
9. Use sharp HB Pencils for Drawing Figures, Tabulation & Graphs.
10. Draw the Figures, Circuits, Diagrams and Tables on the left side of the Record
Note Book.
11. Show the Model Calculations if any, on the left side of the Record Note Book.
12. Write Aim, Theory, Procedure, Results and Answers to Questions on the right side
of the note book.
13. Get the Observation Note Book corrected within two days and submit the
completed records when come to the Laboratory.
14. Keep the Observation, Record Note Books Neat & tidy

EC6711 EMBEDDED LABORATORY

LTPC
0032

OBJECTIVES:
The student should 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 of ARM and FPGA.
9. Flashing of LEDS.
10. Interfacing stepper motor and temperature sensor.
11. Implementing zigbee protocol with ARM..
TOTAL: 45 PERIODS

PSNA COLLEGE OF ENGINEERING AND TECHNOLOGY,


Kothandaraman Nagar, DINDIGUL-624622. Tamil Nadu
LIST OF EXPERIMENTS
Sl.

Page
Date

Name of Experiments

No

Marks
No

FIRST CYCLE
1

Study of ARM evaluation system

Interfacing ADC and DAC

Interfacing LED and PWM

Interfacing real time clock and serial port

Interfacing keyboard and LCD

Interfacing EPROM and interrupt


SECOND CYCLE

Mailbox

Flashing of LEDS

Interfacing of stepper motor

10

Interfacing temperature sensor.

11

Implementing zigbee protocol with ARM.


Interrupt performance characteristics of

12

ARM and FPGA

Remarks

Exp.No:
Date :

STUDY OF ARM-2378 EVALUATION BOARD

EXPT 1
ARM-2378 DEVELOPMENT BOARD
Introduction
ARM is a 32-bit RISC (Reduced Instruction Set Computer) processor architecture
developed by ARM Corporation. It was previously known as Advanced RISC Machines and
prior to that Acorn RISC Machines. The ARM architecture is licensed to companies that want to
manufacture ARM-based CPUs or system-on-a-chip products. This enables the licensees to
develop their own processors compliant with the ARM instruction set architecture. For
example, the device we are using (LPC21XX) is ARM architecture based SOC product
developed by NXP semiconductors, similarly all major semiconductor manufacturers like
Atmel, Samsung, TI they all make ARM based SOCs. So learning about ARM is pretty cool as
once you are familiar to ARM instruction set you can easily switch between various ARM
based SOCs available in market.

Fig.1. Block Diagram of ARM 7 Microcontroller

LPC-2378 is an ARM-based microcontroller for applications requiring serial


communications for a variety of purposes. This microcontroller incorporate a 10/100 Ethernet
MAC, USB 2.0 Full Speed interface, four UARTs, two CAN channels, an SPI interface, two
Synchronous Serial Ports (SSP), three I2C interfaces, an I2S interface, and a Mini Bus. It has 8bit data/16-bit address parallel bus is available.

Fig.2. Block Diagram of ARM Core CORTEX M3


LPC2378 Micro-controller is based on a 32/16 Bit ARM7TDMI-s CPU with real time
Emulation and Embedded Trace support that combines with the microcontroller with embedded
high-speed 512KB flash memory. It can work with 16-bit Thumb Mode. The ARM7TDMI-S is
a general- purpose 32-bit microprocessor, which offers high performance and very low power
consumption. The ARM architecture is based on Reduced Instruction Set Computer (RISC)
principles.
The LPC2377/78 microcontrollers are based on a 16-bit/32-bit ARM7TDMI-S CPU with
real-time emulation that combines the microcontroller with 512 kB of embedded high-speed
flash memory. A 128-bit wide memory interface and a unique accelerator architecture enable
32-bit code execution at the maximum clock rate. For critical performance in interrupt service
routines and DSP algorithms, this increases performance up to 30 % over Thumb mode. For
critical code size applications, the alternative 16-bit Thumb mode reduces code by more than 30
% with minimal performance penalty.
7

LPC2377/78 is ideal for multi-purpose serial communication applications. It incorporates


a 10/100 Ethernet Media Access Controller (MAC), USB full speed device with 4 kB of
endpoint RAM (LPC2378 only), four UARTs, two CAN channels (LPC2378 only), an SPI
interface, two Synchronous Serial Ports (SSP), three I2C-bus interfaces, an I 2S-bus interface,
and an External Memory Controller (EMC). This blend of serial communications interfaces
combined with an on-chip 4 MHz internal oscillator, SRAM of 32 kB, 16 kB SRAM for
Ethernet, 8 kB SRAM for USB and general purpose use, together with 2 kB battery powered
SRAM make this device suited for communication gateways and protocol converters. Various
32-bit timers, an improved 10-bit ADC, 10-bit DAC, PWM unit, a CAN control unit, and up to
104 fast GPIO lines with up to 50 edge and up to four level sensitive external interrupt pins
make these microcontrollers suitable for industrial control and medical systems.
Features of ARM Processor:
ARM7TDMI-S processor, running at up to 72 MHz.
Up to 512kB on-chip Flash Program Memory with In-System Programming (ISP) and
In-Application Programming (IAP) capabilities. Single Flash sector or full chip erase in
400ms and 256 bytes programming in 1ms. Flash program memory is on the ARM local
bus for high performance CPU access.
Up to 32KB of SRAM on the ARM local bus for high performance CPU access.
16KB Static RAM for Ethernet interface. CAN also be used as general purpose SRAM.
8KB Static RAM for USB interface. CAN also be used as general purpose SRAM.
Dual AHB system that provides for simultaneous Ethernet DMA, USB DMA, and
program execution from on-chip Flash with no contention between those functions. A
bus bridge allows the Ethernet DMA to access the other AHB subsystem.
External memory controller that supports static devices such as Flash and SRAM.
Advanced Vectored Interrupt Controller, supporting up to 32 vectored interrupts.
General Purpose AHB DMA controller (GPDMA) that can be used with the SSP serial
interfaces, the I2S port, and the SD/MMC card port, as well as for memory-to-memory
transfers.
Processor Range:
ARM offers a wide range of processor cores based on a common architecture, that
deliver high performance together with low power consumption and system cost .

The ARM processor range provides solutions for:


Open platforms running complex operating systems for wireless, consumer and imaging
applications.
Embedded real-time systems for mass storage, automotive, industrial and networking
applications.
Secure applications including smart cards and SIMs.

Applications of ARM 2378


With Useful Implemented peripherals, and a broad set of additional on board Peripherals
various applications are possible such as 10/100Mbps Ethernet, MMC/SD, ADC, DAC, RTC,
USB etc.,.
ViARM-2378 Development Board Parts Details
1. NXP LPC2378 Micro controller (TQFP-64 Packaging).
2. Power supply section.
3. UART.
4. CAN Port.
5. Stepper Motor.
6. Relay.
7. USB 2.0 Device Controller.
8. 10/100 Base T Ethernet Connectivity.
9. PS2- Keyboard connector.
10. USB Audio Device.
11. Prog/Exec Switch.
12. Joystick.
13. Accelerometer.
14. 4 x 4 Matrix Keypad.
15. 8 Way DIP switch.
16. LED.
17. SD Card Socket.
18. Analog input Trimmer.
19. 128 x 64 Pixels Graphics LCD
20. J-Tag Connector.
21. ADC, DAC and PWM Expansion slot.
22. 50Pin Expansion Header.
23. J-Trace.
24. Seven Segment Display.
25. Serial EEPROM
26. RTC.

RESULT:

10

Program
#include <iolpc2378.h>
#include "irq.h"
#include "config.h"

void delay()
{
unsigned int i,j;
for(i=0;i<0x3fff;i++)
for(j=0;j<0xff;j++);
}
int main (void)
{
unsigned int Fdiv;
TargetResetInit();
PINSEL0 = 0x00000050;
/* RxD0 and TxD0 */
U0LCR = 0x83;
/* 8 bits, no Parity, 1 Stop bit */
Fdiv = ( Fpclk / 16 ) / 19200 ;
/*baud rate */
U0DLM = Fdiv / 256;
U0DLL = Fdiv % 256;
U0LCR = 0x03;
/* DLAB = 0 */
U0FCR = 0x07;
/* Enable and reset TX and RX FIFO. */
FIO3DIR = 0X008000FF;
while(1)
{
FIO3PIN = 0X000000ff;
delay();
FIO3PIN = 0X00000000;
delay();
}
}

11

Exp.No:
EXPT:2
Date

FLASHING OF LEDS

Aim
To perform the flashing of LEDs with ARM 7 controller
Components Required:
1. LPC 2378 ARM Development board
2. IAR Embedded Workbench 6.5
3. Flash Magic ISP Utility
Theory
LED (Light Emitting Diodes) Light Emitting Diodes (LED) 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. Light
Emitting diodes are most commonly used components, usually for displaying Pins Digital
state. The 8 nos of LED are connected to pin Q0-Q7.The 330 ohm resistor limit the current to
about 4 mA. A low output pin drives current through the LEDs and they will light. Each Led
can be individually enabled or disabled. The digital data sent by the microcontroller is latched
using 74LS273. This latch is selected via 74LS154 decoder.

Fig.3. LED Structure

12

OUTPUT:

13

PROCEDURE:
1. Run the Application IAR Embedded Workbench 6.5
2. Create new project in the current work space. Create a new project by selecting the tool
chain as ARM and create empty project and click ok. Give Project Name and click
SAVE Button.
3. Select LPC2378 >Options menu
4. Select General options category. Enable target option file and select the device as NXP
LPC2378 and click ok.
5. Select C/C++ Compiler >Select Preprocessor and include (C:\Program Files\IAR
Systems\Embedded
Workbench
6.5\arm\inc\c,
C:\Program
Files\IAR
Systems\Embedded Workbench 6.5\arm\inc\NXP)
6. Enable Output Converter Menu and select output format as Intel extended and Enable
Override default option
7. Select Linker Category. Enable Override default option, click SAVE Button.
8. New>File Menu, for creating a new C file. File>Save As, for saving a file. Give your
File name ( Eg: LED.C) and click Save Button.
9. Right Click the project name option for select a C file in
workspace window. Select Add >Add (LED.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your C file. If your
Cfile has no error.
11. Select LPC2378>Rebuild all menu, for checking any error in your C file.
12. If your project has no error, Building completed and Hex file generated.
13. This Hex file will be downloaded to the VIARM-2378 controller by Flash Magic
Software

14

15

Steps To Be Followed In Flash Magic Software For Embed Into Kit:


Step 1: Open Flash Magic software
Step 2: Go to step 1: Communications
Select Com port
: COM1
Baud Rate
: 19200
Device
: LPC2378
Interface
: None (ISP)
Oscillator Freq (MHz) : 16.000000
Step 3: Go to step 2: Erase
Select Erase blocks used by Hex file
Step 4: Go to step 3: Hex file
Select Browse corresponding Hex file
Step 5: Directly go to step 5: Start click start for Embed (*.HEX) file to kit.

RESULT:

16

Program: Interfacing of DAC with ARM


#include
#include
#include
#include

<iolpc2378.h>
"irq.h"
"config.h"
"dac.h"

void DACInit( void )


{
/* setup the related pin to DAC output */
PINSEL1 = 0x00200000; /* set p0.26 to DAC output */
return;
}
//Main Function
int main (void)
{
unsigned int i;
TargetResetInit();
/* Initialize DAC
DACInit();

*/

while ( 1 )
{
DACR = (i << 6) | DAC_BIAS;
i++;
if ( i == 1024 )
{
i = 0;
}
}
return 0;
}

17

Exp.No:
Date :

INTERFACING OF ADC & DAC

Aim
To interface ADC and DAC with ARM 7 Controller
Components Required:
1. LPC 2378 ARM Development board
2. IAR Embedded Workbench 6.5
3. Flash Magic ISP Utility
Theory
A digital-to-analog converter is a device for converting a digital (usually binary) code to
an analog signal (current, voltage or charges). Digital-to-Analog Converters are the interface
between the abstract digital world and the analog real life. Simple switches, a network of
resistors, current sources or capacitors may implement this conversion. A DAC inputs a binary
number and outputs an analog voltage or current signal.
MCP429x:

The Microchip Technology Inc. MCP492X is 2.7 5.5V, low-power, low DNL, 12-Bit
Digital-to-Analog Converters (DACs) with optional 2x buffered output and SPI interface. The
MCP492X are DACs that provide high accuracy and low noise performance for industrial
applications where calibration or compensation of signals is required
Interfacing SPI-DAC:
Fig.4 shows how to interface the SPI-DAC to microcontroller. 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.
Slave Select pin - the pin on each device that the master can use to enable and disable
specific devices.

18

OUTPUT:

19

Interfacing of ADC:
An analog-to-digital converter is a device that converts a continuous quantity to a
discrete digital number. Typically, an ADC is an electronic device that converts an input analog
voltage (or current) to a digital number proportional to the magnitude of the voltage or current.
The resolution of the converter indicates the number of discrete values it can produce over the
range of analog values. The values are usually stored electronically in binary form, so the
resolution is usually expressed in bits. In consequence, the number of discrete values available,
or "levels", is usually a power of two.
An ADC with a 10-bit output can represent up to 1024 (210) unique conditions of signal
measurement. Over the range of measurement from 0% to 100%, there will be exactly 1024
unique binary numbers output by the converter (from 0000000000 to 1111111111, inclusive).
ViARM - 2378 Development board has two potentiometers for working with A/D
Converter. All Potentiometers outputs are in the range of 0V to 3.3V. ARM processor takes
analog signal from its input pin and translates it into a digital value. Basically, you can measure
any analog signal that fits in range acceptable by LPC2378. That range is 0V to 3.3V.
PROCEDURE:
1. Run the Application IAR Embedded Workbench 6.5
2. Create new project in the current work space. Create a new project by selecting the tool
chain as ARM and create empty project and click ok. Give Project Name and click
SAVE Button.
3. Select LPC2378 >Options menu
4. Select General options category. Enable target option file and select the device as NXP
LPC2378 and click ok.
5. Select C/C++ Compiler >Select Preprocessor and include (C:\Program Files\IAR
Systems\Embedded
Workbench
6.5\arm\inc\c,
C:\Program
Files\IAR
Systems\Embedded Workbench 6.5\arm\inc\NXP)
6. Enable Output Converter Menu and select output format as Intel extended and Enable
Override default option
7. Select Linker Category. Enable Override default option, click SAVE Button.
8. New>File Menu, for creating a new C file. File>Save As, for saving a file. Give your
File name ( Eg: DAC.C) and click Save Button.

20

Program: Interfacing of ADC with ARM


#include<NXP\iolpc2378.h>
#include "irq.h"
#include "config.h"
unsigned int ADC_VALUE=0;
#define ADC_CLK
1000000
/* set to 1Mhz */
void send_serial_data(unsigned char serial)
{
while((U0LSR & 0x20)==0);
U0THR = serial;
}
void adc_serial_tx(unsigned int ch)
{
unsigned int
t1000 = ch
temp = ch
t100 = temp
temp = temp
t10
= temp
t1
= temp

t1000,t100,t10,t1,temp;
/ 1000;
% 1000;
/ 100;
% 100;
/ 10;
% 10;

send_serial_data(t1000+0x30);
send_serial_data(t100 +0x30);
send_serial_data(t10+0x30);
send_serial_data(t1+0x30);
send_serial_data(0x0d);
send_serial_data(0x0a);
}
void main()
{
unsigned long int val;
unsigned int Fdiv;
TargetResetInit();
PCONP |= (1 << 12);
PINSEL1 = 0X00054000;
PINSEL0 = 0x00000050;

//AD0.0 AS ANALALOG INPUT


// RxD0 and TxD0

// PINSEL1 &= ~0x003FC000; /* P0.23~26, A0.0~3, function 01 */


// PINSEL1 |= 0x00154000;
// PINSEL3 |= 0xF0000000; /* P1.30~31, A0.4~5, function 11 */
U0LCR = 0x83;
// 8 bits, no Parity, 1 Stop bit
Fdiv = ( Fpclk / 16 ) / 19200 ; //baud rate
U0DLM = Fdiv / 256;
U0DLL = Fdiv % 256;
U0LCR = 0x03;
// DLAB = 0
U0FCR = 0x07;
// Enable and reset TX and RX FIFO.

21

9. Right Click the project name option for select a C file in


workspace window. Select Add >Add (DAC.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your C file. If your
Cfile has no error.
11. Select LPC2378>Rebuild all menu, for checking any error in your C file.
12. If your project has no error, Building completed and Hex file generated.
13. This Hex file will be downloaded to the VIARM-2378 controller by Flash Magic
Software
Steps To Be Followed In Flash Magic Software For Embed Into Kit:
Step 1: Open Flash Magic software
Step 2: Go to step 1: Communications
Select Com port
: COM1
Baud Rate
: 19200
Device
: LPC2378
Interface
: None (ISP)
Oscillator Freq (MHz) : 16.000000
Step 3: Go to step 2: Erase
Select Erase blocks used by Hex file
Step 4: Go to step 3: Hex file
Select Browse corresponding Hex file
Step 5: Directly go to step 5: Start click start for Embed (*.HEX) file to kit.

22

// AD0CR = 0x01200601;
// Start A/D Conversion
AD0CR = ( 0x01 << 1 ) |
/* SEL=1,select channel 0~7 on ADC0 */
( ( Fpclk / ADC_CLK - 1 ) << 8 ) | /* CLKDIV = Fpclk / 1000000 - 1 */
( 1 << 16 ) |
/* BURST = 0, no BURST, software controlled */
( 0 << 17 ) |
/* CLKS = 0, 11 clocks/10 bits */
( 1 << 21 ) |
/* PDN = 1, normal operation */
( 0 << 22 ) |
/* TEST1:0 = 00 */
( 1 << 24 ) |
/* START = 0 A/D conversion stops */
( 0 << 27 );
/* EDGE = 0 (CAP/MAT singal falling,trigger A/D
conversion) */

while(1)
{
while((AD0GDR & 0X80000000)!=0X80000000);
val = (AD0GDR>>6)& 0x3ff ;
// convesion data holds AD0DR0[6]
to AD0DR0[15]
adc_serial_tx(val);
// 10 bit adc data transmit serial
port.
}
}

23

RESULT:

24

Program: Interfacing of Keyboard with ARM


#include <iolpc2378.h>
#include "irq.h"
#include "config.h"
unsigned int k;
unsigned int Read_Key;
unsigned char scan [] = { 0x00000E00,0x00000D00,0x00000B00,0x00000700};
unsigned int i;
void delay()
{
unsigned int i,j;
for(i=0;i<0xff;i++)
for(j=0;j<0xff;j++);
}
void send_serial_data(unsigned char serial)
{
while((U0LSR & 0x20)==0);
U0THR = serial;
}
int main (void)
{
unsigned int Fdiv;
TargetResetInit();
PINSEL0 = 0x00000050;

/* RxD0 and TxD0 */

U0LCR = 0x83;
/* 8 bits, no Parity, 1 Stop bit */
Fdiv = ( Fpclk / 16 ) / 19200 ; /*baud rate */
U0DLM = Fdiv / 256;
U0DLL = Fdiv % 256;
U0LCR = 0x03;
/* DLAB = 0 */
U0FCR = 0x07;
/* Enable and reset TX and RX FIFO. */
FIO4DIR = 0X00000FFF;
FIO3DIR = 0X008000FF;
while(1)
{
//First Row
FIO4SET = 0X00000e00;
Read_Key = FIO4PIN;
Read_Key = (Read_Key & 0xf000) >> 12 ;
if((Read_Key==0x07))
{
send_serial_data('0');
FIO3PIN = 0X00000000;
}
if((Read_Key==0x0b))
{
send_serial_data('1');
FIO3PIN = 0X00000001;
}

25

Exp.No:
Date :

INTERFACING OF KEYBOARD WITH ARM

Aim
To interface the Keypad with ARM 7 Controller
Components Required:
1. LPC 2378 ARM Development board
2. IAR Embedded Workbench 6.5
3. Flash Magic ISP Utility
Theory
A keypad is a set of buttons arranged in a block or "pad" which usually bear digits,
symbols and usually a complete set of alphabetical letters. If it mostly contains numbers then it
can also be called a numeric keypad. Here we are using 4 X 4 matrix keypad.
Interfacing keypad:
Fig. shows how to interface the 4 X 4 matrix keypad to two ports in microcontroller. The
rows are connected to an output port and the columns are connected to an input port. To detect a
pressed key, the microcontroller grounds all rows by providing 0 to the output latch, and then it
reads the columns. If the data read from the columns is D3-D0=1111, no key has been pressed
and the process continues until a key press is detected.

26

if( (Read_Key==0x0d))
{
send_serial_data('2');
FIO3PIN = 0X00000002;
}
if((Read_Key==0x0e))
{
send_serial_data('3');
FIO3PIN = 0X00000003;
}
FIO4CLR = 0X00000e00;
delay();
//Second Row
FIO4SET = 0X00000d00;
Read_Key = FIO4PIN;
Read_Key = (Read_Key & 0xf000) >> 12 ;
if((Read_Key==0x07))
{
send_serial_data('4');
FIO3PIN = 0X00000004;
}
if((Read_Key==0x0b))
{
send_serial_data('5');
FIO3PIN = 0X00000005;
}
if( (Read_Key==0x0d))
{
send_serial_data('6');
FIO3PIN = 0X00000006;
}
if( (Read_Key==0x0e))
{
send_serial_data('7');
FIO3PIN = 0X00000007;
}
FIO4CLR = 0X00000d00;
delay();
//Third Row
FIO4SET = 0X00000b00;
Read_Key = FIO4PIN;
Read_Key = (Read_Key & 0xf000) >> 12 ;
if((Read_Key==0x07))
{
send_serial_data('8');
FIO3PIN = 0X00000008;
}
if((Read_Key==0x0b))
{
send_serial_data('9');
FIO3PIN = 0X00000009;
}

27

However, if one of the column bits has a zero, this means that a key press has occurred.
For example, if D3-D0=1101, this means that a key in the D1 column has been pressed. After a
key press is detected, the microcontroller will go through the process of identifying the key.
Starting with the top row, the microcontroller grounds it by providing a low to row D0 only;
then it reads the columns.
If the data read is all 1s, no key in that row is activated and the process is moved to the
next row. It grounds the next row, reads the columns, and checks for any zero. This process
continues until the row is identified. After identification of the row in which the key has been
pressed, the next task is to find out which column the pressed key belongs to.
PROCEDURE:
1. Run the Application IAR Embedded Workbench 6.5
2. Create new project in the current work space. Create a new project by selecting the tool
chain as ARM and create empty project and click ok. Give Project Name and click
SAVE Button.
3. Select LPC2378 >Options menu
4. Select General options category. Enable target option file and select the device as NXP
LPC2378 and click ok.
5. Select C/C++ Compiler >Select Preprocessor and include (C:\Program Files\IAR
Systems\Embedded
Workbench
6.5\arm\inc\c,
C:\Program
Files\IAR
Systems\Embedded Workbench 6.5\arm\inc\NXP)
6. Enable Output Converter Menu and select output format as Intel extended and Enable
Override default option
7. Select Linker Category. Enable Override default option, click SAVE Button.
8. New>File Menu, for creating a new C file. File>Save As, for saving a file. Give your
File name ( Eg: KEYPAD.C) and click Save Button.
9. Right Click the project name option for select a C file in
workspace window. Select Add >Add (KEYPAD.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your C file. If your
Cfile has no error.
11. Select LPC2378>Rebuild all menu, for checking any error in your C file.
12. If your project has no error, Building completed and Hex file generated.
13. This Hex file will be downloaded to the VIARM-2378 controller by Flash Magic
Software

28

if( (Read_Key==0x0d))
{
send_serial_data('a');
FIO3PIN = 0X0000000a;
}
if( (Read_Key==0x0e))
{
send_serial_data('b');
FIO3PIN = 0X0000000b;
}
FIO4CLR = 0X00000b00;
delay();
//Fourth Row
FIO4SET = 0X00000700;
Read_Key = FIO4PIN;
Read_Key = (Read_Key & 0xf000) >> 12 ;
if((Read_Key==0x07))
{
send_serial_data('c');
FIO3PIN = 0X0000000c;
}
if((Read_Key==0x0b))
{
send_serial_data('d');
FIO3PIN = 0X0000000d;
}
if((Read_Key==0x0d))
{
send_serial_data('e');
FIO3PIN = 0X0000000e;
}
if( (Read_Key==0x0e))
{
send_serial_data('f');
FIO3PIN = 0X0000000f;
}
FIO4CLR = 0X00000700;
delay();
// send_serial_data('c');
}
return 0;
}

29

Steps To Be Followed In Flash Magic Software For Embed Into Kit:


Step 1: Open Flash Magic software
Step 2: Go to step 1: Communications
Select Com port
: COM1
Baud Rate
: 19200
Device
: LPC2378
Interface
: None (ISP)
Oscillator Freq (MHz) : 16.000000
Step 3: Go to step 2: Erase
Select Erase blocks used by Hex file
Step 4: Go to step 3: Hex file
Select Browse corresponding Hex file
Step 5: Directly go to step 5: Start click start for Embed (*.HEX) file to kit

RESULT:

30

31

Exp.No:
Date :

INTERFACING OF LCD WITH ARM

Aim
To interface the LCD with ARM 7 Controller
Components Required:
1. LPC 2378 ARM Development board
2. IAR Embedded Workbench 6.5
3. Flash Magic ISP Utility
Theory:
Liquid Crystal Display also called as LCD is very helpful in providing user interface as
well as for debugging purpose. A liquid crystal display (LCD) is a flat panel display that uses
the light modulating properties of liquid crystals (LCs). LCD Modules can present textual
information to user.
Interfacing LCD
Fig. shows how to interface the LCD to microcontroller. The 2x16 character LCD
interface card with supports both modes 4-bit and 8-bit interface, and also facility to adjust
contrast through trim pot. In 4-bit interface 7 lines needed to create 4-bit interface; 4 data bits
(D0 D3), three control lines, address bit (RS), read/write bit (R/W) and control signal (E).

32

33

PROCEDURE:
1. Run the Application IAR Embedded Workbench 6.5
2. Create new project in the current work space. Create a new project by selecting the tool
chain as ARM and create empty project and click ok. Give Project Name and click
SAVE Button.
3. Select LPC2378 >Options menu
4. Select General options category. Enable target option file and select the device as NXP
LPC2378 and click ok.
5. Select C/C++ Compiler >Select Preprocessor and include (C:\Program Files\IAR
Systems\Embedded
Workbench
6.5\arm\inc\c,
C:\Program
Files\IAR
Systems\Embedded Workbench 6.5\arm\inc\NXP)
6. Enable Output Converter Menu and select output format as Intel extended and Enable
Override default option
7. Select Linker Category. Enable Override default option, click SAVE Button.
8. New>File Menu, for creating a new C file. File>Save As, for saving a file. Give your
File name ( Eg: KEYPAD.C) and click Save Button.
9. Right Click the project name option for select a C file in
workspace window. Select Add >Add (KEYPAD.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your C file. If your
Cfile has no error.
11. Select LPC2378>Rebuild all menu, for checking any error in your C file.
12. If your project has no error, Building completed and Hex file generated.
13. This Hex file will be downloaded to the VIARM-2378 controller by Flash Magic
Software

34

35

Steps To Be Followed In Flash Magic Software For Embed Into Kit:


Step 1: Open Flash Magic software
Step 2: Go to step 1: Communications
Select Com port
: COM1
Baud Rate
: 19200
Device
: LPC2378
Interface
: None (ISP)
Oscillator Freq (MHz) : 16.000000
Step 3: Go to step 2: Erase
Select Erase blocks used by Hex file
Step 4: Go to step 3: Hex file
Select Browse corresponding Hex file
Step 5: Directly go to step 5: Start click start for Embed (*.HEX) file to kit

RESULT:

36

37

You might also like