While (SWITCH=0xdf) // Button 6 is pressed. While (SWITCH=0xef) // Button 5 is pressed. While (SWITCH=0xf7) // Button 4 is pressed. While (SWITCH=0xfb) // Button 3 is pressed. While (SWITCH=0xfd) // Button 2 is pressed. While(rst!=0) // display the digit until the reset is pressed.
While (SWITCH=0xfe) // Button 1 is pressed.ĭelay(1000) // Activate buzzer for 1 second. While(SWITCH=0xff) // wait until any button is pressed. Unsigned char ch= // Hexadecimal values from 0 to 9. Sbit digit=P3^7 // 7-Segment Display Common Pin (to enable) Sbit rst=P3^3 // Reset Switch (Reset the display) - not the microcontroller #define SWITCH P1 // Input Switches (buttons) to PORT1 #define SEGMENT P2 // PORT2 to Segments of 7-Segment Display When we give direct 5V supply to the buzzer it works, but not in the circuit. The base-emitter junction would always be forward biased whatever you put at the microcontroller pin, bcoz of same reason stated above.ġ) Use an NPN transistor and common cathode displays.Ģ) Provide 5V supply to the displays if possible (preferred solution)ģ) Go for a two transistor circuit involving an NPN transistor as first stage switching the PNP in the second stageĤ) Use ULN2803 in between display and microcontoller, with supply voltage of 12V for ULN2803.Project: 8 channel quiz buzzer circuit using 8051 microcontroller from this site.įor the first candidate who presses their button, their number will show on the 7-segment display and the buzzer will make a sound.I am using peizo-buzzer in the circuit.Īfter making all the connections, the display is working but the buzzer is not making any sound. So they turn ON dim.Īgain, another problem you may face is that, you won't be able to turn off the transistor with the microcontroller. Effectively, the leds turn on at the difference voltage of 7V (12-5=7V). Now what you have done is that the common anode of the leds is connected to 12V and the cathodes(of leds which you wish to be OFF) to 5V. Since you are connecting the cathodes to a microcontroller, you put a logic high on those pins which corresponds to 5V. Now think about the segments you tried to turn OFF.
You supply 0V at the cathode pins of the segments you need to turn ON, here the pins are: A,B,C,D & E. What you provide at the common anode through the transistor is 12V. You have used BC557 which is a PNP transistor, so I infer you have used common anode displays.Īssume you need to display '3'.