NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


// Program to make a quiz buzzer using seven segment

#include<reg51.h>
unsigned int digi_val[10]={0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0xF8,0x00,0x10}; // Hex value corresponding to the digits 0 to 9
sbit output_on_pin = P3^0; // Enable pin to enable the seven segment.
sbit stop_pin = P3^1; // Stop pin to reset the buzzer.
sbit buzzer_pin=P0^0; // Buzzer pin to sound the buzzer.
int flag;

void delay() // Time delay function
{
int i,j;
for(i=0;i<200;i++)
for(j=0;j<1275;j++);
}

void display(unsigned int current_dig) // Function to display the resultant digit on the seven segment and sound the buzzer.
{
P2=digi_val[current_dig];
output_on_pin = 1;
buzzer_pin=0;
delay();
buzzer_pin=1;
while(stop_pin != 0);
}

void buzzer() //Function to monitor the input switches
{
flag = 0;
while(1)
{
while (P1 == 0xFF);

while (P1 == 0xFE) //Check if switch 1 is pressed
{
flag = 1;
display(1);
}

while (P1 == 0xFD) //Check if switch 2 is pressed
{
flag = 2;
display(2);
}

while (P1 == 0xFB ) //Check if switch 3 is pressed
{
flag = 3;
display(3);
}

while (P1 == 0xF7 ) //Check if switch 4 is pressed
{
flag = 4;
display(4);
}

while (P1 == 0xEF ) //Check if switch 5 is pressed
{
flag = 5;
display(5);
}

while (P1 == 0xDF) //Check if switch 6 is pressed
{
flag = 6;
display(6);
}

while (P1 == 0xBF ) //Check if switch 7 is pressed
{
flag = 7;
display(7);
}

while (P1 == 0x7F ) //Check if switch 8 is pressed
{
flag = 8;
display(8);
}

P1 = 0xFF;
stop_pin = 1;
output_on_pin = 0;
}
}

void main()
{
output_on_pin=0;
stop_pin = 1;
P1 = 0xFF;
buzzer();

}


     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.