Posts

Showing posts with the label projects based on 8051 micro-controller

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) {

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

Serial data transmission using 8051

Image
SOFTWARE:   KEIL MICRO VISION 4.0 SIMULATOR:   PROTEUS 8.0 CIRCUIT DIAGRAM: WORKING: Here in this project, I have transmitted the data to the virtual terminal. When all the data gets transmitted, the TI flag in the SCON register becomes equal to 1 which indicates the complete transmission of data(8 bit). Data which needs to be transmitted is first placed into the SBUF register and after that the further procedure is performed as mentioned below.I have used a 9600 baud rate. All the serial communication is done using TXD and RXD pin of 8051. PROGRAM: #include<reg51.h> int main() { unsigned char *d="WELCOME TO THE EMBEDDED SYSTEM"; // data which gets transmitted to the virtual terminal TMOD=0x20; // timer 1 in mode 2 SCON=0x50; // mode 1,8 bit data,1 stop bit,1 start bit TH1=0xfd; // 9600 baud rate TR1=1; // start timer 1 TI=0;   // clear transmit flag while(*d!='\0') { SBUF=*d; // send data to serial buffer d++; while(TI==0); // wait untill transmission is comple

Serial data reception using 8051

Image
SOFTWARE: KEIL MICRO VISION 4.0 SIMULATOR: PROTEUS 8.0 CIRCUIT DIAGRAM: WORKING: Here in this project, I have received the data from the virtual terminal and displayed the received data on an lcd.When all the data get received, the RI flag in the SCON register becomes equal to 1 which indicates the complete reception of data(8 bit). Received data gets stored into the SBUF register. I have taken the received data from the SBUF register and send this data on an lcd. I have used a 9600 baud rate.All the serial communication is done using TXD and RXD pin of 8051. PROGRAM: #include<reg51.h> sbit RS = P2^0;  sbit EN = P2^2; 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 delay(unsigned int t); // delay function int main() { unsigned char r; lcd_init(); // lcd initialization TMOD=0x20; // timer 1 in mode 2 SCON=0x50; // mode 1,8 bit data,1 stop bit,1 start bit TH1=0xf

To display custom characters on the lcd using 8051 micro-controller.

Image
SOFTWARE:   KEIL MICRO VISION 4 SIMULATOR:   PROTEUS 8.0 CIRCUIT DIAGRAM: WORKING: This project is about displaying custom characters on the lcd.Simple meaning of custom character is the character which is not available on the keyboard or which is made by modifying original characters. In the lcd display,to display characters which are already available in the form of ascii value (from 'a' to 'z' or any other characters) we do not need to do anything.By sending the ascii value or sending the character directly to the lcd we can able to display those characters(which are already available) on the lcd. In the lcd display,there is one controller which control all the operations of the lcd.Lcd controller has a memory called  CG-RAM(character generator random access memory)  which is used to create and store the custom character. Size of the CG-RAM is 64 bytes. At a time we can able to display 8 custom characters(for 5*8 matrix) and 4 custom characters(for 5*10 matrix) on th