In all GPIO Programming,
First ARM ports are set to input and output using IODIR
For port 0: it will be IODIR0
Port1:IODIR1, and so on
Fr changing data or writing data to pin IOSET command is used
For PORT0: IOSET0 and for PORT 1 it is IOSET1
Similarly for clearing output pin IOCLR is used as in the following program.
Example For ARM GPIO Programming- LED Running :
#include <lpc213x.h>
void delay_ms(unsigned int count)
{
unsigned int j=0,i=0;
for(j=0;j<count;j++)
{
for(i=0;i<3000;i++);
}
}
/* start the main program */
int main()
{
//unsigned int i;
IODIR1 = 0xffffffff; //Configure the P1 pins as OUTPUT;
while(1)
{
IOSET1=0xffffffff;
delay_ms(1000);
IOCLR1= 0xffffffff;
delay_ms(1000);
}
}
The Circuit arrangement is as given below
No comments:
Post a Comment