Académique Documents
Professionnel Documents
Culture Documents
Shivani
13049
Page 1
Experiment- 1
Aim: To study the architecture, pin diagram, pipeline system of ARM 7 and ARM
9 processor.
Architecture
Shivani
13049
Page 2
Features:
Shivani
13049
Page 3
Pin Description:
Shivani
13049
Page 4
Pin Description:
P0.0 to P0.31
Port 0 is a 32-bit I/O port with individual direction controls for each bit. Total of 31 pins of the
Port 0 can be used as a general purpose bidirectional digital I/Os while P0.31 is output only pin.
The operation of port 0 pins depends upon the pin function selected via the pin connect block.
Pins P0.24, P0.26 and P0.27 are not available.
P0.0/TXD0/ PWM1 (19 Pin)
P0.0 General purpose input/output digital pin (GPIO).
TXD0 Transmitter output for UART0.
PWM1 Pulse Width Modulator output 1.
P0.1/RXD0/ PWM3/EINT0 (21 Pin)
P0.1 General purpose input/output digital pin (GPIO).
RXD0 Receiver input for UART0.
PWM3 Pulse Width Modulator output 3.
EINT0 External interrupt 0 input
P0.2/SCL0/ CAP0.0 (22 Pin)
P0.2 General purpose input/output digital pin (GPIO).
SCL0 I2C0 clock input/output. Open-drain output (for I2C-bus compliance).
CAP0.0 Capture input for Timer 0, channel 0.
P0.3/SDA0/MAT0.0/EINT1 (26 Pin)
P0.3 General purpose input/output digital pin (GPIO).
SDA0 I2C0 data input/output. Open-drain output (for I2C-bus compliance).
MAT0.0 Match output for Timer 0, channel 0.
EINT1 External interrupt 1 input.
P0.4/SCK0/CAP0.1/AD0.6 (27 Pin)
P0.4 General purpose input/output digital pin (GPIO).
SCK0 Serial clock for SPI0. SPI clock output from master or input to slave.
CAP0.1 Capture input for Timer 0, channel 0.
AD0.6 ADC 0, input 6.
P0.5/MISO0/MAT0.1/AD0.7 (29 Pin)
P0.5 General purpose input/output digital pin (GPIO). I/O
MISO0 Master In Slave OUT for SPI0. Data input to SPI master or data
output from SPI slave.
MAT0.1 Match output for Timer 0, channel 1.
AD0.7 ADC 0, input 7.
P0.6/MOSI0/ CAP0.2/AD1.0 (30 Pin)
P0.6 General purpose input/output digital pin (GPIO).
MOSI0 Master Out Slave In for SPI0. Data output from SPI master or data input to SPI slave.
CAP0.2 Capture input for Timer 0, channel 2.
AD1.0 ADC 1, input 0. Available in LPC2144/46/48 only.
P0.7/SSEL0/PWM2/EINT2 (31Pin)
P0.7 General purpose input/output digital pin (GPIO).
Shivani
13049
Page 5
SSEL0 Slave Select for SPI0. Selects the SPI interface as a slave.
PWM2 Pulse Width Modulator output 2.
EINT2 External interrupt 2 input.
P0.8/TXD1/ PWM4/AD1.1 (33 Pin)
P0.8 General purpose input/output digital pin (GPIO).
TXD1 Transmitter output for UART1.
PWM4 Pulse Width Modulator output 4.
AD1.1 ADC 1, input 1. Available in LPC2144/46/48 only.
P0.9/RXD1/ PWM6/EINT3 (34 Pin)
P0.9 General purpose input/output digital pin (GPIO).
RXD1 Receiver input for UART1.
PWM6 Pulse Width Modulator output 6.
EINT3 External interrupt 3 input.
P0.10/RTS1/ CAP1.0/AD1.2 (35 Pin)
P0.10 General purpose input/output digital pin (GPIO).
RTS1 Request to Send output for UART1. LPC2144/46/48 only.
CAP1.0 Capture input for Timer 1, channel 0.
AD1.2 ADC 1, input 2. Available in LPC2144/46/48 only.
P0.11/CTS1/ CAP1.1/SCL1 (37 Pin)
P0.11 General purpose input/output digital pin (GPIO).
CTS1 Clear to Send input for UART1. Available in LPC2144/46/48 only.
CAP1.1 Capture input for Timer 1, channel 1.
SCL1 I2C1 clock input/output. Open-drain output (for I2C-bus compliance)
P0.12/DSR1/ MAT1.0/AD1.3 (38 Pin)
P0.12 General purpose input/output digital pin (GPIO).
DSR1 Data Set Ready input for UART1. Available in LPC2144/46/48 only.
MAT1.0 Match output for Timer 1, channel 0.
AD1.3 ADC input 3. Available in LPC2144/46/48 only.
P0.13/DTR1/MAT1.1/AD1.4 (39 Pin)
P0.13 General purpose input/output digital pin (GPIO).
DTR1 Data Terminal Ready output for UART1. LPC2144/46/48 only.
MAT1.1 Match output for Timer 1, channel 1.
AD1.4 ADC input 4. Available in LPC2144/46/48 only.
P0.14/DCD1/ EINT1/SDA1 (41 Pin)
P0.14 General purpose input/output digital pin (GPIO). DCD1 Data Carrier Detect input
for UART1. LPC2144/46/48 only.
EINT1 External interrupt 1 input.
SDA1 I2C1 data input/output. Open-drain output (for I2C-bus compliance)
P0.15/RI1/ EINT2/AD1.5 (45 Pin)
P0.15 General purpose input/output digital pin (GPIO).
RI1 Ring Indicator input for UART1. Available in LPC2144/46/48 only.
EINT2 External interrupt 2 input.
AD1.5 ADC 1, input 5. Available in LPC2144/46/48 only.
P0.16/EINT0/ MAT0.2/CAP0.2 (46 Pin)
Shivani
13049
Page 6
Page 7
Page 8
PIPESTAT2 Pipeline Status, bit 2. Standard I/O port with internal pull-up.
P1.24/ TRACECLK 32
P1.24 General purpose input/output digital pin (GPIO).
TRACECLK Trace Clock. Standard I/O port with internal pull-up.
P1.25/EXTIN0 28
P1.25 General purpose input/output digital pin (GPIO).
EXTIN0 External Trigger Input. Standard I/O with internal pull-up.
P1.26/RTCK 24
P1.26 General purpose input/output digital pin (GPIO).
RTCK Returned Test Clock output. Extra signal added to the JTAG port.
P1.27/TDO 64
P1.27 General purpose input/output digital pin (GPIO).
TDO Test Data out for JTAG interface.
P1.28/TDI 60
P1.28 General purpose input/output digital pin (GPIO).
TDI Test Data in for JTAG interface.
P1.29/TCK 56
P1.29 General purpose input/output digital pin (GPIO).
TCK Test Clock for JTAG interface.
P1.30/TMS 52
P1.30 General purpose input/output digital pin (GPIO).
TMS Test Mode Select for JTAG interface.
P1.31/TRST 20
P1.31 General purpose input/output digital pin (GPIO).
TRST Test Reset for JTAG interface.
D+ 10
USB bidirectional D+ line.
D- 11
USB bidirectional D- line.
RESET 57
External reset input: A LOW on this pin resets the device, causing I/O ports
and peripherals to take on their default states, and processor execution to
Shivani
13049
Page 9
Page 10
Shivani
13049
Page 11
Shivani
13049
Page 12
Experiment- 2
Shivani
13049
Page 13
Experiment- 2
Aim: Write ARM Processor program to Flash LED
#include LPC214x.h
void delay(unsigned long int h)
{
unsigned long int i, j;
for(j=0; j<h; j++)
for(i=0; i<5000; i++);
}
int main()
{
IODIR0 = 0xFFFFFFFF;
IODIR1=0xFFFFFFFF;
while(1)
{
IOCLR0=0xFFFFFFFF;
IOCLR1=0xFFFFFFFF;
delay(1000);
IOSET0=0xFFFFFFFF;
IOSET1=0xFFFFFFFF;
delay(2000);
}
}
Shivani
13049
Page 14
Experiment- 3
Shivani
13049
Page 15
Experiment- 3
Aim: Program to display string on LCD.
Procedure:
1) Connect data of LCD with pins P0.0 P0.7
2) Connect control of LCD with P0.8 - P0.15
3) Press the reset button and execute the program.
Program:
#include<lpc214x.h>
#define rs(1<<8)
#define e (1<<9)
void delay(unsigned log int h)
{
unsigned long int i, j;
for(j=0; j<h ;j++)
for(i=0; i<5000; i++);
void cmd_lcd(unsigned long int dat)
}
IOCLR0 = 0x00000FFF;
IOSET0 = dat;
IOSET0 = e;
delay(2);
IOCLR0 = e;
delay(2);
}
void string_lcd(char * str)
{
while(*str != \0)
{
data_lcd(*str++)
Shivani
13049
Page 16
}}
void init_lcd()
{
cmd_lcd(0x38);
cmd_lcd(0x01);
cmd_lcd (0x06);
cmd_lcd (0x0c);
cmd_lcd (0x80);
}
int main()
{
int i;
IODIR0 = 0xFFFFFFFF;
init_lcd();
while(1)
{
cmd_lcd(0x80);
string_lcd(Embedded System);
cmd_lcd(0xc0);
string_lcd(ECE 2011)
for(i=0; i<=6; i++)
{
cmd_lcd(0x1c);
delay(1000);
}
for(i=0; i<=6; i++)
{
cmd_lcd(0x18);
dealy(1000);
}}}
Shivani
13049
Page 17
Experiment- 4
Shivani
13049
Page 18
Experiment- 4
Aim: Interface relays and write a program to control
#include LPC214x.h
void delay(unsigned long int h)
{
unsigned long int i, j;
for(j=0; j<h; j++)
for(i=0; i<5000; i++);
}
int main()
{
unsigned char i,a;
IODIR0 = 0xFFFFFFFF;
IOCLR0 = 0xFFFFFFFF;
while(1)
{
a = 0x01;
IOSET0 = a<<16;
delay(1000);
for(i = 0; i<8; i++)
{
IOCLR0 = 0xFFFFFFFF;
a = a<<1;
IOSET0 = a<<16;
delay(1000);
}}
}
Shivani
13049
Page 19
Experiment- 5
Shivani
13049
Page 20
Experiment- 5
Aim: Interfacing of DC Motor wit ARM Processor.
Procedure: This is the programming code for dc motor control, in which the LPC daughter
card is interfaced with DC motor, LCD and Relay.
Output:
1) Press switch 1 for moving the motor anticlockwise.
2) Press switch 2 for clockwise motion.
3) Press switch 3 for stopping the motor.
Connections:
1)
2)
3)
4)
Program:
#include<LPC214x.h>
#define PCLK 30000000 UL
#include delay.h
#include lcd.h
int main()
{
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
IODIR0 = 0x00FFFF;
IOPIN = 0;
lcd-init();
lcd_sting_xy(DC Motor,1,1);
while(1)
Shivani
13049
Page 21
{
If(IO0PIN & (1<<16))
{
IOSET= 1<<9;
IOCLR= 1<<8;
lcd_sting_xy(anticlockwise,2,1)
}
if`(IO0PIN & (1<<17))
{
IO0SET= 1<<9;
IO0CLR= 1<<8;
lcd_string_xy(clockwise,2,1);
}
if(IO0PIN & (1<<18))
{
IO0CLR = (1<<8) | (1<<9);
lcd_string_xy(stop,2,1))
}}}
Shivani
13049
Page 22
Experiment- 6
Shivani
13049
Page 23
Experiment- 6
Aim: Interfacing of Stepper Motor wit ARM Processor.
Procedure:
1) connect Stepper Motor with P0.16 P0.23
2) Press the reset button to execute the program
Program:
void delay(unsigned log int h)
{
unsigned long int i, j;
for(j=0; j<h ;j++)
for(i=0; i<5000; i++);
}
int main()
{
IODIR0 = 0xFFFFFFFF;
IODIR1 = 0xFFFFFFFF;
while(1)
{
IOCLR0 = 0xFFFFFFFF;
IOSET0 =0x10000;
delay(1000);
IOCLR0 = 0xFFFFFFFF;
IOSET0 =0x40000;
delay(1000);
IOCLR0 = 0xFFFFFFFF;
IOSET0 =0x20000;
Shivani
13049
Page 24
delay(1000);
IOCLR0 = 0xFFFFFFFF;
IOSET0 =0x80000;
delay(1000);
IOCLR0 = 0xFFFFFFFF;
delay(1000); delay(1000);
delay(1000); delay(1000);
delay(1000); delay(1000);
}}
Shivani
13049
Page 25
Experiment- 7
Shivani
13049
Page 26
Experiment- 7
Aim: Interfacing of DAC.
Program:
This code is for external DAC. In this code LPC2148/38 daughter card and DAC module. Output
of the code is a triangular wave.
Conncections:
connect DAC module with P0( 0 7) and provide +12V . +5V supply to the module.
Program:
#include<LPC214x.h>
#define PCLK 30000000 UL
int main()
{
unsigned char I;
unsigned char j;
IO0DIR = 0xFF;
IO0SET=0x00;
while(1)
{
for(i=0; i<255; i++)
{
IOPIN0 = i;
for(j=0; j<6000; j++);
}
for(i=255; i>0; i--)
Shivani
13049
Page 27
{
IOPIN0 = I;
for(j=0; j<600; j++);
}}
Shivani
13049
Page 28
Experiment- 8
Shivani
13049
Page 29
Experiment- 8
Aim: Interfacing of ADC.
Procedure:
1)
2)
3)
4)
5)
Program
#include<lpc214x.h>
#define ALE(1<<18)
#define SOC(1<<17)
#define OE (1<<16)
#define EOC (1<<19)
#define SET0 (1<<20)
#defineSET1 (1<<21)
#define SET2(1<<22)
#define CLOCK(1<<23)
#define rs (1<<8)
#define e(1<<9)
void delay(unsigned log int h)
{
unsigned long int i, j;
for(j=0; j<h ;j++)
for(i=0; i<5000; i++);
}
Shivani
13049
Page 30
void clock()
{
int b;
for(b=0l b<=250; b++)
{
IOsET0 = CLOCK;
dealy(5);
IOCLR0= CLOCK;
delay(5);
}}
char adc()
{
char val;
IOCLR0 = EOC;
IOCLR0 = SET0|SET1|SET2;
delay(1);
IOSET0 = ALE; dealy(1);
IOSET0 = Soc; delay(1);
clock();
IOCLR0 = SOC; dealy(1);
IOCLR0 = AlE; dealy(1);
clock();
while(!(IOPIN0 & EOC));
IOSET0 = OE;
val = (IOPIN1 >>16);
Shivani
13049
Page 31
return(val);
}
void cmd_lcd(unsigned long int dat)
{ IOSET0 = 3;
delay(2);
IOCLR0 = e;
delay(2);
}
void string_lcd(char *str)
{
while(*str != 0)
{
data_lcd(*str++);
}
}
void init_lcd()
{
cmd_lcd(0x38);
cmd_lcd(0x01);
cmd_lcd (0x06);
cmd_lcd (0x0c);
cmd_lcd (0x80);
}
void number_lcd(int num)
{
data_lcd(num/100)+0x30);
Shivani
13049
Page 32
data_lcd(num/10)%10+0x30);
data_lcd((num%0) +0x30);
}
int main()
{
char dis;
IODIR0 = 0x00f7ffff;
IODIR1= 0x00000000;
IOCLR0 = 0xFFFFFFF;
IOCLR1 = 0xFFFFFFFF;
init_lcd();
string_lcd(Digital output);
IOCLR0 = SOC | OE| ALE;
IOSET0 = EOc;
dealy(1000);
while(1)
{
dis = adc();
cmd_lcd(0x04);
number_lcd(dis);
delay(1000);
}}
Shivani
13049
Page 33
Experiment- 9
Shivani
13049
Page 34
Experiment- 9
Aim: Interfacing of XBEE.
Output:
In this demo code, data send via Pc is directly to 2 Xbee send wirelessly to 1 xbee and on a board
this data is show on led module.
Connection
1st Xbee Module
converter module, first box header of converter module with ARM daughter card P0(8-15) and
second box header of converter module with first xbee module
2nd Xbee module
LED module P1(16-23)
Xbee setting
Program
#include<LPC214x.h>
#defien PCLK 30000000UL
#includedelay.h
void uart1_init(unsigned int);
void uart1_ send(unsigned char value);
unsigned uart1-rce();
Shivani
13049
Page 35
int main()
{
unsigned int a;
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
IO1DIR = 0xFFFFFF;
IO1CLR=0xFFFFFF;
delay_ms(100);
uart1_init(9600);
while(1)
{
a = uart_rec();
}}
void uart1_init(unsigned int Baud_Rate)
{
PINSEL0 |= (1<<16) | (1<<18);
U1LCR = 0x83;
U1DKM = 0x00;
U1DLL = PCLK
U1LCR = 0x03;
}
void uart1_send(unsigned char value)
{while(!(U1LST & 0x20));
U1THR =value;
}
Shivani
13049
Page 36
Shivani
13049
Page 37
Experiment- 10
Shivani
13049
Page 38
Experiment- 10
Aim: Interfacing of RFID.
Output:
in this demo code two RFId card are used to control two device 1 and 2 connected with relay if
you swap card one time device is on and on the second time device is off.
Connection
LCD data lines P1(16-23)
LCD control lines P1(25-31)
RFId P0(8-15)
Relay P0(16-23)
External clock is 12MHz
Program
#include<LPC214x.h>
#define PCLK 30000000UL
#include delay.h
#include lcd.h
unsigned char buff[2];
void RFID_rec();
void uart1_init(unsigned int);
unsigned char uart1_rec();
int main()
{
unsigned char I, SI =1; S2= 1;
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
Shivani
13049
Page 39
IO0DIR = 0xFFFFFF;
IO0PIN = 0;
delay_ms(100);
lcd_init()l
uart1-init(9600);
lcd_string_xy(RFID READER,1,1)
while(!)
{
RFID_rec();
if(strcmp(buff, 72004DF5F63C)==0)
{
if(S1==1)
{
lcd_string_xy(Device 1 ON,2,1);
IO0SET = 1<<17;
S1=2;
}
else if(S1==2)
{
lcd_string_xy(Device 1 is off,2,1);
IO0CLR= 1<<18;
S2=1;
}}
void RFID-rec()
{
Shivani
13049
Page 40
unsigned char i;
for(i=0; i<12; i++)
buff[i] = uart1_rec();
buff[i] = 0;
}
void uart1_init(unsigned int Baud_Rate)
{
PINSEL0 |=(1<<16)|(1<<18);
U1LCR = 0x83;
U1DLM = 0x00;
U1DLL = PCLk/(16*Baud_Rate);
U1LCR = 0x03;
}
unsigned char uart1_rec()
{
while(!(U1LSR & 0x01));
return(U1RBR);
}
Shivani
13049
Page 41