0% found this document useful (0 votes)
176 views88 pages

EC6711 ES LAB Manual Final

The document describes an experiment on studying the ARM-2378 evaluation board. It includes an introduction to the ARM architecture and LPC2378 microcontroller. The LPC2378 is an ARM-based microcontroller incorporating features like Ethernet MAC, USB interface, UARTs, CAN, SPI, SSP, I2C, I2S, and GPIO lines. It has a 32-bit ARM7TDMI-S CPU core running at up to 72MHz and 512KB on-chip flash memory. The document discusses the block diagram of the ARM7 core and LPC2378 microcontroller. It explains the features of the LPC2378 board that make it suitable for applications requiring serial communications and industrial control
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
176 views88 pages

EC6711 ES LAB Manual Final

The document describes an experiment on studying the ARM-2378 evaluation board. It includes an introduction to the ARM architecture and LPC2378 microcontroller. The LPC2378 is an ARM-based microcontroller incorporating features like Ethernet MAC, USB interface, UARTs, CAN, SPI, SSP, I2C, I2S, and GPIO lines. It has a 32-bit ARM7TDMI-S CPU core running at up to 72MHz and 512KB on-chip flash memory. The document discusses the block diagram of the ARM7 core and LPC2378 microcontroller. It explains the features of the LPC2378 board that make it suitable for applications requiring serial communications and industrial control
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

COLLEGE OF ENGINEERING AND TECHNOLOGY,

KOTHANDARAMAN NAGAR, DINDIGUL-624622.

DEPARTMENT OF ECE

ACADEMIC YEAR 2016-2017


REGULATION 2013

EC6711 – EMBEDDED SYSTEMS LABORATORY

1
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

2
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 footwear‘s 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

3
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

4
PSNA COLLEGE OF ENGINEERING AND TECHNOLOGY,
Kothandaraman Nagar, DINDIGUL-624622. Tamil Nadu

LIST OF EXPERIMENTS
Sl. Page
Date Name of Experiments Marks Remarks
No No

FIRST CYCLE

1 Study of ARM LPC2378 evaluation Board

2 Flashing of LED‘s

3 Interfacing ADC and DAC

4 Interfacing of keyboard with ARM

5 Interfacing of LCD with ARM

SECOND CYCLE

6 Interfacing EPROM and interrupt

7 Interfacing real time clock and serial port

8 Interfacing of stepper motor (Forward)

9 Interfacing of stepper motor (Reverse)

10 Interfacing of Seven Segment LED Display

5
LPC-2378 ARM Development board
Steps to be followed for IAR workbench software

1. Run the Application IAR Embedded Workbench.

2. Create new project in the current work space


3. Create a new project by selecting the tool chain as “ARM” and
create empty project and click ok.

4. Give Project Name Eg: LPC-2378 and click SAVE Button.


5. New>File Menu, for creating a new „C „file.

6. Creating your ‘C’ file.


7. File>Save As, for saving a file.

8. Give your File name Eg: DAC.C and click Save Button.
9. Right Click the project name option for select a „C‟ file in
workspace window. Select Add >Add DAC.C Menu.

10. Copy the header files config.h and irq.h and paste it in the project
folder where your „C’ files is located as already created.

11. Select LPC2378>Rebuild all menu, for checking any error in your
‘C’ file. If your „C„file has no error the following window will be
displayed.
12. Select LPC2378 >Options menu

13. Select Linker Category. Enable output option file and give
Filename. hex Eg: LPC2378.hex.
14. Enable Other Menu and select Intelextented option.

15. Select Config Menu. Enable Overide default option and click
Browse button for choosing a LPC2378-Flash-XCL file.
Path: C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kick
Start\Arm\Examples\NxP\LPC23XX\IAR\LPC2378\SK\simple\commo
n\XCL\LPC2378 FlashXCL and click OK button.
16. Select General options category. Enable target option file and
select the device as NXP LPC2378 and click ok.

17. Select LPC2378>Rebuild all menu, for checking any error in your
‘C’ file.
18. If your project has no error, Building completed and Hex file
generated.

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.
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

6
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 8-
bit 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 .

8
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.

9
Result:

Thus the evaluation of ARM7 – 2378 development board was studied.

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: 2
EXPT:2
Date FLASHING OF LEDS

Aim

To perform the flashing of LED‘s 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 Pin‘s 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
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
‗C‗file 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:

The C-Language program for interfacing LED and the flashing output was verified on
the LPC2378 development board.

16
Program: Interfacing of DAC with ARM

#include <iolpc2378.h>
#include "irq.h"
#include "config.h"
#include "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: 3 INTERFACING OF ADC & DAC
Date :

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:
Analog output in Winx talk Software:

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,t100,t10,t1,temp;


t1000 = ch / 1000;
temp = ch % 1000;
t100 = temp / 100;
temp = temp % 100;
t10 = temp / 10;
t1 = temp % 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; //AD0.0 AS ANALALOG INPUT
PINSEL0 = 0x00000050; // 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
‗C‗file 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:

The C-Language program for displaying the analog to digital output was verified on the
win x talk software. The C-Language program for displaying digital to analog output is verified
in the CRO.

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: 4 INTERFACING OF KEYBOARD WITH ARM
Date :

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
‗C‗file 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:

The C-Language program for displaying the Key pressed in the Keyboard is displayed in
the screen and the output was verified on the win x talk software.

30
Program: Interfacing of LCD with ARM
#include <iolpc2378.h>
#include<stdio.h>

#define LCD_EN 0X00800000 // LCD_EN -> P3.23


#define RS 0X00200000 // RS -> P0.21
#define DIOW 0X10000000 // DIOW -> P1.28
#define CS1 0x00008000 // CS1 -> P0.15
#define CS2 0x00010000 // CS2 -> P0.16

unsigned int const mail[1024] = {


255,255,255, 63,255,255,255,255, 63,255,255,127,191,191,191,191,
255,255,127,191,191,127,127,255,255,255,255,191, 7,187,187,251,
191,191,191,127,255,255,255, 63,191,191,191,191,127,191,191,191,
191,127,255, 59,255,255, 3,255,255, 59,255,255,255,255,191,191,
191,127,255,255,127,127,191,255,255,255,255,255,127,191,191,191,
191, 63,255,255,255,127,191,255, 63,191,191,191,191,127,191,191,
191,191,127,255, 3,191,191,191,127,255,255,255,127,191,191,191,
127,255,255,255, 3,255,255,127,191,191,191,191,255,255,255,255,
255,255,255,240,239,239,239,239,224,255,255,246,237,237,243,255,
255,240,237,237,237,237,244,253,255,255,255,255,224,255,255,243,
237,238,238,224,255,255,255,224,255,255,255,255,224,255,255,255,
255,224,255,224,255,255,224,255,255,224,255,255,255,243,237,238,
238,224,255,255,224,255,255,255,255,255,255,255,246,237,237,243,
255,126, 57,199,249,254,255,255,224,255,255,255,255,224,255,255,
255,255,224,255,224,239,239,239,247,248,255,255,240,239,239,239,
247,248,255,255,224,255,255,246,237,237,243,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,191, 31,
15, 15,159,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255, 15, 7, 7, 15,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 31, 95,223,223,223,223,223,223,223,223,223,223,223,223,223,
223,223,223,223,223, 95, 31,255,255,255,255,255,255,255,255,255,
255,255,255,255,255, 63, 31,143,207,199, 7, 3, 3, 1, 1, 3,
6,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,207, 7, 3,
3, 3, 7,199,255,255,255,255,255,255,255,255,255,255,255,255,
255, 0,255,254,253,251,119, 47,159,191,191,191,191,191,191,159,
47,119,251,253,254,255, 0,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,224,224,255,255, 3, 0, 0, 0, 0, 56,254,
252,248,249,241,243,227,231,231,255,255,255,255,255,255,255,255,
255,255,255,127, 63, 63, 31, 15, 15, 7, 7, 3, 0, 0, 0, 0,
1, 3, 7, 7, 15, 15, 31, 63, 63,127,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,127,255, 0, 0,
0, 63, 63, 63, 63, 63, 63, 63, 63,255,255,255,255,255,255,255,
255,224,231,227,233,236,238,239,239,239,239,239,239,239,239,239,
239,238,236,233,227,231,224,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255, 63, 7, 0,128,224,248,252,248,224, 0,
1, 7, 63,255,255,255,255,255,255,255,255,255,143,135,131,193,
193,192,224,224,224,240,240,240,248,248,248,252, 0, 0, 0, 0,
252,252,248,248,248,240,240,240,224,224,224,192,193,193,131,135,

31
Exp.No:5 INTERFACING OF LCD WITH ARM
Date :

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
143,255,255,255,255,255,127, 15, 3,227,249,248,252,255,224,224,
224,230,230,230,230,230,230,230,230,231,231, 7, 7, 15,127,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,239,225,224,248,254,255,255,255,255,255,255,255,
248,224,224,227,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,127,127, 63, 31, 0, 0,128, 0,
15, 31, 63,127,127,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,252,224,193, 7, 15, 63,127,127,255,255,
255,255,255,255,255,255,255,127, 63, 31, 15,143,248,192, 0, 3,
31,159,159,143,207,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,252,252,254,254,255,255,255,255,
255,254,254,252,252,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,254,254,254,252,252,252,
249,249,249,249,248,248,252,252,252,254,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
};
void busy_check()
{
IO0CLR = RS;
IO1CLR = DIOW;
}

void writedata(unsigned int ch5)


{
busy_check();
IO0SET = RS;
IO0CLR = DIOW;
FIO3PIN =ch5;
FIO3SET = LCD_EN;
FIO3CLR = LCD_EN;
}

void write_house1(unsigned int col)


{
int i;
IO0SET = CS2; //PAGE 2 IS SELECTED
IO0CLR = CS1; //PAGE 1 IS CLEARED
for(i=col;i<(64 +col);i++)
writedata(mail[i]);
}

void write_house(unsigned int col)


{
int i;
IO0SET = CS1; //PAGE 1 IS SELECTED
IO0CLR = CS2; //PAGE 1 IS CLEARED
for(i=col;i<(64+col);i++)
writedata(mail[i]);
}

void writecmd(unsigned int G_lcd)


{
busy_check();
IO0CLR = RS; // RS (P1.21)->clear.

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: LCD.C) and click Save Button.
9. Right Click the project name option for select a ‗C‘ file in
workspace window. Select Add >Add (LCD.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your ‗C‘ file. If your
‗C‗file 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
IO0SET = CS1 | CS2; // CS1 AND CS2(P1.23 and P1.24) are enabled.
FIO3PIN = G_lcd;
FIO3SET = LCD_EN; // E->SET.
FIO3CLR = LCD_EN; // E->CLR.
}
void pageclear()
{
int i,y;
IO0SET = CS1 | CS2 ; // CS1 AND CS2(P1.23 and P1.24) are
enabled.
for(i=0xb8;i<0xc0;i++)
{
writecmd(i); // Select Pages.
writecmd(0x40);
for (y=0;y<64;y++)
writedata(0x0); // Clear data in the LCD.
}
}

void clear_display()
{
pageclear();
}

void glcd_init()
{
writecmd(0x3e); // 0x3E turn it Off.
writecmd(0x3f); // 0x3F Display ON.
writecmd(0xc0); // displayed at the top of the screen. Here
it is line 0.
writecmd(0xb8); //
}

void main ()
{
int page,dat;

PINSEL0=0x00000000;
PINSEL1=0x00000000;
PINSEL3=0x00000000;
IO0DIR =0xFFFFFFFF;
IO1DIR =0xFFFFFFFF;
FIO3DIR =0xFFFFFFFF;

glcd_init(); // GLCD initialization


clear_display();

for(page =0;page< 8;page++)


{
dat = page * 128 ;
writecmd(0xB8+page);
writecmd(0x40);
write_house(dat); // write_house(0x01000000,dat);
writecmd(0xB8+page);
writecmd(0x40);
write_house1(dat + 64); // write_house1(0x00800000,dat + 64);
}
while(1);
}

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:

The C-Language program for displaying the image is displayed in the screen and the
output was verified.

36
Program: Interfacing of EEPROM & Interrupt
#include<iolpc2378.h>
#include "irq.h"
#include "config.h"
int i,temp,Temp1;
int i2c0,i2c1,i2c2,l;

unsigned char i2c_data[] =


{0x00,0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67};

static void delay(void )


{
volatile int i,j;
for (i=0;i<5;i++)
for (j=0;j<50;j++);
}

static void delay1(void )


{
volatile int i,j;
for (i=0;i<100;i++)
for (j=0;j<500;j++);
}

unsigned char receive_serial_data()


{
unsigned char serial;
while((U0LSR & 0x01)==0);
serial=U0RBR;
return(serial);
}

void send_serial_data(unsigned char serial)


{
while((U0LSR & 0x20)==0);
U0THR = serial;
}

void display_data(char temp)


{
i2c0=temp/100;
send_serial_data(i2c0+0x30);
i2c1=temp%100;
i2c2=i2c1/10;
send_serial_data(i2c2+0x30);
i2c1=i2c1%10;
send_serial_data(i2c1+0x30);
send_serial_data(0x0d);
send_serial_data(0x0A);
}

void display_address(unsigned long int val)


{

unsigned int adc1000,i;

i=100000;

37
Exp.No: 6
Date : INTERFACING OF EEPROM & INTERUPT

Aim

To develop a C-Language program to write and read a data in EEPROM and also to
analyze its performance with the interrupt

Components Required:

1. LPC 2378 ARM Development board

2. IAR Embedded Workbench 6.5

3. Flash Magic ISP Utility

Theory:

I2C (Inter Integrated Circuit):

Serial-interface EEPROM‘s are used in a broad spectrum of consumer, automotive,


telecommunication, medical, industrial and PC related markets. Primarily used to store personal
preference data and configuration/setup data, Serial EEPROM‘s are the most flexible type of
nonvolatile memory utilized today. Compared to other NVM solutions, Serial EEPROM
devices offer a lower pin count, smaller packages, lower voltages, as well as lower power
consumption. 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

38
do
{
adc1000=val/i;
send_serial_data(adc1000+0x30);
val=val%i;
i=i/10;
}while(i!=0x00);
send_serial_data(' ');
send_serial_data('-');
send_serial_data('-');
send_serial_data('-');
send_serial_data('>');
}

void i2c_write(unsigned int i2c_data)


{

//START CONDITION
I2C0CONSET=0x60; //0x60 change //start I2C data
transmission when set STA flag.
delay();
temp=I2C0STAT;
while(temp!=0x08)
temp=I2C0STAT;

//SLAVE ADDRESS
I2C0DAT=0xA6;
I2C0CONCLR=0x28;
temp=I2C0STAT;
delay();
while(temp!=0x18)
{
temp=I2C0STAT;
delay();
}
//HIGHER ORDER ADDRESS
I2C0DAT=0x00;
// I2C0DAT=0xff;
I2C0CONCLR=0x08;
temp=I2C0STAT;
while(temp!=0x28)
{
temp=I2C0STAT;//& 0x28;
delay();
}
delay1();
//LOWER ORDER ADDRESS

I2C0DAT=0x10;
I2C0CONCLR=0x08;
temp=I2C0STAT;
while(temp!=0x28)

{
temp=I2C0STAT;//& 0x28;
delay();
}

39
Interfacing I2C - EEPROM

Fig shows how to interface the EEPROM with microcontroller through I2C. I2C is a
Master-Slave protocol. I2C has a clock pulse along with the data. Normally, the master device
controls the clock line, SCL. This line dictates the timing of all transfers on the I2C bus. No data
will be transferred unless the clock is manipulated

. All slaves are controlled by the same clock, SCL. I2c bus supports many devices, each
device is recognized by a unique address—whether it‘s a micro-controller, LCD Driver,
memory or keyboard interface and can operate as transmitter or receiver based on the
functioning of the device. The controller designed controls the EEPROM device through I 2C
protocol. The I2C Controller here acts as a master device and controls EEPROM which acts as a
slave. The read-write operations are accomplished by sending a set of control signals including
the address and/or data bits. The control signals must be accompanied with proper clock signals.

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

40
//EEPROM DATA
I2C0DAT=0xAA;
I2C0CONCLR=0x08;
temp=I2C0STAT;

while(temp!=0x28)
{
temp=I2C0STAT;//& 0x28;
delay();
}

//STOP CONDITION
I2C0CONSET=0x10;
I2C0CONCLR=0x8;
delay1();
}
void i2c_read()
{

//START CONDITION
I2C0CONSET=0x60; //start I2C data transmission
when set STA flag.
delay();
temp=I2C0STAT;
while(temp!=0x08)
temp=I2C0STAT;
//SLAVE ADDRESS
I2C0DAT=0xA6;
I2C0CONCLR=0x28;
temp=I2C0STAT;
delay();
while(temp!=0x18)
temp=I2C0STAT;
delay();

//HIGHER ORDER ADDRESS

I2C0DAT=0x00;
I2C0CONCLR=0x8;
temp=I2C0STAT;
while(temp!=0x28)
temp=I2C0STAT;//& 0x28;
delay();
delay1();
//LOW ORDER ADDRESS

I2C0DAT=0x00;
I2C0CONCLR=0x08;
temp=I2C0STAT;
while(temp!=0x28)
temp=I2C0STAT;//& 0x28;
delay();

41
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: EEPROM.C) and click Save Button.
9. Right Click the project name option for select a ‗C‘ file in
workspace window. Select Add >Add (EEPROM.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your ‗C‘ file. If your
‗C‗file 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

42
//STOP CONDITION

I2C0CONSET=0x10;
I2C0CONCLR=0x08;
delay();
I2C0CONSET=0x10;
I2C0CONCLR=0x08;

//RESTART CONDITION

I2C0CONSET=0x60; //start I2C data transmission when set


STA flag.
delay();

temp=I2C0STAT;

while(temp!=0x08)
temp=I2C0STAT; //0x28 0x08

//Slave address with Read Mode

I2C0DAT=0xa7;
I2C0CONCLR=0x2C;
temp=I2C0STAT;

while(temp!=0x40)
temp=I2C0STAT ;

I2C0CONSET = 0X04;
I2C0CONCLR = 0X08;

//READ
while(1){
I2C0CONCLR=0x08;
temp=I2C0STAT;
while(temp!=0x50)
temp=I2C0STAT;

delay();
temp=I2C0DAT;
display_address(0x000 + l++);
display_data(temp);

//send_serial_data(Temp1+0x30);
I2C0CONCLR = 0X0C;

I2C0CONSET = 0X04;
I2C0CONCLR = 0X08;

}
43
Procedure to see OUTPUT:
1. Compile, Debug & Simulate the above code in IAR.

2. Connect the RS232 cable /USB cable provided to the PC / Laptop and the LPC2378
Development Board,

3. For seeing the output in real-time, select the PROG mode, reset the board and download
the code in VSK-2378 board using Flash Magic through UART0.

4. Now change the Mode-Selection-Switch to EXEC position and reset the board.

5. Open Win X – Talk and select the COM port and the Desired Baud rate as 9600.

6. The main function will execute continuously. The Timer Interrupt function will execute
for every 1 second.

7. For every 1 second the Interrupt data will be printed in the PC

44
//STOP CONDITION

I2C0CONSET=0x10;
I2C0CONCLR=0x8;
delay();

void main()
{
unsigned int Fdiv;
TargetResetInit();
PCONP |= (1 << 12);
PINSEL1 = 0X00004000; //AD0.0 AS ANALALOG INPUT
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.
PLLCON=0x00;
PINSEL1=0x01400000; //SDA0,SCL0.
I2C0CONCLR=0x6C; //clear I2C0CONCLR register
I2C0CONSET=0x40; //Enable I2C.
I2C0SCLH=110;
I2C0SCLL=90;
i2c_write(0x00);
i2c_write(0x00);
i2c_write(0x00);
while(1){
i2c_read();
}
}

45
RESULT:

Thus C-Language program to write and read a data in EEPROM and also to analyzed its
performance with the interrupt

46
Program: Interfacing of RTC and Serial Port

#include<iolpc2378.h>
#include"..\header\all.h"

unsigned int page,dat;


int Temp,xx=0,xxs=0;
unsigned char rtc_data[5],aa,bb,cc,a1,a2,a3,a4,a5,a6;
int i2c0,k;
extern int arr[8];

void delayv()
{
unsigned int i,j;
for(i=0;i<0xaff;i++)
for(j=0;j<0xff;j++);
}

void i2c_write(unsigned int addr,unsigned int data)


{

//START CONDITION
I2C0CONSET=0x60; //start I2C data
transmission when set STA flag.
delay();
Temp=I2C0STAT;
while(Temp!=0x08)
Temp=I2C0STAT;
/SLAVE ADDRESS

I2C0DAT=0xA0;
I2C0CONCLR=0x28;
delay();
Temp=I2C0STAT;

while(Temp!=0x18)
{
Temp=I2C0STAT;
delay();
}

//HIGHER ORDER ADDRESS


I2C0DAT=addr;
// I2C0DAT=0xff;
I2C0CONCLR=0x8;
Temp=I2C0STAT;
while(Temp!=0x28)
{
Temp=I2C0STAT;//& 0x28;
47
Exp.No: 7
Date : INTERFACING OF RTC & SERIAL PORT

Aim

To develop a C-Language program to interface the real time clock with ARM controller
using serial port.

Components Required:

1. LPC 2378 ARM Development board

2. IAR Embedded Workbench 6.5

3. Flash Magic ISP Utility

Theory:

RTC (Real Time Clock):

The DS1307 Serial Real-Time Clock is a low-power; full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially via a 2-
wire, bi-directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month,
and year information. The end of the month date is automatically adjusted for months with
fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour
or 12-hour format with AM/PM indicator.

Interfacing I2C - RTC:

Fig. shows how to interface the RTC with microcontroller through I2C. I2C is a Master-
Slave protocol. I2C has a clock pulse along with the data. The master device controls the clock
line, SCL. This line dictates the timing of all transfers on the I2C bus. No data will be
transferred unless the clock is manipulated. I2c bus supports many devices, each device is
recognized by a unique address—whether it‘s a micro-controller, LCD Driver, memory or
keyboard interface and can operate as transmitter or receiver based on the functioning of the
device.

48
delay();
}
delay();

//LOWER ORDER ADDRESS

I2C0DAT=data;
I2C0CONCLR=0x8;
Temp=I2C0STAT;
while(Temp!=0x28)
{
Temp=I2C0STAT;//& 0x28;
delay();
}

//STOP CONDITION
I2C0CONSET=0x10;
I2C0CONCLR=0x8;
delay();

void i2c_read(unsigned int addr)


{

I2C0CONSET=0x10;
I2C0CONCLR=0x8;
delay();
//START CONDITION
I2C0CONSET=0x60; //start I2C data
transmission when set STA flag.
delay();
Temp=I2C0STAT;
while(Temp!=0x08){
Temp=I2C0STAT;//&0x08;
//printf("\n\r Temp");
}

//SLAVE ADDRESS

I2C0DAT=0xA0;
I2C0CONCLR=0x28;
Temp=I2C0STAT;
delay();
while(Temp!=0x18){
Temp=I2C0STAT;//&0x18;
delay();
//printf("\n\r Temp1");
}

49
The controller designed controls the RTC ds1307 device through I2C protocol. The I2C
Controller here acts as a master device and controls RTC ds1307 which acts as a slave. The read
operation is accomplished by sending a set of control signals including the address and/or data
bits. The control signals must be accompanied with proper clock signals.
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

50
//HIGHER ORDER ADDRESS

I2C0DAT=addr;
I2C0CONCLR=0x8;
Temp=I2C0STAT;
while(Temp!=0x28){
Temp=I2C0STAT;//& 0x28;
delay();

//STOP CONDITION

I2C0CONSET=0x10;
I2C0CONCLR=0x8;
delay();

//RESTART CONDITION

I2C0CONSET=0x60; //start I2C data


transmission when set STA flag.
delay();
Temp=I2C0STAT;
while(Temp!=0x08)
{
Temp=I2C0STAT;
}

//Slave address with Read Mode


I2C0DAT=0xa1;
I2C0CONCLR=0x2C;
Temp=I2C0STAT;
while(Temp!=0x40)
{
Temp=I2C0STAT ;
}

I2C0CONSET = 0X04;
I2C0CONCLR = 0X08;

//READ
//while(1){
for(int i=0;i<0x03;i++)
{
I2C0CONCLR=0x08;

51
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: RTC.C) and click Save Button.
9. Right Click the project name option for select a ‗C‘ file in
workspace window. Select Add >Add (RTC.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your ‗C‘ file. If your
‗C‗file 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

52
Temp=I2C0STAT;
while(Temp!=0x50)
Temp=I2C0STAT;

delay();
rtc_data[i]=I2C0DAT;
//printf("\n\r Eeprom Data %x",Temp1);

I2C0CONCLR = 0X0C;

I2C0CONSET = 0X04;
I2C0CONCLR = 0X08;
}

//STOP CONDITION

I2C0CONSET=0x10;
I2C0CONCLR=0x8;
delay();

//return(rtc_dat);

}
void send(unsigned char Temp1,int v,int xx)
{
k=k+1;
i2c0=Temp1 & 0xf0;
i2c0=i2c0>>4;
i2c0=i2c0+0x30;

send_serial_data(i2c0);

display(0xbd,v,i2c0);
display1(0xbe,v,i2c0);

i2c0=Temp1 & 0x0f;


i2c0=i2c0+0x30;
send_serial_data(i2c0);
if(k==2)
{
IO0SET = CS2;
IO0CLR = CS1;
}
display(0xbd,xx,i2c0);
display1(0xbe,xx,i2c0);

53
54
}

void add()
{
a1=(arr[1]-0x30);
a1=a1<<4;
a2=(arr[0]-0x30);
aa=a1+a2;

a3=(arr[3]-0x30);
a3=a3<<4;
a4=(arr[2]-0x30);
bb=a3+a4;

a5=(arr[5]-0x30);
a5=a5<<4;
a6=(arr[4]-0x30);
cc=a5+a6;

}
void rtc()
{
delayv();
delayv();
intlcd();
pageclear1();

unsigned int page,dat;

for(page =0;page<8;page++)
{

dat = page * 128 ;


writecmd(0xB8+page);
writecmd(0x40);
clock1(0x00008000,dat);
//write_house(0x10000000,dat);

writecmd(0xB8+page);
writecmd(0x40);
clock2(0x00008000,dat+64);
//write_house1(0x80000000,dat + 64);
}

// while(1);
/*

55
56
IO0SET = CS1; // PAGE 1 IS SELECGTED.
IO0CLR = CS2;
for(page =0;page<8;page++)
{

IO0SET = CS1; // PAGE 1 IS


SELECGTED.
IO0CLR = CS2;

dat = page * 128 ;


writecmd(0xB8+page);
writecmd(0x40);
clock1(0x00008000,dat);

IO0SET = CS2; // PAGE 1 IS SELECGTED.


IO0CLR = CS1;

writecmd(0xB8+page);
writecmd(0x40);
clock2(0x00010000,dat + 64);
}
*/
clearpage();

// while(1);
PINSEL1|=0x01400000; //SDA0,SCL0.

I2C0CONCLR=0x6C; //clear I2C0CONCLR register


I2C0CONSET=0x40; //Enable I2C.
I2C0SCLH=110;
I2C0SCLL=90;

read_key1();
add();

i2c_write(0x02,cc);
delay();
i2c_write(0x03,bb);
delay();
i2c_write(0x04,aa);
delay();
PINSEL0 |=0X00000000;
IO0DIR |=0X00000000;

while(1)
{
xx=0;xxs=0;

57
58
IO0SET = CS1;
IO0CLR = CS2 ;

i2c_read(0x02);

send(rtc_data[2],0x50,0x5c); //12
send_serial_data('\t');

send(rtc_data[1],0x74,0x40); //57

send_serial_data('\t');
send(rtc_data[0],0x58,0x64); //30

k=0;
send_serial_data(0x0d);
send_serial_data(0x0A);

if((IO0PIN&0x20000000)!=0x20000000)
break;
}
clear_display();
option_pic();

59
RESULT:

The C-Language program for interfacing the real time clock with serial port and the
output was verified using Win X talk software.

60
Program: Interfacing of Stepper motor in Forward direction

#include <iolpc2378.h>
#include "irq.h"
#include "config.h"
unsigned int k;
unsigned int dat[] = {0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void delay()
{
unsigned int i,j;
for(i=0;i<0xff;i++)
for(j=0;j<0xff;j++);
}
/**************************************************************************
** Main Function main()
*************************************************************************/
int main (void)
{
TargetResetInit();

// FIO4PIN = 0X0;
// FIO4DIR = 0XFFFFFFFF;
IO0DIR = 0XFFFFFFFF;

while(1)
{
for(k=0;k<10;k++)
{

IO0SET = 0X00000240;
delay();
IO0CLR = 0X00000240;
IO0SET = 0X00000140;
delay();
IO0CLR = 0X00000140;
IO0SET = 0X00000180;

delay();
IO0CLR = 0X00000180;
IO0SET = 0X00000280;
delay();
IO0CLR = 0X00000280;

}
} }

61
Exp.No: 8
Date : INTERFACING OF STEPPER MOTOR (Forward Direction)

Aim

To develop a C-Language program to interface the stepper motor with ARM controller
and also to analyze its performance of rotation in forward direction.

Components Required:

1. LPC 2378 ARM Development board

2. IAR Embedded Workbench 6.5

3. Flash Magic ISP Utility

Theory:

Stepper Motor:

A stepper motor is a brushless, synchronous electric motor that converts digital pulses
into mechanical shaft rotation. Every revolution of the stepper motor is divided into a discrete
number of steps, and the motor must be sent a separate pulse for each step.

Interfacing Stepper Motor:

62
63
Fig. shows how to interface the Stepper Motor to microcontroller. As you can see the
stepper motor is connected with Microcontroller output port pins through a ULN2803A array.
So when the microcontroller is giving pulses with particular frequency to ULN2803A, the
motor is rotated in clockwise or anticlockwise.

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: STEPPER.C) and click Save Button.
9. Right Click the project name option for select a ‗C‘ file in
workspace window. Select Add >Add (STEPPER.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your ‗C‘ file. If your
‗C‗file 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

64
65
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:

The C-Language program for interfacing the stepper motor and running in clockwise
direction output was verified

66
Program: Interfacing of Stepper motor in Reverse direction

#include <iolpc2378.h>
#include "irq.h"
#include "config.h"
unsigned int k;
unsigned int dat[] = {0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void delay()
{
unsigned int i,j;
for(i=0;i<0xff;i++)
for(j=0;j<0xff;j++);
}
/*************************************************************************
** Main Function main()
*************************************************************************/
int main (void)
{
TargetResetInit();

// FIO4PIN = 0X0;
// FIO4DIR = 0XFFFFFFFF;
IO0DIR = 0XFFFFFFFF;

while(1)
{
for(k=0;k<10;k++)
{

IO0SET = 0X00000280;
delay();
IO0CLR = 0X00000280;
IO0SET = 0X00000180;
delay();
IO0CLR = 0X00000180;
IO0SET = 0X00000140;

delay();
IO0CLR = 0X00000140;
IO0SET = 0X00000240;
delay();
IO0CLR = 0X00000240;

}
} }

67
Exp.No: 9
Date : INTERFACING OF STEPPER MOTOR (Reverse Direction)

Aim

To develop a C-Language program to interface the stepper motor with ARM controller
and also to analyze its performance of rotation in forward direction.

Components Required:

1. LPC 2378 ARM Development board

2. IAR Embedded Workbench 6.5

3. Flash Magic ISP Utility

Theory:

Stepper Motor:

A stepper motor is a brushless, synchronous electric motor that converts digital pulses
into mechanical shaft rotation. Every revolution of the stepper motor is divided into a discrete
number of steps, and the motor must be sent a separate pulse for each step.

Interfacing Stepper Motor:

68
69
Fig. shows how to interface the Stepper Motor to microcontroller. As you can see the
stepper motor is connected with Microcontroller output port pins through a ULN2803A array.
So when the microcontroller is giving pulses with particular frequency to ULN2803A, the
motor is rotated in clockwise or anticlockwise.

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: STEPPER.C) and click Save Button.
9. Right Click the project name option for select a ‗C‘ file in
workspace window. Select Add >Add (STEPPER.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your ‗C‘ file. If your
‗C‗file 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

70
71
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:

The C-Language program for interfacing the stepper motor and running in reverse
direction output was verified

72
Program: Interfacing of LED with Seven Segment Display
#include<iolpc2378.h>
#define DESIRED_BAUDRATE 19200
#define CRYSTAL_FREQUENCY_IN_HZ 12000000
#define PCLK CRYSTAL_FREQUENCY_IN_HZ
#define DIVISOR (PCLK/(16*DESIRED_BAUDRATE))

unsigned char status;

void start(void)
{
I2C0CONSET=0X20;
status=I2C0STAT;
while(status!=0x08)
{
status=I2C0STAT;
}
}
void device_init(char add)
{
I2C0DAT=add;
I2C0CONCLR=0x28;
status=I2C0STAT;
while(status!=0x18)
{
status=I2C0STAT;
}

}
void data_write(char dat)
{
I2C0DAT=dat;
I2C0CONCLR=0x08;
status=I2C0STAT;
while(status!=0x28)
status=I2C0STAT;
}

void stop(void)
{
I2C0CONSET=0x10;
I2C0CONCLR=0x08;
}

unsigned char decimal_data[11]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};

void delay()
{
for(int j=0x00;j<=0xff;j++)
for(int k=0x00;k<=0xff;k++);
}

void main()
{
PLLCON=0x00;
PINSEL1=0x01400000; //SDA0,SCL0.

73
Exp.No: 10
EXPT:2
Date INTERFACING OF LED WITH SEVEN SEGMENT DISPLAY

Aim
To develop a C-Language program to interface the LED with seven segment display in
ARM LPC2378 controller.
Components Required:

1. LPC 2378 ARM Development board


2. IAR Embedded Workbench 6.5
3. Flash Magic ISP Utility
Theory

Seven Segment Display:

Seven segment display (SSD) is a form of electronic display device for


displaying decimal numerals that is an alternative to the more complex dot matrix displays.
Seven segment display consists of seven LEDs (hence its name) arranged in a rectangular
fashion. Each of the seven LEDs is called a segment because when illuminated the segment
forms part of a numerical digit (both Decimal and Hex) to be displayed.
Each one of the seven LEDs in the display is given a positional segment with one of its
connection pins being brought straight out of the rectangular plastic package. These
individually LED pins are labeled from a through to g representing each individual LED. The
other LED pins are connected together and wired to form common pin.

So by forward biasing the appropriate pins of the LED segments in a particular order,
some segments will be light and others will be dark allowing the desired character pattern of the
number to be generated on the display.

74
I2C0CONCLR=0x6C;
I2C0CONSET=0x40; //Enable I2C.
I2C0SCLH=110;
I2C0SCLL=90;
while(1)
{
for(int i=0;i<=9;i++)
{
start();
device_init(0x40);
data_write(decimal_data[i]);
stop();
delay();
}
}
}

75
Interfacing Seven Segment LED Display:
Fig. shows how to interface the seven segments with microcontroller. A seven segment
is generally available in ten pin package. While eight pins correspond to the eight LEDs, the
remaining two pins (at middle) are common and internally shorted. These segments come two
configurations, namely, Common cathode (CC) and Common anode (CA).

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.
76
77
8. New>File Menu, for creating a new ‗C ‗file. File>Save As, for saving a file. Give your
File name ( Eg: SSLED.C) and click Save Button.
9. Right Click the project name option for select a ‗C‘ file in
workspace window. Select Add >Add (SSLED.C) Menu.
10. Select LPC2378>Rebuild all menu, for checking any error in your ‗C‘ file. If your
‗C‗file 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

RESULT:

The C-Language program for interfacing the seven segment LED display was verified on
the LPC2378 development board.

78

You might also like