Posts

Showing posts with the label switch

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