EE3408 Embedded Processor Lab Manual
EE3408 Embedded Processor Lab Manual
ENGINEERING
MUTHAYAMMAL
EDUCATIONAL
INSTITUTIONS
LAB MANUAL
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
LIST OF EXPERIMENTS
3. Interfacing Timer
AIM:
To develop and verify the interfacing DAC with LPC 2148 ARM
microcontroller.
APPARATUS REQUIRED:
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:
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>
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:
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:
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(*StringPtr != 0x00){
U0Write(*StringPtr);
StringPtr++;}
}
Output:
RESULT:
AIM:
To develop and verify the interfacing of stepper motor control with LPC 2148
ARM Microcontroller.
APPARATUS REQUIRED:
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:
RESULT:
Thus, the interfacing of stepper motor with ARM DEVELOPMENT KIT
processor has been done and executed successful
.