Posts

Showing posts with the label interfacing

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

PIANO USING AT89C51RD2

Image
SIMULATOR: PROTEUS 8.0 SOFTWARE: KEIL 4.0 CIRCUIT DIAGRAM:   CIRCUIT DESCRIPTION: Switches from one to seven are connected in pull-up configuration to p1.0 to p1.6 respectively. A buzzer is connected to p2.0. WORKING: In this project, I have created the prototype of the piano using seven switches and a buzzer. Seven switches are used as a seven keys(sa, re, ga, ma, pa, dha, ni, sa) of piano. A buzzer is used to generate the sound given by the controller(AT89C51RD2). Whenever a switch related to a particular key is pressed, the frequency of that particular key is applied to the buzzer by the controller(AT89C51RD2). PROGRAM: #include<reg51.h> sbit sw1 = P1^0;   // SA sbit sw2 = P1^1;  // RE sbit sw3 = P1^2; // GA sbit sw4 = P1^3; // MA sbit sw5 = P1^4; // PA sbit sw6 = P1^5; // DHA sbit sw7 = P1^6; // NI sbit pulse = P2^0; //buzzer void tune(unsigned int th,unsigned int tl); int main() {   while(1) { if(sw1==0)   { pulse = ~P2^0; tune(0xf8,0x77); // frequency of sa } if(sw2==0) {

DC motor interfacing using AT89C51RD2

Image
SIMULATOR: PROTEUS 8.0 SOFTWARE: KEIL 4.0 CIRCUIT DIAGRAM: PIN DESCRIPTION of L293D: VSS and VS: +5v to +9v GND: GND EN1: Enable pin of motor 1 EN2: Enable pin of motor 2 IN1 and IN2: Input pin of motor 1 IN3 and IN4: Input pin of motor 2 OUT1 and OUT2: Output pin of motor 1 OUT3 and OUT4: Output pin of motor 2 CIRCUIT DESCRIPTION: EN1 and EN2 are the enable pins of dc motor 1 and dc motor 2 respectively. Both the enable pins must be connected to VCC to run the dc motors. IN1and IN2 pins are connected to p2.0 and p2.1 respectively.IN3 and IN4 pins are connected to p2.3 and p2.4 respectively.OUT1 and OUT2 pins are connected to dc motor1.OUT3 and OUT4 pins are connected to dc motor2. Switch 1 and Switch 2 are connected in pull-up arrangement to port1.0 and port 1.5 respectively. WORKING: In this project, I have interfaced two dc motors using the AT89c51RD2 controller. Motor driver L293D is used to drive both the dc motors. Whenever switch1 is pressed, dc mot

LCD interfacing using AVR(ATMEGA 32)

Image
SIMULATOR: PROTEUS 8.0 SOFTWARE: KEIL 4.0 CIRCUIT DIAGRAM: PIN DESCRIPTION OF LCD: PROGRAM: #include<avr/io.h>   // header file for AVR #include<util/delay.h> // header file for delay function void lcd_init(void); void lcd_command(char c); void lcd_data(char d); void str(char a[]); int main(void)    // main program   { DDRB=0XFF;  //  Select PORT B as an output port DDRD=0XFF; // Select PORT D as an output port lcd_init();      // initialize the lcd while(1)             // continuous loop   { str("WELCOME TO THE");  lcd_command(0xc0);                  // move cursor to the next line str("EMBEDDED SYSTEM"); lcd_command(0x01);           // clear display } } void lcd_init(void)  // lcd initialization function { lcd_command(0x38); //8bit,2 line,5*7 matrix lcd_command(0x0c); //cursor off,display on lcd_command(0x80);//force cursor to the beginning of the first line lcd_command(0x01);// clear display lcd_co

LCD interfacing in 4 bit mode using 8051

Image
  SOFTWARE: KEIL MICRO VISION 4.0 SIMULATOR: PROTEUS 8.0 CIRCUIT DIAGRAM: PIN DESCRIPTION: PROGRAM: #include<reg51.h> sbit RS = P1^0; sbit EN = P1^1; void lcd_init(void); // lcd initialization function void lcd_command(unsigned char c);// lcd command function void lcd_data(unsigned char d);// lcd data function void lcd_string(unsigned char *ch);// string display function void delay(unsigned int t); // delay function int main() { lcd_init(); lcd_string("Welcome to the"); lcd_command(0xc0);// shift cursor to second row lcd_string("Embedded System"); while(1); } void lcd_init() { lcd_command(0x02);// 4 bit mode lcd_command(0x28);//4 bit mode,2 line,5x7 matrix lcd_command(0x0C); // display on,cursor off lcd_command(0x06); // entry mode lcd_command(0x01); // clear display lcd_command(0x80); // first location(begining) } void lcd_command(unsigned char c) { P1=(P1&0x0f)|(c&0xf0);// send higher nibble RS=0; // select command register EN=1; // send high