LPC2148 is a ARM7 family controller which manufacture by Philips Company. it has Total 64 pin for interface but out of them only 48 pin we can use for the our interfacing rest of the 16 pin is use for special purpose like crystal,power supply ,etc..
GPIO means General Purpose Input Output. using this feature we can operate LED, LCD, Keypad, Buzzer, etc.. that means we can interace those all things which can operate by 0 or 1 (0volt ot +5volt). here 0 means low or ground and 1 means high or Vcc (+5v).
for this interface we required one lpc2148 development Board and Keil-4 IDE. the most important thing is Datasheet which is very important in Embedded System. you can download datasheet from here.
In lpc2148 there is two port P0 and P1. so we can access any pin using this port and pin number for Example
if i want to access port-0 and pin-0 then write P0.0.
as we seen we can use 48 pin for our purpose so available pins are P0.0 to P0.31 from port-0 and P1.16 to p1.31 from port-1.
open chapter-8 in datasheet. there you can see which pin we can use for GPIO and Require Register to operate each of pin from controller as GPIO.
Registers:
1.IOPIN
It is a GPIO port pin value register. mostly it is use to check the status of the pin. applications like Switch, keypad, digital sensor.
2.IODIR
It is Input Outpur Direction Register. it is use for to set Direction of the port or pin like as input or output.
0- input
1- output
3.IOSET
using this register we can set the output port or pin. 0 will not effect in this register. if we give 1 then it will set the pin as high or we can say it will give Vcc output from that port or pin.
4.IOCLR
using this register we can clear the output port or pin. 0 will not effect in this register. if we give 1 then it will set the pin as low or we can say it will give 0volt output from that port or pin.
GPIO means General Purpose Input Output. using this feature we can operate LED, LCD, Keypad, Buzzer, etc.. that means we can interace those all things which can operate by 0 or 1 (0volt ot +5volt). here 0 means low or ground and 1 means high or Vcc (+5v).
for this interface we required one lpc2148 development Board and Keil-4 IDE. the most important thing is Datasheet which is very important in Embedded System. you can download datasheet from here.
In lpc2148 there is two port P0 and P1. so we can access any pin using this port and pin number for Example
if i want to access port-0 and pin-0 then write P0.0.
as we seen we can use 48 pin for our purpose so available pins are P0.0 to P0.31 from port-0 and P1.16 to p1.31 from port-1.
open chapter-8 in datasheet. there you can see which pin we can use for GPIO and Require Register to operate each of pin from controller as GPIO.
Registers:
1.IOPIN
It is a GPIO port pin value register. mostly it is use to check the status of the pin. applications like Switch, keypad, digital sensor.
2.IODIR
It is Input Outpur Direction Register. it is use for to set Direction of the port or pin like as input or output.
0- input
1- output
3.IOSET
using this register we can set the output port or pin. 0 will not effect in this register. if we give 1 then it will set the pin as high or we can say it will give Vcc output from that port or pin.
4.IOCLR
using this register we can clear the output port or pin. 0 will not effect in this register. if we give 1 then it will set the pin as low or we can say it will give 0volt output from that port or pin.
Programme
#include<lpc214x.h>
void delay(int count);
int main()
{ int i,j;
IODIR0=0xffffffff; //P0 as output
while(1)
{
IOSET0=0xffffffff;
delay(50);
IOCLR0=0xffffffff;
delay(50);
}
}
void delay(int count)
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<5000;j++);
}