1. Circuit Diagram

Dept of ISE,MSRIT Page 1


2.1 Power Supply Design

Dept of ISE,MSRIT Page 2


The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from the mains supply is step down by the transformer to 5V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage.

230V AC 50Hz

D.C Output

Step down transform

Bridge Rectifie



Fig: Power supply

Dept of ISE,MSRIT Page 3

Dept of ISE. 230V is to be brought down to the required voltage level. DC voltages are required to operate various electronic equipment and these voltages are 5V.C. Thus. This is done by a transformer. a step down transformer is employed to decrease the voltage to a required level. a bridge rectifier is used because of its merits like good stability and full wave rectification. Rectifier The output from the transformer is fed to the rectifier. The rectifier may be a half wave or a full wave rectifier.C.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Transformer Usually. It converts A. into pulsating D. In this project.c input available at the mains supply i.MSRIT Page 4 . But these voltages cannot be obtained directly.e.. 9V or 12V. Thus the a.

MSRIT Page 5 . diodes D1 and D3 conduct. diodes D2 and D4 conduct whereas. The Bridge rectifier circuit is shown in the figure.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) The Bridge rectifier is a circuit. Thus a bi-directional wave is converted into a unidirectional wave. whereas diodes D2 and D4 remain in the OFF state. For the positive half cycle of the input ac voltage. Dept of ISE. which converts an ac voltage to dc voltage using both half cycles of the input ac voltage. For the negative half cycle of the input ac voltage. The load resistance is connected between the other two ends of the bridge. The circuit has four diodes connected to form a bridge. The conducting diodes D2 and D4 will be in series with the load resistance RL and hence the current flows through RL in the same direction as in the previous half cycle. The conducting diodes will be in series with the load resistance RL and hence the load current flows through RL. D1 and D3 remain OFF. The ac input voltage is applied to the diagonally opposite ends of the bridge.


Each type employs internal current limiting. Dept of ISE. In this project. if either of the two is varied. power supply of 5V and 12V are required. making it useful in a wide range of applications. 12 represent the required output voltage levels. These regulators can provide local on-card regulation. D2PAK and DPAK packages and several fixed output voltages. The first number 78 represents positive supply and the numbers 05. thermal shut-down and safe area protection. voltage received at this point changes. Although designed primarily as fixed voltage regulators. It removes the ripples from the output of rectifier and smoothens the D. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level.C. they can deliver over 1 A output current. making it essentially indestructible. Voltage regulator As the name itself implies.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Filter Capacitive filter is used in this project.C. D. TO-3.MSRIT Page 7 . In order to obtain these voltage levels. 7805 and 7812 voltage regulators are to be used. TO-220FP. The L78xx series of three-terminal positive regulators is available in TO220. However. Therefore a regulator is applied at the output stage. these devices can be used with external components to obtain adjustable voltage and currents. If adequate heat sinking is provided. Output received from this filter is constant until the mains voltage and load is maintained constant. it regulates the input applied to it. eliminating the distribution problems associated with single point regulation.

2 AT89C51 Microcontroller MICROCONTROLLERS Microcontrollers’ producers have been struggling for a long time for attracting more and more choosy customers.MSRIT Page 8 . Nevertheless. by analyzing their structure it is concluded that most of them have the same (or at least very similar) architecture known in the product catalogs as “8051 compatible”. several circuits belonging to this Series had quite modest features in comparison to the new ones. more memory and more high-quality A/D converters comes on the market. What is all this about? The whole story began in the far 80s when Intel launched its series of the microcontrollers labeled with MCS 051. Every couple of days a new chip with a higher operating frequency. Dept of ISE.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 2. they took over the world very fast and became a standard for what nowadays is meant by a word microcontroller. Although.

 Two 16-bit Timer/Counters.  2. Besides.7V to 6V Operating Range.  Two-level Program Memory Lock.MSRIT Page 9 .  Fully Static Operation: 0 Hz to 24 MHz. What is it what makes this microcontroller so special and universal so that almost all the world producers manufacture it today under different name? FEATURES OF AT89C51  4K Bytes of Re-programmable Flash Memory.  RAM is 128 bytes.  32 Programmable I/O Lines.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) The reason for success and such a big popularity is a skillfully chosen configuration which satisfies needs of a great number of the users allowing at the same time stable expanding ( refers to the new types of the microcontrollers ). Dept of ISE. it simply was not profitable to change anything in the microcontroller’s basic core. That is the reason for having a great number of various microcontrollers which actually are solely upgraded versions of the 8051 family.  128 x 8-bit Internal RAM. since a great deal of software has been developed in the meantime.

 Programmable Serial UART Channel. 128Kb RAM (including SFRs as well) satisfies basic needs.MSRIT Page 10 . Dept of ISE.  Low-power Idle and Power-down Modes • • 4 Kb program memory is not much at all. but it is not imposing amount.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51)  Six Interrupt Sources.


2 P1.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Pin Description Pin No 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18&19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Function Name P1.1 P1.1 External interrupt 1 Int0 P3.5 P1.4 P1.3 External interrupt 2 Int1 Timer1 external input T0 put port P3.7/AD7 P0.0/ A8 P2.5/ A13 P2. Read from external program memory PSEN Address Latch Enable ALE Program pulse input during Flash programming Prog External Access Enable.7 Reset pin.2 input/out P3.6/ A14 P2.5/AD5 Dept of ISE.6 Write to external data memory Write 3 Read from external data memory Read P3. 12V (during Flash programming) Vpp 8 bit input/output port (P0) pins P0.3/ A11 P2.6 P1.6/AD6 Low-order address bits when interfacing with external memory P0. Active high Reset Input (Rx) for serial communication RxD P3.7 Quartz crystal oscillator (up to 24 MHz) Crystal 2&1 Ground (0V) Ground P2.5 (P3) pins P .4/ A12 High-order address bits when interfacing with external memory P2.0 P1. Vcc for internal program executions EA Programming enable voltage.MSRIT Page 12 .4 Timer2 external input T1 P3.7/ A15 Program store enable.0 Output (Tx) for serial communication TxD 8 bit P3.3 8 bit input/output port (P1) pins P1.2/ A10 / P2.1/ A9 8 bit input/output port (P2) pins P2.

It is used for amplification and switching purposes.MSRIT Page 13 .6V) P0.4/AD4 P0. bipolar junction transistor. NPN.1/AD1 P0.2/AD2 P0.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 35 36 37 38 39 40 Supply voltage.3 Transistor BC548 BC548 is general purpose silicon. Dept of ISE. 5V (up to 6. The current gain may vary between 110 and 800.3/AD3 P0.0/AD0 Vcc 2. The maximum DC current gain is 800.

For amplification applications. it gets completely off.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Its equivalent transistors are 2N3904 and 2SC1815. BC548 is used in common emitter configuration for amplifiers. 548B and 548C which vary in range of current gain and other characteristics. This is known as the biasing. These equivalent transistors however have different lead assignments. The transistor terminals require a fixed DC voltage to operate in the desired region of its characteristic curves. The voltage divider is the commonly used biasing mode. transistor is biased so that it remains fully on if there is a signal at its base. the transistor is biased such that it is partly on for all input conditions. For switching applications.4 Seven Segment Display Dept of ISE. In the absence of base signal. Pin Diagram 2. The variants of BC548 are 548A.MSRIT Page 14 . The input signal at base is amplified and taken at the emitter.

In CC configuration. While eight pins correspond to the eight LEDs.MSRIT Page 15 . In CA arrangement. They are laid out as a squared-off figure ‘8’. Every LED is assigned a name from 'a' to 'h' and is identified by its name. Common cathode (CC) and Common anode (CA). These segments come in two configurations. microwave ovens. electronic meters etc. Seven LEDs 'a' to 'g' are used to display the numerals while eighth LED 'h' is used to display the dot/decimal. the remaining two pins (at middle) are common and internally shorted. namely.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) A seven segment display is the most basic electronic display device that can display digits from 0-9. The most common configuration has an array of eight LEDs arranged in a special pattern to display these digits. A seven segment is generally available in ten pin package. radio. the common pin is given a high logic and the LED pins are given low to display a number. They find wide application in devices that display numeric information like digital clocks. Dept of ISE. The common is connected to ground and a particular LED glows when its corresponding pin is given high. the negative terminals of all LEDs are connected to the common pins.

8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Pin Diagram 2.5 Piezo Buzzer Dept of ISE.MSRIT Page 16 .

When a potential is applied across these crystals. This.MSRIT Page 17 . they push on one conductor and pull on the other.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) The piezo buzzer produces sound based on reverse of the piezoelectric effect. Most buzzers produce sound in the range of 2 to 4 kHz. The buzzer produces a same noisy sound irrespective of the voltage variation applied to it. counter signal or sensor input. They are also used in alarm circuits. Pin Diagram Dept of ISE. The generation of pressure variation or strain by the application of electric potential across a piezoelectric material is the underlying principle. results in a sound wave. The red lead is connected to the input and the black lead to the ground. It consists of piezo crystals between two conductors. push and pull action. These buzzers can be used to alert a user of an event corresponding to a switching action.

Dept of ISE.MSRIT Page 18 .8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 2. There is also no need for additional explanation of how these components operate.6 Switches and Pushbuttons There is nothing simpler than this! This is the simplest way of controlling appearance of some voltage on microcontroller’s input pin.

Dept of ISE. error occurs in almost 100% of cases! The simplest solution is to connect simple RC circuit which will “suppress” each quick voltage change.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Nevertheless. The advantages of such solution are obvious: it is free of charge. If the change is confirmed it means that switch (or pushbutton) has changed its position. Concerning pulse counter. shown on the figure (RS flip-flop)..a common problem with m e c h a n i c a l switches. whole this process does not last long (a few micro. Since the bouncing time is not defined.MSRIT Page 19 . If contact switching does not happen so quickly. This is about something commonly unnoticeable when using these components in everyday life. changes logic state on its output with the first pulse triggered by contact bounce. effects of disturbances are eliminated too and it can be adjusted to the worst-quality contacts. Even though this is more expensive solution (SPDT switch). radical measures should be taken! The circuit. If complete safety is needed. since the condensator is not used. but long enough to be registered by the microcontroller.or miliseconds). It is about contact bounce. the problem is definitely resolved! Besides. In addition to these hardware solutions.. Anyway. very short pulses can be also registered in this way. the check should be done one more time after certain time delay. the values of elements are not strictly determined. The reasons for this are: vibrations. a simple software solution is commonly applied too: when a program tests the state of some input pin and finds changes. slight rough spots and dirt. several consecutive bounces can be noticed prior to maintain stable state. it is not so simple in practice. In the most cases. the values shown on figure are sufficient.

The project can be created in any of the drives available. Click on “New project”. You can create a new folder and then a new file or can create directly a new file. A small window opens showing the options like new project. STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN KEIL AND HOW TO COMPILE IT: 1. After installation. an icon will be created with the name “Keil uVision3”. 4. the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. The window asks the user to give the project name with which it should be created and the destination location. Double click on this icon to start the keil compiler. Install the Keil Software in the PC in any of the drives. open project etc. Now to start using the keil. a window opens where a list of vendors will be displayed and you have to select the device for the target you have created. After compilation.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 3. A page opens with different options in it showing the project workspace at the leftmost corner side.MSRIT Page 20 . A small window with the title bar “Create new project” opens. Keil compiler also supports C language code. 6. 2. SOFTWARE TOOLS 3. 3.1 Keil Software Keil compiler is a software used where the machine language code is written and compiled. click on the option “project”. 8. Dept of ISE. 7. output window in the bottom and an ash coloured space for the program to be written. 5. import project. Just drag this icon onto the desktop so that it becomes easy whenever you try to write programs in keil. After the file is saved in the given destination location.

16. The most widely used vendor is Atmel. This is because the program what we write here in the keil will later be dumped into the microcontroller and will be stored in the inbuilt ROM in the microcontroller.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 9. After the program is completed. When you click on any one of the microcontrollers.asm extension. You can select any one of the microcontrollers according to the requirement. Click on this microcontroller and have a look at its features.MSRIT Page 21 . 15. Now add this file to the target by giving a right click on the source group. Now click on “File” and in that “New”. The most appropriate microcontroller with which most of the projects can be implemented is the AT89C51. save it with any name but with the . A list of options open and in that select “Add files to the source group”. Now click on “OK” to select this microcontroller. You can notice that after you save the program.0592 MHz to interface with the PC. First click on “target”. output etc. So click on Atmel and now the family of microcontrollers manufactured by Atmel opens. A new page opens and you can start writing program in it. 10. 17. Right click on the target and select the first option “Options for target”. the features of that particular microcontroller will be displayed on the right side of the page. Save the program in the file you have created earlier. 18. 12. 14. Now you can see the TARGET and SOURCE GROUP created in the project workspace. just enter this frequency value in the Xtal (MHz) text area and put a tick on the Use on-chip ROM. Since the set frequency of the microcontroller is 11. Check for this file where you have saved and add it. target. Dept of ISE. Just click on “No” to proceed further. 11. A small window opens asking whether to copy the startup code into the file you have created just now. the predefined keywords will be highlighted in bold letters. 13. A window opens with different options like device.

After this is done. To check for the output. You can even use the shortcut key F7 to compile the program written. You can change the folder by clicking on “Select folder for Objects”. Dept of ISE. select the appropriate window to see the output by entering into debug mode. 20. 21. click the icon “debug” again to come out of the debug mode. there are several windows like serial window. Now to check whether the program you have written is errorless or not. Depending on the program you have written. Now click the option “Output” and give any name to the hex file to be created in the “Name of executable” text area and put a tick to the “Create HEX file” option present in the same window. 22. 23. 25. The hex file can be created in any of the drives. click on the icon exactly below the “Open file” icon which is nothing but Build Target icon. Click on this icon and now click on the option “View” and select the appropriate window to check for the output. memory window. 24. The hex file created as shown earlier will be dumped into the microcontroller with the help of another software called Proload. The icon with the letter “d” indicates the debug mode. project window etc.MSRIT Page 22 .8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 19.

Install the Proload Software in the PC. 7. Click on the Proload icon in the PC.2 PROLOAD Proload is a software which accepts only hex files. 4.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 3. 5. Dept of ISE. 3. Power up the programmer kit from the ac supply through adapter. Once the machine code is converted into hex code. Now connect the Programmer kit to the PC (CPU) through serial cable. 2. Now place the microcontroller in the GIF socket provided in the programmer kit. After this process is completed. device type. Thus this is accomplished from the power supply board with an output of 12volts or from an adapter connected to 230 V AC. remove the microcontroller from the programmer kit and place it in your system board. that hex code has to be dumped into the microcontroller placed in the programmer kit and this is done by the Proload. Now the system board behaves according to the program written in the microcontroller. this power supply is given from the power supply circuit designed above. Flash size etc. The status of the microcontroller can be seen in the small status window in the bottom of the page. As this programmer kit requires power supply to be operated. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply. 1. a source is required. Programmer kit contains a microcontroller on it other than the one which is to be programmed.MSRIT Page 23 . 6. Click on browse option to select the hex file to be dumped into the microcontroller and then click on “Auto program” to program the microcontroller with that particular hex file. A window appears providing the information like Hardware model. This microcontroller has a program in it written in such a way that it accepts the hex file from the keil compiler and dumps this hex file into the microcontroller which is to be programmed. com port.

void delay() { int i.j<1275. // Buzzer pin to sound the buzzer.h> unsigned int digi_val[10]={0x40. while(stop_pin != 0). sbit buzzer_pin=P0^0. sbit stop_pin = P3^1.0x12. { P2=digi_val[current_dig].MSRIT Page 24 // Time delay function // Enable pin to enable the seven segment. delay(). // Hex value corresponding to the digits 0 to 9 sbit output_on_pin = P3^0. SOURCE CODE // Program to make a quiz buzzer using seven segment #include<reg51. output_on_pin = 1.0x00.0x30. buzzer_pin=1. .j++).0xF9.0x02.j.0x19. buzzer_pin=0.0x10}.i<200.0x24. } Dept of ISE. int flag.i++) for(j=0. for(i=0.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 4.0xF8. // Stop pin to reset the buzzer. } void display(unsigned int current_dig) // Function to display the resultant digit on the seven segment and sound the buzzer.

} while (P1 == 0xF7 ) { flag = 4. while(1) { while (P1 == 0xFF). display(2).8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) void buzzer() //Function to monitor the input switches { flag = 0. display(1).MSRIT Page 25 //Check if switch 4 is pressed //Check if switch 3 is pressed //Check if switch 2 is pressed //Check if switch 1 is pressed . } while (P1 == 0xFD) { flag = 2. } while (P1 == 0xFB ) { flag = 3. while (P1 == 0xFE) { flag = 1. display(3). display(4). } Dept of ISE.

} while (P1 == 0x7F ) { flag = 8. display(6). } while (P1 == 0xDF) { flag = 6. display(8). output_on_pin = 0.MSRIT //Check if switch 5 is pressed //Check if switch 6 is pressed //Check if switch 7 is pressed //Check if switch 8 is pressed Page 26 . } } Dept of ISE. stop_pin = 1. display(7). display(5).8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) while (P1 == 0xEF ) { flag = 5. } P1 = 0xFF. } while (P1 == 0xBF ) { flag = 7.

stop_pin = 1. buzzer(). P1 = 0xFF.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) void main() { output_on_pin=0.MSRIT Page 27 . } Dept of ISE.

Eight pins of port P1 of the microcontroller are corresponding to eight inputs and one stop pin for resetting the buzzer system. A typical seven segment looks like as shown in the figure below. there will be no effect on the system till the time the stop pin is pressed to reset the system. As soon as any one of the inputs is pressed. There are a total of nine input pins. refer ‘seven segment interfacing ’. There is also a provision for sounding a buzzer for a small duration. which shows the number corresponding to the team which has pressed the button first.MSRIT Page 28 .8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 5. the buzzer sounds for a small duration. A seven segment consists of eight LEDs which are aligned in a manner so as to display digits from 0 to 9 when proper combination of LED is switched on. The microcontroller keeps scanning the input pins. When the system starts. Dept of ISE. input pins and output pins is shown in the circuit diagram. On the output side a seven segment is connected to display the corresponding output number. The connections of the seven segment. A buzzer is also sounded for a small duration to give an acoustic alarm. WORKING PROCEDURE This quiz buzzer system has eight input pins corresponding to eight teams. The seven segment displays the number corresponding to the input pressed. Seven segment uses seven LED’s to display digits from 0 to 9 and the eighth LED is used for the dot. Now even if any other input pin is pressed. The output is displayed on a seven segment display (interfaced with microcontroller). the seven segment does not displays any output.

Table below shows the hex values used to display the different digits. The pins a to g of the Seven Segment are connected to the Port P2 of the microcontroller.MSRIT Page 29 . Since the seven segment display works on negative logic. The common pin of the seven segment is connected to Vcc. The ‘h’ has not been used.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Seven Segment are available in two configuration . Dept of ISE. The circuit diagram shows the connections of seven segment to the controller. which is the dot pin of the controller.(1) Common Anode (2) Common Cathode. Here common anode seven segment display is used because the output current of the microcontroller is not sufficient enough to drive the LED’s. we will have to provide logic 0 to the corresponding pin to make an LED glow. similar to the case of driving an LED.

MSRIT Page 30 .8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) DIGIT 0 1 2 3 4 5 6 7 8 9 a 0 1 0 0 1 0 0 0 0 0 b 0 0 0 0 0 1 1 0 0 0 c 0 0 1 0 0 0 0 0 0 0 d 0 1 0 0 1 0 0 1 0 1 e 0 1 0 1 1 1 0 1 0 1 f 0 1 1 1 0 0 0 1 0 0 g 1 1 0 0 0 0 0 1 0 0 HEX Value 0x40 0xF9 0x24 0x30 0x19 0x12 0x02 0xF8 0x00 0x10 When the values corresponding to the digits 0 to 9 are given on the output port. the digit gets displayed on the seven segment. ADVANTAGES AND APPLICATIONS Dept of ISE. 6.

7. CONCLUSION Dept of ISE.MSRIT Page 31 .8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) ADVANTAGES Highly sensitive Low cost and reliable circuit Complete elimination of manpower APPLICATIONS Widely used in school. colleges and TV programs .

TV programs etc. colleges.MSRIT Page 32 . with eight different switches. REFERENCE Dept of ISE.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) Hence by this project we can design an effective detecting system that can monitor in quiz competitions in schools. The uniqueness of this project is only alerting the quiz conductor who first know the answer. 8.

WWW. EMBEDDED SYSTEM BY RAJ KAMAL 3.MSRIT Page 33 .Engineersgarage. WWW.com 8. howstuffworks. 8051 MICROCONTROLLER AND EMBEDDED SYSTEMS BY MAZZIDI 6.8 CANDIDATE QUIZ BUZZER USING 8051 MICRO CONTROLLER (AT89C51) 1.com Dept of ISE.google.com 2. Electrikindia 7. WWW.

Sign up to vote on this title
UsefulNot useful