0% found this document useful (0 votes)
11 views

exp4 aman ARM

exp4 aman ARM
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)
11 views

exp4 aman ARM

exp4 aman ARM
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/ 2

EXPERIMENT – 4

FLASH LEDS USING PARALLEL GPIO PORT

Aim: To write an embedded C Program using LPC2148 ARM processor to flash LEDS using a

parallel GPIO port.

Software Used: Keil µVision 4.0

Target Microcontroller: ARM LPC2148

Algorithm:

Ø Initialise the IODIR, IOSET and IOCLR registers.

Ø Set the delay.

Ø Initialize GPIO pins for output.

Ø Check the output in the GPIO interface window.

Program:
//RA2111004010146
#include <LPC21xx.H>
void wait (void) {
int d;
for (d=0; d< 1000000; d++);
}
int main (void) {
unsigned int i;
IODIR1= 0xFFFF0000;
while (1) {
for (i= 1<<16; i < 1<<31; i <<= 1) {
IOSET1 = i;
wait ();
IOCLR1 = i;
}
for (i = 1<<31; 1<<16; i >>=1) {
IOSET1 = i;
wait ();
IOCLR1 =i;
}
}
}
Simulation Output:

Pre Lab Questions:

1. Mention the use of the utility Digitalout ().

2. What is the significance of using while (1) in most of the programs?

3. Give two examples of conditional loop statements.

4. What is the size of a character, integer, integer pointer, or character pointer?

5. What is typecasting?

Post Lab Questions:

1. Write an embedded C code to count a sequence of 4 bits using GPIO and LED 1-4.

2. Explain the output of the partial code while(i>0) {//start conditional loop yourled = 1; wait

(0.2); yourled = 0; wait (0.2); i = i-1;}

3. State the significance of “=” and “= =” operators in embedded.

Result: Implemented embedded C Program Using LPC2148 ARM processor to flash LEDS using

parallel GPIO port.

You might also like