Professional Documents
Culture Documents
Embedded Design
Embedded Design
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
LED module
Software:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next.
Step 4: Select the required library file (SYSCON and GPIO) from the repository.
Step 7: Add the required library source file to the project (Right click on include Add file to group and
Step 10: Interface the required component and note down the output.
ADD FILES:
Repository :
Clibrary, CMSIS core , common header files, CMSIS boot, SYSCON, GPIO.
Source files:
No files to be added.
1
BLOCK DIAGRAM:
PROGRAM
#include "lpc13xx_syscon.h"
#include "lpc13xx_gpio.h"
void BlinkExp()
int i,j;
SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);
//IOCON_SetPinFunc(IOCON_PIO2_0, PIO2_0_FUN_PIO);
GPIO SetDir(PORT0,GPIO_Pin_7,1)
//Sdcard lines
while(1)
2
for(i=0; i<20; i++)
} }
GPIO_SetBits(PORT0, GPIO_Pin_7);
//Sdcard lines
GPIO_SetBits(PORT0, GPIO_Pin_8);
GPIO_SetBits(PORT0, GPIO_Pin_9);
GPIO_SetBits(PORT0, GPIO_Pin_2);
GPIO_SetBits(PORT2, GPIO_Pin_11);
GPIO_ResetBits(PORT0, GPIO_Pin_7);
//Sdcard lines
GPIO_ResetBits(PORT0, GPIO_Pin_8);
GPIO_ResetBits(PORT0, GPIO_Pin_9);
GPIO_ResetBits(PORT0, GPIO_Pin_2);
GPIO_ResetBits(PORT2, GPIO_Pin_11);
}}
int main(void)
BlinkExp();
3
B) FOR FINITE LOOP:
#include "lpc13xx_syscon.h"
#include "lpc13xx_gpio.h"
void BlinkExp()
int i,j,a=0;
SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);
//IOCON_SetPinFunc(IOCON_PIO2_0, PIO2_0_FUN_PIO);
//Sdcard lines
do
}}
GPIO_SetBits(PORT0, GPIO_Pin_7);
//Sdcard lines
GPIO_SetBits(PORT0, GPIO_Pin_8);
GPIO_SetBits(PORT0, GPIO_Pin_9);
GPIO_SetBits(PORT0, GPIO_Pin_2);
4
GPIO_SetBits(PORT2, GPIO_Pin_11);
GPIO_ResetBits(PORT0, GPIO_Pin_7);
//Sdcard lines
GPIO_ResetBits(PORT0, GPIO_Pin_8);
GPIO_ResetBits(PORT0, GPIO_Pin_9);
GPIO_ResetBits(PORT0, GPIO_Pin_2);
GPIO_ResetBits(PORT2, GPIO_Pin_11);
a++;
while(a<5);
int main(void)
BlinkExp();
5
RESULT:
Thus, an embedded c program to interface LED with ARM processor was executed and output
was verified successfully.
6
EXP NO:2 INTERFACING BUZZER WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
Buzzer
Software:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next
Step 4: Select the required library file (SYSCON and GPIO) from the repository
Step 7: Add the required library source file to the project (Right click on include Add file to group and
Step 10: Interface the required component and note down the output
ADD FILES:
Repository:
Clibrary, CMSIS core, common header files, CMSIS boot, SYSCON ,GPIO.
Source files:
No files to be added.
7
BLOCK DIAGRAM:
PROGRAM:
#include "lpc13xx_syscon.h"
#include "lpc13xx_gpio.h"
#include "lpc13xx_syscon.h"
#include "lpc13xx_gpio.h"
voidBuzzerInit()
{
Int i, j;
SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);
GPIO_SetDir(PORT1, GPIO_Pin_11, 1);
while(1) {
for(i=0; i<200; i++) {
for(j=0; j<10000; j++) {
}
}
GPIO_SetBits(PORT1, GPIO_Pin_11);
for(i=0; i<200; i++) {
for(j=0; j<10000; j++) {
}
}
GPIO_ResetBits(PORT1, GPIO_Pin_11);
}
}
8
int main(void)
{
BuzzerInit();
while(1)
{
}
}
9
RESULT:
Thus, an embedded c program was written to interface BUZZER with ARM processor and output
was verified successfully.
10
EXP NO: 3 INTERFACING LCD WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
LCD module
Software:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next.
Step 4: Select the required library file (SYSCON and GPIO) from the repository.
Step 7: Add the required library source file to the project (Right click on include Add file to group and
add the source file).
Step 10: Interface the required component and note down the output.
ADD FILES:
Repository:
Source files:
lcd.h, lcd.c
11
BLOCK DIAGRAM:
PROGRAM:
#include"lcd.h"
int main(void)
init_lcd();
lcd_clear();
lcd_putstring(LINE1,"RAANA");
lcd_putstring(LINE2,"LCD DEMO");
while(1)
12
RESULT:
Thus, an embedded c program to interface LCD with ARM processor was executed and output
was verified successfully.
13
EXP NO: 4 INTERFACING ADC WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
ADC module
LCD module
Software:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next
Step 4: Select the required library file (SYSCON and GPIO) from the repository.
Step 7: Add the required library source file to the project (Right click on include Add file to group and
Step 10: Interface the required component and note down the output
ADD FILES:
Repository:
Clibrary , retarget printf, CMSIS core, CMSIS boot, common header files, SYSCON ,GPIO,
IOCON, UART,ADC , time.
14
Source files:
BLOCK DIAGRAM:
PROGRAM:
#include"lcd.h"
void ADCExp();
int main(void)
{
ReceiverInterrupt();
init_lcd();
lcd_putstring(LINE1, "RAANA ADC DEMO ");
ADCExp();
while(1)
{
}
}
15
RESULT:
Thus, an embedded c program to interface ADC with ARM processor was executed and output
was verified successfully.
16
EXP NO: 5 INTERFACING TEMPERATURE SENSOR WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
LM 35
LCD module
Software:
Coocox IDE
Docklight
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next
Step 4: Select the required library file (SYSCON and GPIO) from the repository
Step 7: Add the required library source file to the project (Right click on include Add file to group and
add the source file)
Step 10: Interface the required component and note down the output
For Docklight:
17
Step 3: Enable keyboard console by clicking on it
Step 4: Now flash (run) the program on COIDE, the output will be displayed on the serial window in the
ADD FILES:
Repository:
Clibrary , retarget printf, CMSIS core, CMSIS boot, common header files, SYSCON ,GPIO,
IOCON, UART,ADC , time.
Source files:
BLOCK DIAGRAM:
PROGRAM:
#include"lcd.h"
void ADCExp();
int main(void)
ReceiverInterrupt();
init_lcd();
18
lcd_putstring(0, "RAANA LM35 DEMO ");
ADCExp();
while(1)
19
RESULT:
Thus, an embedded c program to interface temperature sensor with ARM processor was executed
and output was verified successfully.
20
EXP NO: 6 INTERFACING KEYPAD WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
Keypad module
LCD module
Software:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next
Step 4: Select the required library file (SYSCON and GPIO) from the repository
Step 7: Add the required library source file to the project (Right click on include Add file to group and
add the source file)
Step 10: Interface the required component and note down the output
ADD FILES:
Repository:
Clibrary , retarget printf, CMSIS core, CMSIS boot, common header files, SYSCON ,GPIO,
IOCON, UART, VART.
Source files:
21
BLOCK DIAGRAM:
PROGRAM:
#include "lcd.h"
#include "lpc13xx_syscon.h"
#include "lpc13xx_gpio.h"
void ReceiverInterrupt();
int i,j;
void delay1()
for(i=0;i<=6000;i++)
for(j=0;j<=1000;j++){
}}
int main(void)
SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);
22
GPIO_SetDir(PORT2, GPIO_Pin_0, 0);
lcd_putstring(LINE1,"RAANA KP DEMO");
ReceiverInterrupt();
while(1)
if (GPIO_ReadInputPin(PORT2,GPIO_Pin_0) == 0)
iRx = 0;
lcd_putstring(LINE2,"KP-P2.0");
else if (GPIO_ReadInputPin(PORT2,GPIO_Pin_1) == 0)
iRx = 0;
lcd_putstring(LINE2,"KP-P2.1");
else
lcd_putstring(LINE2,"KP-OPEN");
23
RESULT:
Thus, an embedded c program to interface KEYPAD with ARM processor was executed and
output was verified successfully.
24
EXP NO: 7 INTERFACING KEYBOARD WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
Hardware:
ARM LPC1343
PS2 Keyboard
Software:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next
Step 4: Select the required library file (SYSCON and GPIO) from the repository
Step 7: Add the required library source file to the project (Right click on include Add file to group and
add the source file)
Step 10: Interface the required component and note down the output
ADD FILES:
Repository:
CMSIS core, CMSIS boot, common header file, SYSCON, GPIO, IOCON, UART, SSP.
Source files:
25
BLOCK DIAGRAM:
PROGRAM:
#include "LPC13xx.h"
#include "ps2kbd.h"
#include "gpio.h"
#include "lcd.h"
int main(void) {
init_lcd();
init_keyboard();
lcd_putstring(LINE1, "RAANA");
keyboard();
while (1)
if(keyhit())
process_keyboard();
26
}
return 0 ;
27
RESULT:
Thus, an embedded c program to interface keyboard with ARM processor was executed and
output was verified successfully.
28
EXP.NO: 8 INTERFACING RTC AND SERIAL PORT WITH ARM PROCESSOR
DATE:
AIM:
To write an embedded c program to interface RTC AND SERIAL PORT with ARM processor
LPC1768.
COMPONENTS REQUIRED:
HARDWARE:
ARM LPC1343
LCD
SOFTWARE:
Coocox IDE
PROCEDURE:
Step 2: Give a suitable file name for your project and give the destination folder and then next
Step 4: Select the required library file (SYSCON and GPIO) from the repository
Step 7: Add the required library source file to the project (Right click on include Add file to group and
add the source file)
Step 10: Interface the required component and note down the output.
ADD FILES:
Repository:
CMSIS core, CMSIS boot, common header files, SYSCON, GPIO, IOCON, UART.
29
Source files:
BLOCK DIAGRAM:
PROGRAM:
#include "lpc13xx_gpio.h"
#include "i2c.h"
#include "lcd.h"
#include "stdio.h"
#include "lpc13xx_syscon.h"
#include "lpc13xx_gpio.h"
#include "lpc13xx_uart.h"
30
void wait(int count)
{
int j=0,i=0;
for(j=0;j<count;j++)
{
for(i=0;i<35;i++);
}
}
void test_i2c_at24c256_flash(void)
{
unsigned char i=0;
unsigned char status=1;
for(i=0;i<sizeof(i2c_test_buf);i++)
i2c_test_buf[i] = 0;
lcd_clear();
lcd_putstring(LINE1,i2c_test_buf);
for(i=0;i<sizeof(i2c_test_buf);i++)
{
if(i2c_test_buf[i] != i)
{
status = 0;
break;
}
}
if(status == 1)
{
lcd_putstring(LINE2,"I2C-WR SUCSESS ");
}
else
{
lcd_putstring(LINE2,"I2C-WR FAIL ");
}
}
char buff[20];
char buff1[20];
unsigned char old_sec;
DATETIMEINFO time;
31
int i_data_count;
int i_delay_count;
int main (void)
{
ReceiverInterrupt();
init_lcd(); // Initialize LCD
lcd_putstring(LINE1,"RAANA RTC DEMO ");
i2c_lpc_init(I2C_SPEED_100); // Initialize I2C
Transmit_UART();
//wait(1000);
// lcd_clear();
time.year=16;
time.month=6;
time.day=4;
time.hour=13;
time.minute=54;
time.second=00;
ds1307_set(&time);
// test_i2c_at24c256_flash(); // Test I2C EEPROM by wrinting some data at some address and
reading the same from same address
while(1)
{
ds1307_get(&time);
wait(10000);
while(old_sec == time.second )
{
ds1307_get(&time);
wait(10000);
}
//if(old_sec != time.second )
{
sprintf(buff,"%002d:%002d:%002d", time.hour,time.minute,time.second );
lcd_putstring(LINE2,buff);
sprintf(buff1,"%002d:%002d:%002d\r\n", time.hour,time.minute,time.second );
UART_Send(LPC_UART,buff1,15, BLOCKING);
old_sec = time.second;
}
wait(10000);
}
32
/*
while(1)
{
ds1307_get(&time);
if(old_sec != time.second )
{
old_sec = time.second;
sprintf(buff,"%002d:%002d:%002d\r\n", time.hour,time.minute,time.second );
lcd_putstring(LINE2,buff);
UART_Send(LPC_UART,buff,10, BLOCKING);
}
if (iRx)
{
i_data_count=0;
i_delay_count=30000;
while(i_delay_count>0)
i_delay_count--;
if(RxData[0] == 'S')
{
iRx=0;
33
}
*/
}
RESULT:
Thus, an embedded c program to interface RTC and Serial Port with ARM processor was
executed and output was verified successfully.
34
EXP.NO: 9 INTERFACING LED AND PWM WITH ARM PROCESSOR
DATE:
AIM:
To write an embedded c program to interface LED AND PWM with ARM processor LPC1768
COMPONENTS REQUIRED:
HARDWARE:
ARM LPC1768
LED
DSO
SOFTWARE:
KEIL
PROCEDURE:
Open the Keil software and select the New uvision project from Project Menu as shown below.
Browse to your project folder and provide the project name and click on save.
Once the project is saved a new pop up “Select Device for Target” opens, Select the
controller (NXP: LPC1768) from NXP (founded by philips) and click on OK.
As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
After typing the code save the file as main.c eg. (abc.c).
Right click target and Add the suitable files to source group1 and header for the project.
Code is compiled with no errors. The .bin file is still not generated.
Right Click on Target Options to select the option for generating .bin file.
Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so
35
application should start from 0x2000
Write the command to generate the .bin file from .axf file
Command: fromelf --bin projectname.axf --output filename.bin
ADD FILES:
Target1:
Source group1:
Startuplpc17xx.s, delay.c (t), gpio.c (t), pwm.c (t), sysytemlpc17xx.c (t), main.c (t)
Header:
36
PROGRAM:
#include <lpc17xx.h>
#include "pwm.h"
#include "delay.h"
int main()
int dutyCycle;
PWM_Init(CYCLE_TIME);
/* Initialize the PWM module and the Cycle time(Ton+Toff) is set to 255(similar to arduino)*/
PWM_Start(PWM_2|PWM_3|PWM_4|PWM_5);
while(1)
PWM_SetDutyCycle(PWM_2,dutyCycle); //P2_1
PWM_SetDutyCycle(PWM_3,dutyCycle); //P2_2
PWM_SetDutyCycle(PWM_4,dutyCycle); //P2_3
PWM_SetDutyCycle(PWM_5,dutyCycle); //P2_4
DELAY_ms(500);
PWM_SetDutyCycle(PWM_1,dutyCycle); //P2_0
37
PWM_SetDutyCycle(PWM_2,dutyCycle); //P2_1
PWM_SetDutyCycle(PWM_3,dutyCycle); //P2_2
PWM_SetDutyCycle(PWM_4,dutyCycle); //P2_3
DELAY_ms(500);
} } }
38
RESULT:
Thus interfacing LED AND PWM with ARM processor LPC1768 is verified.
39
EXP.NO: 10 INTERRUPT CHARACTERISTICS PERFORMANCE OF ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
HARDWARE:
ARM LPC1768
LED
DSO
SOFTWARE:
KEIL
PROCEDURE:
Open the Keil software and select the New uvision project from Project Menu as shown below.
Browse to your project folder and provide the project name and click on save.
Once the project is saved a new pop up “Select Device for Target” opens, Select the
controller (NXP: LPC1768) from NXP (founded by philips) and click on OK.
As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
After typing the code save the file as main.c eg. (abc.c).
Right click target and Add the suitable files to source group1 and header for the project.
Code is compiled with no errors. The .bin file is still not generated.
Right Click on Target Options to select the option for generating .bin file.
40
Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so
application should start from 0x2000
Write the command to generate the .bin file from .axf file
Command: fromelf --bin projectname.axf --output filename.bin
ADD FILES:
Target1:
Source group1:
BLOCK DIAGRAM:
PROGRAM:
#include <lpc17xx.h>
#define PINSEL_EINT0 20
#define PINSEL_EINT1 22
#define LED1 0
#define LED2 1
41
#define SBIT_EINT0 0
#define SBIT_EINT1 1
#define SBIT_EXTMODE0 0
#define SBIT_EXTMODE1 1
#define SBIT_EXTPOLAR0 0
#define SBIT_EXTPOLAR1 1
void EINT0_IRQHandler(void)
void EINT1_IRQHandler(void)
int main()
SystemInit();
42
LPC_GPIO1->FIODIR = (1<<LED1) | (1<<LED2); /* Configure LED pins as OUTPUT */
LPC_GPIO1->FIOPIN = 0x00;
NVIC_EnableIRQ(EINT1_IRQn);
while(1)
// Do nothing
43
RESULT:
44
EXP.NO: 11 INTERFACING STEPPER MOTOR WITH ARM PROCESSOR
DATE:
AIM:
To write an embedded c program to interface STEPPER MOTOR with ARM processor LPC1768.
COMPONENTS REQUIRED:
HARDWARE:
ARM LPC1768
STEPPER MOTOR
SOFTWARE:
KEIL
PROCEDURE:
Open the Keil software and select the New uvision project from Project Menu as shown below.
Browse to your project folder and provide the project name and click on save.
Once the project is saved a new pop up “Select Device for Target” opens, Select the
controller (NXP: LPC1768) from NXP (founded by philips) and click on OK.
As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
After typing the code save the file as main.c eg. (abc.c).
Right click target and Add the suitable files to source group1 and header for the project.
Code is compiled with no errors. The .bin file is still not generated.
Right Click on Target Options to select the option for generating .bin file.
Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so
application should start from 0x2000
45
Write the command to generate the .bin file from .axf file
Command: fromelf --bin projectname.axf --output filename.bin
ADD FILES:
Target1:
Source group1:
Header:
BLOCK DIAGRAM:
PROGRAM:
#include<lpc17xx.h>
#include "gpio.h"
46
#define SWITCH2 P1_27
#define pin1 20
#define pin2 21
#define pin3 22
#define pin4 23
void cmotor1()
control |=(1<<pin1);
control |=(1<<pin2);
control &=~(1<<pin3);
control &=~(1<<pin4);
void cmotor2()
control &=~(1<<pin1);
control |=(1<<pin2);
control |=(1<<pin3);
control &=~(1<<pin4);
void cmotor3()
control &=~(1<<pin1);
control &=~(1<<pin2);
control |=(1<<pin3);
control |=(1<<pin4);
47
}
void cmotor4()
control |=(1<<pin1);
control &=~(1<<pin2);
control &=~(1<<pin3);
control |=(1<<pin4);
for(i=0;i<ms;i++)
for(j=0;j<20000;j++);
int main()
GPIO_PinDirection(SWITCH1,INPUT);
GPIO_PinDirection(SWITCH2,INPUT);
while(1)
while(1)
48
if(!GPIO_PinRead(SWITCH1))
break;
cmotor1();
delay_ms(50);
cmotor2();
delay_ms(50);
cmotor3();
delay_ms(50);
cmotor4();
delay_ms(50); }
while(1)
if(!GPIO_PinRead(SWITCH2)) {
break;
cmotor4();
delay_ms(50);
cmotor3();
delay_ms(50);
cmotor2();
delay_ms(50);
cmotor1();
delay_ms(50);
} } }
49
RESULT:
50
EXP.NO: 12 INTERFACING EEPROM
DATE:
AIM:
To write an embedded c program to interface EEPROM AND INTERRUPT with ARM processor
LPC1768
COMPONENTS REQUIRED:
HARDWARE:
ARM LPC1768
EEPROM MODULE
LCD
SOFTWARE:
KEIL
SOURCE FILE:
Startup lpc 17xx.s, delay.c(t), eeprom.c(t), gpio.c(t), system lpc 17xx.c(t), uart.c(t), main.c(t), softi 2c.c(t),
lcd.c(t)
HEADER FILE:
Delay.h, eeprom.h
PROCEDURE:
Open the Keil software and select the New uvision project from Project Menu as shown below.
Browse to your project folder and provide the project name and click on save.
Once the project is saved a new pop up “Select Device for Target” opens, Select the
controller (NXP: LPC1768) from NXP (founded by philips) and click on OK.
As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
After typing the code save the file as main.c eg. (abc.c).
Right click target and Add the suitable files to source group1 and header for the project.
51
Add the main.c along with system_LPC17xx.c.
Code is compiled with no errors. The .bin file is still not generated.
Right Click on Target Options to select the option for generating .bin file.
Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so
application should start from 0x2000
Write the command to generate the .bin file from .axf file
Command: fromelf --bin projectname.axf --output filename.bin
BLOCK DIAGRAM:
52
PROGRAM:
#include<LPC17xx.h>
#include "uart.h"
#include "lcd.h"
#include "gpio.h"
#include "eeprom.h"
#include "delay.h"
int main()
uint8_t read_str[50];
LCD_SetUp(P1_18,P1_19,P1_20,P_NC,P_NC,P_NC,P_NC,P1_21,P1_22,P1_23,P1_24);
LCD_Init(2,16);
EEPROM_Init(AT24C08,P0_0,P0_1);
LCD_CmdWrite(0x80);
LCD_String("EEPROM DEMO");
while (1)
if(!GPIO_PinRead(SWITCH1))
LCD_CmdWrite(0x01);
LCD_CmdWrite(0x80);
53
LCD_String("DATA SEND");
LCD_CmdWrite(0xC0);
LCD_String(write_str);
else if(!GPIO_PinRead(SWITCH2))
LCD_CmdWrite(0x01);
LCD_CmdWrite(0x80);
LCD_String("DATA RECEIVE");
EEPROM_ReadString(eeprom_address, read_str);
else if(!GPIO_PinRead(SWITCH3))
main();
break;
54
RESULT:
Thus interfacing EEPROM AND INTERRUPT with ARM processor LPC1768 is verified.
55
EXP.NO: 13 INTERFACING DAC WITH ARM PROCESSOR
DATE:
AIM:
COMPONENTS REQUIRED:
HARDWARE:
ARM LPC1768
LED
MULTIMETER
SOFTWARE:
KEIL
SOURCE FILE:
HEADER FILE:
PROCEDURE:
Open the Keil software and select the New uvision project from Project Menu as shown below.
Browse to your project folder and provide the project name and click on save.
Once the project is saved a new pop up “Select Device for Target” opens, Select the
controller (NXP: LPC1768) from NXP (founded by philips) and click on OK.
As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
After typing the code save the file as main.c eg. (abc.c).
Right click target and Add the suitable files to source group1 and header for the project.
56
Build the project and fix the compiler errors/warnings if any.
Code is compiled with no errors. The .bin file is still not generated.
Right Click on Target Options to select the option for generating .bin file.
Set IROM1 start address as 0x2000. Bootloader will be stored from 0x0000-0x2000 so
application should start from 0x2000
Write the command to generate the .bin file from .axf file
Command: fromelf --bin projectname.axf --output filename.bin
BLOCK DIAGRAM:
PROGRAM:
#include <lpc17xx.h>
#include "pwm.h"
#include "delay.h"
#include "gpio.h"
57
#define SWITCH1 P1_26 /* start the main program */
int main()
int dutyCycle=0;
PWM_Init(CYCLE_TIME);
/* Initialize the PWM module and the Cycle time(Ton+Toff) is set to 255(similar to arduino)*/
GPIO_PinDirection(SWITCH1,INPUT);
while(1)
PWM_SetDutyCycle(PWM_4,dutyCycle); //P2_3
if(!GPIO_PinRead(SWITCH1))
DELAY_ms(5);
dutyCycle=dutyCycle+50;
if(dutyCycle>250)
dutyCycle=0;
58
RESULT:
59
EXP NO:14 STUDY OF ARM PROCESSOR
DATE:
AIM:
To study ARM processor features and functions for further analysis of interfacing peripherals.
ARM - INTRODUCTION:
An ARM processor is one of a family of CPUs based on the RISC (reduced instruction set
computer) architecture developed by Advanced RISC Machines (ARM).
ARM makes 32-bit and 64-bit RISC multi-core processors.
RISC processors are designed to perform a smaller number of types of computer instructions.
ARM processors are extensively used in consumer electronic devices such as smartphones,
tablets, multimedia players and other mobile devices, such as wearables. Because of their
reduced instruction set, they require fewer transistors, which enables a smaller die size for the
integrated circuitry (IC).
The ARM processor’s smaller size, reduced complexity and lower power consumption makes
them suitable for increasingly miniaturized devices.
Load/store architecture.
An orthogonal instruction set.
Mostly single-cycle execution.
Enhanced power-saving design.
64 and 32-bit execution states for scalable high performance.
Hardware virtualization support.
The simplified design of ARM processors enables more efficient multi-core processing and easier
coding for developers.
ARM servers represent an important shift in server-based computing.
An ARM server uses perhaps hundreds of smaller, less sophisticated, low-power processors that
share processing tasks among that large number instead of just a few higher-capacity processors.
This approach is sometimes referred to as “scaling out,” in contrast with the “scaling up” of x86-
based servers.
60
ARM Processor are categorized based on following for high performance with low power
consumption
o A – Application (for application of processor), implemented by 32-bit cores in
the Cortex-A series and by some non-ARM cores.
o R - Real Time Application (for real time characteristics), implemented by cores in
the Cortex-R series.
o M - Microcontroller (for microcontroller application), implemented by most cores in
the Cortex-M series.
Some of the series are
o ARM1 , ARM2 , ARM250, ARM3, ARM60 , ARM610, ARM700 , ARM710a
o ARM 11 MPcore, ARM CORTEX A5, ARM CORTEX A7, ARM CORTEX A8, ARM
CORTEX A9, ARM CORTEX A12, ARM CORTEX A15
o ARM CORTEX R4, ARM CORTEX R5
o ARM CORTEX M0, ARM CORTEX M0+, ARM CORTEX M1, ARM CORTEX M3,
ARM CORTEX M4
61
RESULT:
Thus the study of ARM processor is analyzed for application interfacing the peripherals with
ARM Board.
62