0% found this document useful (0 votes)
3 views17 pages

EE3408 Embedded Processor Lab Manual

The document is a lab manual for the EE3408 Embedded Processor Laboratory course at Muthayammal Educational Institutions for the academic year 2023-2024. It outlines a series of experiments involving interfacing various components such as DAC, PWM generator, Timer, and RTC with the LPC 2148 ARM microcontroller, including the necessary apparatus, procedures, and example programs. Each experiment aims to develop and verify the interfacing of these components using the Keil µVision3 IDE.

Uploaded by

suganyamurali02
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)
3 views17 pages

EE3408 Embedded Processor Lab Manual

The document is a lab manual for the EE3408 Embedded Processor Laboratory course at Muthayammal Educational Institutions for the academic year 2023-2024. It outlines a series of experiments involving interfacing various components such as DAC, PWM generator, Timer, and RTC with the LPC 2148 ARM microcontroller, including the necessary apparatus, procedures, and example programs. Each experiment aims to develop and verify the interfacing of these components using the Keil µVision3 IDE.

Uploaded by

suganyamurali02
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/ 17

DEPARTMENT OF ELECTRICAL AND ELECTRONICS

ENGINEERING

MUTHAYAMMAL
EDUCATIONAL
INSTITUTIONS

LAB MANUAL

EE3408 –EMBEDDED PROCESSOR LABORATORY

VI SEMESTER
(Academic Year – 2023-2024)

Prepared by Approved by
Mrs.S.Suganya M.E., Prof.Dr.C.Nagarajan M.Tech., Ph.D.,
AP/EEE HOD/EEE
ANNA UNIVERSITY, CHENNAI

EE3408 Embedded Processor lab


SYLLABUS

LIST OF EXPERIMENTS

1. Interfacing DAC.(Programming with IDE-ARM microcontroller)

2. Interfacing PWM Gener ator .

3. Interfacing Timer

4. RTC Interfacing with ARM using serial communication program (UART).

5. Interfacing stepper motor control


Ex. No:1 INTERFACING DAC (PROGRAMMING WITH IDE-ARM
Date: MICROCONTROLLER)

AIM:
To develop and verify the interfacing DAC with LPC 2148 ARM
microcontroller.

APPARATUS REQUIRED:

S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision3 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 4 icon on the desk top, it will
generate a window as shown below
Step 2: To create new project go to project select new micro vision

project. Step 3: select a drive where you would like to create your

project.

Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project
executable and save it.
Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some
window asking to add STARTUP. Select YES.
Step 9: A target is created and startup is added to your project
target and is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select
SAVE option from menu bar.
Step 12: By giving a name with extension .c and save

it. Step 13: Write the code of your project and save it.
Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.
Step 15: It will display some window there select the file
and click on ADD option.
Step 16: It will be added to our target and it shows in
the project window.
Step 17: Select right click on target in the project window and select
“Options for Target.”
Step 18: It will show some window, in that go to output option and
choose Create Hex option by selecting that box.
Step 20: Now to compile your project go to Project select Build
Target option or press F7.
Step 21: Check the concern block of output and observe the results.

Program:

#include<LPC214x.h>
void delay()
{
int i;
for(i=0;i<2000;i++);
}
void main()
{
int i,j;
PINSEL1=1<<19; // Enable DAC by selecting P0.25 as AOUT
DACR=0; // initial Digital value is 0
while(1)
{
for(i=0;i<1024;i++) // increments output from 0 to 1023
{
DACR=i<<6;
delay();
}
for(i=1023;i>=0;i--) // decrements output from 1023 to 0
{
DACR=i<<6;
delay();
}
}
}
Output

RESULT:

Thus the interfacing of DAC (In-built) with ARM processor has been
verified and observed the output successfully
Ex. No:2 Interfacing PWM Generator
Date:

AIM:
To develop and verify the interfacing PWM generator with LPC 2148 ARM
Microcontroller.

APPARATUS REQUIRED:

S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision3 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 4 icon on the desk top, it will
generate a window as shown below
Step 2: To create new project go to project select new micro vision

project. Step 3: select a drive where you would like to create your

project.

Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project
executable and save it.
Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some
window asking to add STARTUP. Select YES.
Step 9: A target is created and startup is added to your project
target and is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select
SAVE option from menu bar.
Step 12: By giving a name with extension .c and save

it. Step 13: Write the code of your project and save it.
Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.
Step 15: It will display some window there select the file
and click on ADD option.
Step 16: It will be added to our target and it shows in
the project window.
Step 17: Select right click on target in the project window and select
“Options for Target.”
Step 18: It will show some window, in that go to output option and
choose Create Hex option by selecting that box.
Step 20: Now to compile your project go to Project select Build
Target option or press F7.
Step 21: Check the concern block of output and observe the results.

Program:

#include <lpc214x.h>

__irq void PWM_ISR (void)


{
if ( PWMIR & 0x0001 ) /* If interrupt due to PWM0 */
{
PWMIR = 0x0001; /* Clear PWM0 interrupt */
}

if ( PWMIR & 0x0002 ) /* If interrupt due to PWM1 */


{
PWMIR = 0x0002; /* Clear PWM1 interrupt */
}

if ( PWMIR & 0x0004 ) /* If interrupt due to PWM2 */


{
PWMIR = 0x0004; /* Clear PWM2 interrupt */
}

if ( PWMIR & 0x0008 ) /* If interrupt due to PWM3 */


{
PWMIR = 0x0008; /* Clear PWM3 interrupt */
}
VICVectAddr = 0x00000000;
}

int main (void)


{
VPBDIV = 0x00000002;
PINSEL0 = PINSEL0 | 0x00008008; /* Configure P0.1 and P0.7 as PWM3 and PWM2 respectively */
VICVectAddr0 = (unsigned) PWM_ISR; /* PWM ISR Address */
VICVectCntl0 = (0x00000020 | 8); /* Enable PWM IRQ slot */
VICIntEnable = VICIntEnable | 0x00000100; /* Enable PWM interrupt */
VICIntSelect = VICIntSelect | 0x00000000; /* PWM configured as IRQ */

// For PWM3 double edge


PWMTCR = 0x02; /* Reset and disable counter for PWM */
PWMPR = 0x1D; /* Prescale value for 1usec, Pclk=30MHz*/
PWMMR0 = 100000; /* Time period of PWM wave, 100msec */
PWMMR2 = 40000; /* Rising edge of double edge controlled PWM */
PWMMR3 = 80000; /* Falling edge of double edge controlled PWM */
PWMMCR = 0x00000243; /* Reset and interrupt on MR0 match, interrupt on MR2 and MR3
match */
PWMLER = 0x0D; /* Latch enable for PWM3, PWM2 and PWM0 */
PWMPCR = 0x0C08; /* Enable PWM3, PWM2 and PWM0, double edge controlled PWM on PWM3
*/
PWMTCR = 0x09; /* Enable PWM and counter */

while (1);
}
Out put:

RESULT:
Thus the interfacing of PWM generator with ARM processor (LPC2148) was done by
using embedded program.
Ex. No:3 Interfacing Timer
Date:

AIM:
To develop and verify the interfacing Timer with LPC 2148 ARM
Microcontroller.

APPARATUS REQUIRED:

S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision3 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 4 icon on the desk top, it will
generate a window as shown below
Step 2: To create new project go to project select new micro vision

project. Step 3: select a drive where you would like to create your

project.

Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project
executable and save it.
Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some
window asking to add STARTUP. Select YES.
Step 9: A target is created and startup is added to your project
target and is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select
SAVE option from menu bar.
Step 12: By giving a name with extension .c and save

it. Step 13: Write the code of your project and save it.
Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.
Step 15: It will display some window there select the file
and click on ADD option.
Step 16: It will be added to our target and it shows in
the project window.
Step 17: Select right click on target in the project window and select
“Options for Target.”
Step 18: It will show some window, in that go to output option and
choose Create Hex option by selecting that box.
Step 20: Now to compile your project go to Project select Build
Target option or press F7.
Step 21: Check the concern block of output and observe the results.

Program
#include<lpc214x.h>
void pll() //Fosc=12Mhz,CCLK=60Mhz,PCLK=60MHz
{
PLL0CON=0X01;
PLL0CFG=0X24;
PLL0FEED=0XAA;
PLL0FEED=0X55;
while((PLL0STAT&(1<<10))==0);
PLL0CON=0X03;
PLL0FEED=0XAA;
PLL0FEED=0X55;
VPBDIV=0X01;
}
void wait()
{
T1CTCR=0X0000; //Timer Mode
T1PR=59999; //Prescaler Value
T1MR0=1000; //Match Register Value
T1MCR=0x00000004; //TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches the TC.
T1TCR=0X02; //Reset Timer
T1TCR=0X01; //Timer ON
while(T1TC!=T1MR0);
T1TC=0; //Timer OFF
}
int main(void)
{
IO0DIR=0xffffffff;
pll(); //Fosc=12Mhz,CCLK=60Mhz,PCLK=60MHz
while(1) {
IO0SET=0xffffffff;
wait();
IO0CLR=0xffffffff;
wait();
}
}

Output

RESULT:

Thus the interfacing of Timer (In-built) with ARM processor has been
verified and observed the output successfull
Ex. No:4 RTC Interfacing with ARM using serial communication program
Date: (UART).

AIM:
To develop and verify the interfacing with ARM using serial communication
program (UART) with LPC 2148

APPARATUS REQUIRED:

S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision3 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 4 icon on the desk top, it will
generate a window as shown below
Step 2: To create new project go to project select new micro vision

project. Step 3: select a drive where you would like to create your

project.

Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project
executable and save it.
Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some
window asking to add STARTUP. Select YES.
Step 9: A target is created and startup is added to your project
target and is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select
SAVE option from menu bar.
Step 12: By giving a name with extension .c and save

it. Step 13: Write the code of your project and save it.
Step 14: To add the c to target give a right click on Source Group,
choose “ADD s to Group” option.
Step 15: It will display some window there select the file
and click on ADD option.
Step 16: It will be added to our target and it shows in
the project window.
Step 17: Select right click on target in the project window and select
“Options for Target.”
Step 18: It will show some window, in that go to output option and
choose Create Hex option by selecting that box.
Step 20: Now to compile your project go to Project select Build
Target option or press F7.
Step 21: Check the concern block of output and observe the results.

Program:

#include <lpc214x.h>
void initClocks(void);
void initUART0(void);
void U0Write(char data);
void Send_String(char* StringPtr);
char String[]="Hello from EEE !!! \n\r\n";
unsigned int delay;
int main(void)
{
initClocks(); // Set CCLK=60Mhz and PCLK=60Mhz
initUART0();

while(1)
{
Send_String(String); //Pass the string to the USART_putstring function and sends it over the serial
for(delay=0; delay<500000; delay++); // delay
}
}
void initUART0(void)
{
PINSEL0 = 0x5; /* Select TxD for P0.0 and RxD for P0.1 */
U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit | DLAB set to 1 */
U0DLL = 110;
U0DLM = 1;
U0FDR = 0xF1; /* MULVAL=15(bits - 7:4) , DIVADDVAL=0(bits - 3:0)*/
U0LCR &= 0x0F; // Set DLAB=0 to lock MULVAL and DIVADDVAL
//BaudRate is now ~9600 and we are ready for UART communication!
}
void U0Write(char data)
{
while (!(U0LSR & (1<<5))); // wait till the THR is empty
// now we can write to the Tx FIFO
U0THR = data;
}
void initClocks(void)
{
PLL0CON = 0x01; //Enable PLL
PLL0CFG = 0x24; //Multiplier and divider setup
PLL0FEED = 0xAA; //Feed sequence
PLL0FEED = 0x55;

while(!(PLL0STAT & 0x00000400)); //is locked?

PLL0CON = 0x03; //Connect PLL after PLL is locked


PLL0FEED = 0xAA; //Feed sequence
PLL0FEED = 0x55;
VPBDIV = 0x01; // PCLK is same as CCLK i.e.60 MHz
}
void Send_String(char* StringPtr){

while(*StringPtr != 0x00){
U0Write(*StringPtr);
StringPtr++;}
}

Output:

RESULT:

Thus the R T C interfacing of serial communication (UART) ARM


processor has been verified and observed the output successful
Ex. No:5 Interfacing stepper motor control
Date:

AIM:
To develop and verify the interfacing of stepper motor control with LPC 2148
ARM Microcontroller.

APPARATUS REQUIRED:

S.No Apparatus Range Quantity

1 ARM Development Kit LPC 2148 1

2 Keil µVision3 IDE - 1

PROCEDURE:

Step 1: Give a double click on µvision 4 icon on the desk top, it will
generate a window as shown below
Step 2: To create new project go to project select new micro vision

project. Step 3: select a drive where you would like to create your

project.

Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project
executable and save it.
Step 6: After saving it will show some window there you select your
microcontroller company i.e. NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some
window asking to add STARTUP. Select YES.
Step 9: A target is created and startup is added to your project
target and is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select
SAVE option from menu bar.
Step 12: By giving a name with extension .c and save

it. Step 13: Write the code of your project and save it.
Step 14: To add the c to target give a right click on
Source Group, choose “ADD s to Group” option.
Step 15: It will display some window there select the
file and click on ADD option.
Step 16: It will be added to our target and it shows in
the project window.
Step 17: Select right click on target in the project window and
select “Options for Target.”
Step 18: It will show some window, in that go to output option
and choose Create Hex option by selecting that box.
Step 20: Now to compile your project go to Project select
Build Target option or press F7.
Step 21: Check the concern block of output and observe the results.

Program:

#include<LPC214x.h> // Define LPC2148 Header File


#include <stdio.h>
#define COIL_A 16
void motor_ccw(void);
void delay(int);
unsigned char STEP[] = {0x09, 0x08, 0x0C, 0x04, 0x06,
0x02, 0x03, 0x01};
void main(void)
{
unsigned char i = 0;
PINSEL2 &= 0xFFFFFFF3; // P1.16 - P1.31 as GPIO
IODIR1 = 0x000F0000; // P1.16 - P1.19 as Output
while(1)
{
IOCLR0 = 0xFF << COIL_A;
motor_ccw(); // Stepper Motor counter clockwise
}
}
void delay(int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<0x3FF0;j++) {;}
}
}
void motor_ccw(void)
{
unsigned int i=0;
while (STEP[i] != '\0')
{
IOSET1 = STEP[i] << COIL_A;
delay(1);
IOCLR1 = STEP[i] << COIL_A;
delay(1);
i++;
}
}

RESULT:
Thus, the interfacing of stepper motor with ARM DEVELOPMENT KIT
processor has been done and executed successful
.

You might also like