LPC2148 is a 32-bit microcontroller by NXP. I discuss a simple LED interface program interfaced with LPC2148 microcontroller to make you understand its register and PINSEL functions.
Program:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LPC214X.H> // Select Header file | |
long i; | |
int main() | |
{ | |
IODIR1=0xffffffff; //This register individually controls the direction of each port pin. | |
IOCLR1=0xffffffff; //This register controls the state of output pins. | |
While(1) //Infinite loop | |
{ | |
IOSET1=0x00FF0000; //This register controls the state of output pins in conjunction with the IOCLR register. | |
For(i=0;i<100000;i++); //Delay | |
for(i=0;i<100000;i++); | |
IOCLR1=0xffffffff; | |
for(i=0;i<100000;i++); | |
for(i=0;i<100000;i++); | |
} | |
} |
Comments
Post a Comment