Beruflich Dokumente
Kultur Dokumente
HISTORY OF ARM
ARM
ARM
An
WHY ARM?
FEATURES OF
LPC2148
PACKAGE:
16/32-bit ARM7TDMI-S
package.
MEMORY:
SPEED:
128
operation.
ADC:
DAC:
Single
TIMERS:
Two
Each
PWM
Watchdog
timer
RTC:
Low
SERIAL INTERFACES:
I2C-bus:
Serial
communication:
SPI
INTERRUPTS:
Vectored
OSCILLATOR:
Idle mode
Power-down mode
APPLICATIONS
Industrial control
Medical systems
Access control
Point-of-sale
Communication gateway
Embedded soft modem
General purpose applications
ARM CONTROLLER
VS 8051 CONTROLLER
8051 ARCHITECTURE
FEATURES OF 8051
Quantity
Feature
ROM
4KB
RAM
128 bytes
IO PORTS
4(P0,P1,P2,P3)
Timers
Serial commns
1(UART)
Interrupts
Package
40 pins
LPC2148 ARCHITECTURE
ARM7TDMI-S
CPU
with
real-time
FEATURES OF LPC2148
ROM
512 KB
RAM
32 KB
IO PORTS
2(P0,P1)
Timers
2(32 bit)
Serial comm
2 UART, 2 I2C, 1
SSP ,1 SPI
USB RAM
2 KB
PWM modules
ADC
2(14 channels)
Interrupts
16
Package
64 PIN(LQFP)
DAC
ARM 7
APPLICATIONS
BLOCK DIAGRAM
TYPES OF BUSES
AMBA Bus
LOCAL Bus
VPB Bus
CRYSTAL OSCILLATOR
CRYSTAL OSCILLATOR
FOSC and CCLK are the same value unless the PLL
is running and connected.
Slave mode
oscillation mode.
Capacitance
There
are
two
PLL
modules
in
the
LPC2141/2/4/6/8 microcontroller.
PIN
CONFIGURATION
2.
FUNCTION
PIN
D+
10
D-
11
XTAL1
62
XTAL2
61
RTXC1
RTXC2
VSS
6, 18 ,25,42,50
VSSA
52
VDD
VDDA
VREF
63
VBAT
49
FUNCTIONALITY OF
PINS
FUNCTIONALITY OF PINS
1:0
P0.0
3:2
P0.1
10
Function
line
00
GPIO Port 0.0
01
TXD (UART0)
10
PWM1
11
Reserved
00
01
PWM3
11
5:4
P0.2
01
10
00
GPIO Port 0.2
SCL0 (I2C0)
Capture 0.0 (Timer 0)
11
Reserved
7:6
P0.3
01
10
00
GPIO Port 0.3
SDA0 (I2C0)
Match 0.0 (Timer 0)
11
EINT1
9:8
(Timer 0)
11
11:10
(Timer 0)
11
P0.4
00
01
10
AD0.6
P0.5
AD0.7
00
01
10
13:12
01
10
P0.6
00
GPIO Port 0.6 0
MOSI0 (SPI0)
Capture 0.2 (Timer
11
Reserved[1][2]
or AD1.0[3]
15:14
01
10
11
P0.7
00
SSEL0 (SPI0)
PWM2
EINT2
17:16
P0.8
00
01
10
11
or AD1.1[3]
19:18
01
10
11
P0.9
00
RxD (UART1)
PWM6
EINT3
21:20
P0.10
00
01
10
11
orAD1.2[3]
23:22
CTS
P0.11
00
GPIO Port 0.11
01
Reserved[1][2] or
(UART1)[3]
10
Capture 1.1 (Timer
1)
11
SCL1 (I2C1)
25:24
P0.12 00 GPIO Port 0.12 0
01 Reserved[1][2] or DSR (UART1)[3]
10 Match 1.0 (Timer 1)
11
Reserved[1][2]
or AD1.3[3]
27:26
P0.13
00 GPIO Port 0.13 0
01 Reserved[1][2] or DTR (UART1)[3]
10 Match 1.1 (Timer 1)
11 Reserved[1][2]
orAD1.4[3]
29:28
P0.14 00 GPIO Port 0.14 0
01
Reserved[1][2] or DCD (UART1)[3]
10 EINT1
11
SDA1 (I2C1)
31:30
P0.15
00 GPIO Port 0.15 0
01 Reserved[1][2] or RI
(UART1)[3]
10 EINT2
11 Reserved[1][2]
orAD1.5[3]
29:28
P0.14 00 GPIO Port 0.14 0
01
Reserved[1][2] or DCD (UART1)[3]
10 EINT1
11 SDA1 (I2C1)
31:30
P0.15
00 GPIO Port 0.15 0
01 Reserved[1][2] or RI (UART1)[3]
10 EINT2
11 Reserved[1][2]
orAD1.5[3]
1:0
P0.16
00
3:2
P0.17
5:4
P0.18
01
00
GPIO Port 0.18 0
Capture 1.3 (Timer 1)
10 Match 0.2 (Timer
11
MISO1 (SSP)
0)
7:6
P0.19
9:8
01
11
P0.20
00
GPIO Port 0.20 0
Match 1.3 (Timer 1)
10 SSEL1 (SSP)
EINT3
11:10
P0.21
00
01 PWM5
10 Reserved[1][2] or
AD1.6[3]
11 Capture 1.3 (Timer 1)
13:12
P0.22
00 GPIO Port 0.22 0
01 Reserved[1][2] or
AD1.7[3]
10 Capture 0.0
(Timer 0)
11 Match 0.0 (Timer 0)
15:14
P0.23
01 VBUS
10 Reserved
11 Reserved
00
17:16 P0.24
00 Reserved
01 Reserved
10 Reserved
11 Reserved
19:18 P0.25
01 AD0.4
10 Reserved[1] or
00
Aout(DAC)[2]
[3]
11 Reserved
21:20 P0.26
00
Reserved
01 Reserved
10 Reserved
11 Reserved
23:22 P0.27
00 Reserved
01 Reserved
10 Reserved
11 Reserved
25:24 P0.28
(Timer 0)
11 Match 0.2 (Timer 0)
27:26 P0.29
29:28 P0.30
31:30 P0.31
APPLICATIONS
IODIRx=0x00000000-i/p config.
IODIRx=0xffffffff-o/p config.
Writing
produces
corresponding
port
a
pin
LOW
and
level
clears
at
the
the
GPIO PROGRAMMING
SERIAL
COMMUNICATION
LPC2148 ARM7
FEATURES OF UART0
FEATURES OF UART1
REGISTER DESCRIPTION
the oldest character received and can be read via the bus interface.
The LSB (bit 0) represents the oldest received data bit. If the
character received is less than 8 bits, the unused MSBs are padded
with zeroes.
of the divisor and U1DLM contains the higher 8 bits of the divisor.
BAUDRATE CALCULATION
SERIAL COMMUNICATION
Parallel transmission:
Data is sent 8 bits (byte) at a time over 8 data lines.
A few handshaking lines may be needed. One uses a 25-pin
D-shell connector and cable(DB-25 or equivalent)
Serial transmission:
Data is sent one bit at a time over one data line. In theory and
principle one needs only two lines for data, one for the signal
and the other for ground. A few clock and handshaking lines
are needed and in many PCs a 9-pin connector is used.
Simplex
Half duplex
Full duplex
ASYNCHRONOUS DATA
Synchronous Data
UART:
UART means Universal Asynchronous
Transmitter
8051 have single UART
In LPC2148 have two UART
Receiver and
UART
PIN DESCRIPTION
UART0 pin description
Pin
Type
RXD0
Input
TXD0
Output
Description
Serial Input. Serial receive data.
Serial Output. Serial transmit data.
00
01
10
11
5(xxx00000)
6(xx000000)
7(x0000000)
8(00000000)
U0LCR=0X83
BAUD RATE
U0CLR=0X03
DLAB(Divisor Latch Buffer)
BAUD RATE=CLK/16*9600
SERIAL COMMUNICATION
PROGRAMS
void sercon(void)
{
PINSEL0=0X00000005;
U0LCR=0X83;
U0DLL=0X061;
U0LCR=0X03;
}
LIQUID
CRYSTAL
DISPLAY
16X2 LCD
Allows user to read the information from the LCD and write the
information to the LCD.
R/W=1 when reading
R/W=0, when writing
E: ENABLE
used by the LCD to latch the information from its data lines.
registers.
contents of
LCD COMMANDS
0x38: 2 lines and 5x7 matrix
0x01: clear display screen
0x0E: display on, cursor blinking
0x06: increment cursor(shift cursor to right)
0x80: force cursor to beginning of 1 st line
0xC0: force cursor to beginning of 2 nd line
LCD PROGRAM
LCD PROGRAM
#include<LPC214X.H>
#define rs 0x00010000;
#define en 0x00020000;
#define d1 0x00040000;
#define d2 0x00080000;
#define d3 0x00100000;
#define d4 0x00200000;
void lcd_cmd(unsigned char);
void delay(unsigned int);
void lcd_dat(unsigned char);
void disp_str(unsigned char * );
int main()
{
IODIR0=0X003F0000;
while(1)
{
lcd_cmd(0x28);
delay(20);
lcd_cmd(0x01);
delay(20);
lcd_cmd(0x0e);
delay(20);
lcd_cmd(0x80);
delay(20);
lcd_cmd(0x06);
delay(20);
lcd_dat('a');
delay(20);
disp_str("hello");
}
}