Sie sind auf Seite 1von 11

ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.

com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

Pechnol
Pure Technology

Embedded

ARM: LPC2148 GPIO Basics with


calculator| learn.Pechnol
March 20, 2016 opinio 0 Comment Basics LPC2148, GPIO programming, LPC,

LPC2148, NXP LPC, Register Calculator

LPC2148GPIO

LPC2148 is an ARM family microcontroller, developed by NXP. LPC2148


has vast applications from very basic I/O design (although we dont use
it for them only) to RTOS. They are very inexpensive you can buy one
controller in under Rs. 400 a piece.

1 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

LPC2148 has following things inbuilt:

2 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

3 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

4 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

5 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

1 #include <LPC21XX.h>

6 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

2
3 void delay(void);
4 int main(void)
5 {
6 IO0DIR = 0xFFFFFFFF;
7
8 while(1)
9 {
10 IO0SET=0xFFFFFFFF;
11 delay();
12 IO0CLR=0xFFFFFFFF;
13 delay();
14 }
15 }
16
17 void delay(void)
18 {
19 int a,b;
20 b=0;
21 for(a=0;a<=200000;a++)
22 {
23 b++;
24 }
25 }

7 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

1 #include <LPC21XX.h>
2 int main(void)
3 {
4 IO0DIR &= ~(1<<8); // Setting P0.8 as input
5 IO0DIR |= (1<<15); // Setting P0.15 as output
6 while(1)
7 {
8 if(!(IO0PIN & (1<<8))) // Checking whether the PIN is low
9 {
10 IO0CLR |= (1<<15);
11 }
12 else
13 {
14 IO0SET |= (1<<15);
15 }
16 }
17
18
19 return 0;
20 }

8 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

PINSELx
Select individual bits and get the results.

PINSEL0
P0.15[1] P0.15[0] P0.14[1]
P0.14[0] P0.13[1] P0.13[0]
P0.12[1] P0.12[0] P0.11[1]
P0.11[0] P0.10[1] P0.10[0]
P0.9[1] P0.9[0] P0.8[1]
P0.8[0] P0.7[1] P0.7[0]
P0.6[1] P0.6[0] P0.5[1]
P0.5[0] P0.4[1] P0.4[0]
P0.3[1] P0.3[0] P0.2[1]
P0.2[0] P0.1[1] P0.1[0]
P0.0[1] P0.0[0]
________

Reference Manual is required for function selection. Many pages of space


is required to list all here, e.g.: P0.16 has two bits 00,01,10,11
conguration.

Value 32 bit Binary


0b00000000000000000000000000000000

Value 32 bit Hex


0x00000000

PINSEL1
P0.31[1] P0.31[0] P0.30[1]

9 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

P0.30[0] P0.29[1] P0.29[0]


P0.27[1]
P0.26[0]
P0.24[1]
P0.23[0]
P0.21[1]
P0.20[0]
P0.18[1]
P0.17[0]

________

Reference Manual is required for function selection. Many pages of space


is required to list all here.

Value 32 bit Binary


0b00000000000000000000000000000000

Value 32 bit HEX


0x00000000

You May Also Like

ARM: LPC2148 ARM: LPC2148 ARM: LPC2148 DAC


UART basics with Timer with PLL and Basics|
calculator| calculator| learn.Pechnol
learn.Pechnol learn.Pechnol

10 of 11 3/18/2017 3:10 AM
ARM: LPC2148 GPIO Basics with calculator| learn.Pechnol - Pechnol http://learn.pechnol.com/2016/03/20/arm-lpc2148-gpio-basics-calculator/

Post Comment

11 of 11 3/18/2017 3:10 AM

Das könnte Ihnen auch gefallen