ARM - LPC2148 GPIO Basics With Calculator - Learn - Pechnol - Pechnol
ARM - LPC2148 GPIO Basics With Calculator - Learn - Pechnol - Pechnol
ARM - LPC2148 GPIO Basics With Calculator - Learn - Pechnol - Pechnol
com/2016/03/20/arm-lpc2148-gpio-basics-calculator/
Pechnol
Pure Technology
Embedded
LPC2148GPIO
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/
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]
________
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/
________
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