4 candidate quiz game

as you see the quiz game is widely popular in TV shows and school competition.The team which presses the  button first is entitled to give the answer.the article presented here will demonstrate the 4 player quiz game has build around  8051 controller.

Proteus design

four parallel switches corresponding to four different teams are connected from p1.0 to p1.3. a buzzer is connected to port P3.5 which goes high whenever a switch has been pressed.the output will be shown on seven segment(common cathode) connected with port2. reset pin at p3.5 will keep the system to its initial stage for another round to be occurred.

 

CODE

it will keep monitoring the situation until any team have got press the button it they do the number of that team will be send to function display();

 

the function display will display corresponding team number on seven segment and buzzer will be sounding until you press reset key.by pressing reset key you'll instruct the controller to both turn off the sounder and clear the 7segemnt.

 

complete code

#include<reg51.h>
sbit en= P3^0;                                  //7-segment enable pin
unsigned char digi[4]={0x06,0x5b,0x4f,0x66}; //candidate sign
sbit stop=P3^7;                             // reset buzzer
sbit buzzer=P3^5;                          //  Buzzer
sbit sw1=P1^0;                              //button
sbit sw2=P1^1;
sbit sw3=P1^2;
sbit sw4=P1^3;
void check(); 
void main()
{
P1=0xff;
check();
}
void delay(unsigned char x)        
{
    int i,j;
    for(i=0;i<x;i++)
    for(j=0;j<1275;j++);
}
void display(unsigned int dig)
{    
en=0;
P2=digi[dig];
while(stop!=0)
    {
    buzzer=0;
        delay(1);
        buzzer=1;
    }
    en= 1;
}
void check() //monitor switches
{
    while(1)
    {
        while (P1 == 0xff);
        while (sw1==0)        //Check if switch 1 is pressed
        {
            display(0);
        }
        while (sw2==0)        //Check if switch 2 is pressed
        {
   
            display(1);
        }    
        while (sw3==0 )        //Check if switch 3 is pressed
        {
            
            display(2);
        }
        while (sw4==0)        //Check if switch 4 is pressed
        {
           
            display(3);
        }
    }
}  

VIDEO

 

Category: 

tags: 

Share

Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate