LPC2148 basic programming tutorial: In the following LPC2148 tutorial i used books to learn fundamental knowledge about Embedded system. After that i install Kiel compiler and Proteus simulator tool to implement following basic LPC2148 programming tutorial:
Interfacing of Switch with LPC2148: In this tutorial LED is blink using Switch using LPC2148 controller. If you want to learn more kindly see tutorial on youtube as well.
>> Switch interface with LPC2148 C Code: #include<LPC214x.h> // Define LPC2148 Header File #define led (1<<2) // led macro for pin 2 of port0 #define sw (1<<10) // sw macro for pin 2 of port0
int main(void) { unsigned int x;
IO0DIR|= (~sw); //Configure P0.10 as Input IO0DIR|= led; //Configure P0.2 as Output
while(1) { x=IOPIN0 & sw; // save status of switch in variable x if(x==sw) // if switch open { IOCLR0|=led ; // LED off } else // if switch close { IOSET0|=led ; // LED ON } } }