Anda di halaman 1dari 6

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

Anda mungkin juga menyukai