Posts

Showing posts with the label LED

TO TURN ON THE LED USING LPC2148

Image
SIMULATOR: PROTEUS 8.0 SOFTWARE: KEIL  CIRCUIT DIAGRAM: WORKING: This project is about turning on the led connected to P0.0 pin of lpc 2148.In this project,LED is connected in current sinking arrangement. Whenever logic 0 is provided to P0.0 pin of lpc 2148, LED get turned ON.As in this project current sinking arrangement is used hence logic 0 is provided to turn on the led. PROGRAM: #include<LPC214x.h>      // Header file of LPC2148 int main() IODIR0=0x00000001;// select p0.1 as an output pin PINSEL0=0x00000000; // select gpio function of p0.1 while(1)   // continuous loop { IOCLR0 = 0x00000001;//turn on the led } } PROGRAM DESCRIPTION: Here,using IODIR register p0.0 pin is set as an output pin.PINSEL0 register is used to select the GPIO(General purpose input/output pin) function of the pin. Using IOCLR register logic 0 is provided to port 0.0 pin. While loop is used for the continuous process. VIDEO:     Note: Please refer below article to know more about

Blinking LEDs using AVR (ATMEGA 32)

Image
SIMULATOR:   PROTEUS 8.0 SOFTWARE: WIN AVR CIRCUIT DIAGRAM: CIRCUIT DESCRIPTION: Here, LEDs are connected to the port b register of AVR. I have used the current-sinking arrangement. Therefore, I have provided logic 0 to turn on the LED and logic 1 to turn off the LED. PROGRAM: #include<avr/io.h>     void delay(unsigned int t); // delay function int main(void)     // main program { DDRB=0XFF;   //   Select PORT B as an output port while(1)              // continuous loop { PORTB=0X00;   // turned on the LEDs delay(10); // delay  PORTB=0XFF; // turned off the LEDs } } void delay(unsigned int t) // delay function { unsigned int i; for(i=0;i<1275*t;i++); } PROGRAM DESCRIPTION: DDRx: Here, DDR stands for data direction register and x represents the port number. Here, I have used port b. So, in place of x,I have written B. It is used to decide whether the port is acting as an input port or an output port. DDRx=0X00; // port x is acting as

To control leds through button using 8051 Micro-Controller

Image
SOFTWARE : KEIL MICRO VISION 4 SIMULATOR : PROTEUS 8.0 CIRCUIT DIAGRAM: CIRCUIT WORKING: Leds are connected to port 1.0 and port 1.2 pins of port 1.I have used push button which is connected to p3.1.Leds do not get turned ON until the button is pressed. I ha ve designed this circuit as a current-sinking circuit.So in order to turn ON the leds I have provided 0V(logic 0) and for turning OFF the leds 5V(logic 1) is provided to the respective pins. If the button(p3.1) is at logic '0' then it is considered as button is pressed. PROGRAM : #include <reg51.h> sbit led1 = P1^0; sbit led2 = P1^2; sbit sw = P3^1; void main() { P1=0xfc; // set port 1.0 as output led1=1; // initially turn off the led1 & led2 led2=1; while(1) //continuous loop { if(sw==0) // button is pressed { led1 = 0; // turn on the led1 led2=0; // turn on the led2 } else { led1=1; //turn off the led1 led2=1; //turn off the led2 } } } PROGR

To turn LED ON using 8051 Micro-Controller

Image
SOFTWARE: KEIL MICRO VISION 4 SIMULATOR: PROTEUS 8.0 CIRCUIT DIAGRAM: CIRCUIT WORKING: This project is about turning on the led which is connected to port 1.0 of port 1. I have designed this circuit as a current sinking circuit.So in order to turn ON the led,I have provided 0V(logic 0) on port 1.0. PROGRAM : #include<reg51.h> sbit led1 = P1^0; void main() { P1=0xfc; // set Port 1.0 as output led1=1; // initially turn off the led while(1) //continuous loop { led1 = 0; // turn on the led1 } } PROGRAM DESCRIPTION: At starting I have make turned off the led by providing logic 1 (Port1.0).Then for a continuous process,I have used while loop.After that I have turned ON the led by providing logic 0. VIDEO: