ELECTRONIC VOTING MACHINE

Electronic democratic machine has now supplanted the conventional component of casting a ballot because of a few preferences like security, programmed tallying and so on. This undertaking presents an approach to build up an electronic democratic machine which shows the check of decisions on a 16×2 LCD interface. A client can get his/her vote register through a lot of switches (one for every up-and-comer). After each cast of vote, the ensuing check can be seen on LCD. The circuit utilizes AT89C51 microcontroller and the code for the task has been written in C.

Component Required : –

8051 Microcontroller

Switch

LCD 16X2 DISPLAY

JUMPER WIRE

POWER SUPPLY

Connection Circuit :-

KITS4U TECH, ELECTRONIC VOTING MACHINE , ELECTRONIC VOTINGMACHINE USING 8051 MICROCONTROLLER

Project code :-

//Welcome to Kit4u Tech Blog //
#include<reg51.h>
sbit sw1=P1^0;
sbit sw2=P1^1;
sbit sw3=P1^2;
sbit sw4=P1^3;
sbit rs=P2^0;
sbit e=P1^1	;
sbit buz=P3^7;

char arr[10]={"0123456789"};
					 

char arr2[16]={"Bjp.. Cong..NOTA"};
char arr3[15]={"voting machine "};
char arr4[16]="winner is BJP...";
char arr5[16]="winner is CONG..";
char arr6[16]="winner is NOTA..";
void delay(int w)
{
int i;
for(i=0;i<w;i++);
}
void lcd_cmd(unsigned char x1)
{
P2=x1;
rs=0;
e=1;
delay(1000);
e=0;

}
void lcd_data(unsigned char x2)
{
P2=x2;
rs=1;
e=1;
delay(1000);
e=0;

}


void main()
{

char a,b,c,d,e,f,g,h,i,j,k,l,m;
k=l=m=buz=sw1=sw2=sw3=sw4=0;
lcd_cmd(0x38);
lcd_cmd(0x0c);
 jump:
 a=b=c=d=e=f=g=h=i=j=k=l=m=0;
 lcd_cmd(0x01);
  lcd_cmd(0x80);
  for(a=0;a<15;a++)
  {
  lcd_data(arr3[a]);
  delay(10000);
  }
 lcd_cmd(0x01);
  for(a=0;a<16;a++)
  {
  lcd_data(arr2[a]);
  delay(2000);
  }
  while(1)
 {
if(sw1==1)
  {
  jump1:
  while(sw1==1);
  
  
  k++;
  b=k/100;
  c=(k/10)%10;
  d=k%10;
    lcd_cmd(0xc0);
	  lcd_data(arr[b]);
	  lcd_cmd(0xc1);
	    lcd_data(arr[c]);
	    lcd_cmd(0xc2);
		  lcd_data(arr[d]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw1==0)
		 {
		     lcd_cmd(0xc0);
	  lcd_data(arr[b]);
	  lcd_cmd(0xc1);
	    lcd_data(arr[c]);
	    lcd_cmd(0xc2);
		  lcd_data(arr[d]);
if(sw1==1)
goto jump1;

if(sw4==1)
goto jump4;

if(sw2==1)
goto jump2;

if(sw3==1)
goto jump3;}}

if(sw2==1)
  {
   jump2:
  while(sw2==1);
  l++;
  e=l/100;
  f=(l/10)%10;
  g=l%10;
    lcd_cmd(0xc6);
	  lcd_data(arr[e]);
	  lcd_cmd(0xc7);
	    lcd_data(arr[f]);
	    lcd_cmd(0xc8);
		  lcd_data(arr[g]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw2==0)
		 {
    lcd_cmd(0xc6);
	  lcd_data(arr[e]);
	  lcd_cmd(0xc7);
	    lcd_data(arr[f]);
	    lcd_cmd(0xc8);
		  lcd_data(arr[g]);
if(sw1==1)
goto jump1;

if(sw2==1)
goto jump2;

if(sw3==1)
goto jump3;

if(sw4==1)
goto jump4;
}}

if(sw3==1)
  {
    jump3:
  while(sw3==1);
   

  m++;
  h=m/100;
  i=(m/10)%10;
  j=m%10;
		     lcd_cmd(0xcc);
	  lcd_data(arr[h]);
	  lcd_cmd(0xcd);
	    lcd_data(arr[i]);
	    lcd_cmd(0xce);
		  lcd_data(arr[j]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw3==0)
		 {
		     lcd_cmd(0xcc);
	  lcd_data(arr[h]);
	  lcd_cmd(0xcd);
	    lcd_data(arr[i]);
	    lcd_cmd(0xce);
		  lcd_data(arr[j]);
if(sw1==1)
goto jump1;

if(sw2==1)
goto jump2;

if(sw4==1)
goto jump4;

if(sw3==1)
goto jump3;}}
if(sw4==1)
{
jump4:
if(k>l&&k>m)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr4[a]);
  delay(32000);
  }
 }
if(l>k&&l>m)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr5[a]);
  delay(32000);
  }
 }
if(m>l&&m>k)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr6[a]);
  delay(32000);
  }
 }
  delay(32000);
 goto jump;	}					   }}
#include<reg51.h>
sbit sw1=P1^2;
sbit sw2=P1^3;
sbit sw3=P1^4;
sbit sw4=P1^5;
sbit rs=P1^0;
sbit e=P1^1	;
sbit buz=P3^7;
	
char arr[10]={"0123456789"};
					 

char arr2[16]={"Bjp.. Cong..NOTA"};
char arr3[15]={"voting machine "};
char arr4[16]="winner is BJP...";
char arr5[16]="winner is CONG..";
char arr6[16]="winner is NOTA..";
void delay(int w)
{
int i;
for(i=0;i<w;i++);
}
void lcd_cmd(unsigned char x1)
{
P2=x1;
rs=0;
e=1;
delay(1000);
e=0;

}
void lcd_data(unsigned char x2)
{
P2=x2;
rs=1;
e=1;
delay(1000);
e=0;

}


void main()
{

char a,b,c,d,e,f,g,h,i,j,k,l,m;
k=l=m=buz=sw1=sw2=sw3=sw4=0;
lcd_cmd(0x38);
lcd_cmd(0x0c);
 jump:
 a=b=c=d=e=f=g=h=i=j=k=l=m=0;
 lcd_cmd(0x01);
  lcd_cmd(0x80);
  for(a=0;a<15;a++)
  {
  lcd_data(arr3[a]);
  delay(10000);
  }
 lcd_cmd(0x01);
  for(a=0;a<16;a++)
  {
  lcd_data(arr2[a]);
  delay(2000);
  }
  while(1)
 {
if(sw1==1)
  {
  jump1:
  while(sw1==1);
  
  
  k++;
  b=k/100;
  c=(k/10)%10;
  d=k%10;
    lcd_cmd(0xc0);
	  lcd_data(arr[b]);
	  lcd_cmd(0xc1);
	    lcd_data(arr[c]);
	    lcd_cmd(0xc2);
		  lcd_data(arr[d]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw1==0)
		 {
		     lcd_cmd(0xc0);
	  lcd_data(arr[b]);
	  lcd_cmd(0xc1);
	    lcd_data(arr[c]);
	    lcd_cmd(0xc2);
		  lcd_data(arr[d]);
if(sw1==1)
goto jump1;

if(sw4==1)
goto jump4;

if(sw2==1)
goto jump2;

if(sw3==1)
goto jump3;}}

if(sw2==1)
  {
   jump2:
  while(sw2==1);
  l++;
  e=l/100;
  f=(l/10)%10;
  g=l%10;
    lcd_cmd(0xc6);
	  lcd_data(arr[e]);
	  lcd_cmd(0xc7);
	    lcd_data(arr[f]);
	    lcd_cmd(0xc8);
		  lcd_data(arr[g]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw2==0)
		 {
    lcd_cmd(0xc6);
	  lcd_data(arr[e]);
	  lcd_cmd(0xc7);
	    lcd_data(arr[f]);
	    lcd_cmd(0xc8);
		  lcd_data(arr[g]);
if(sw1==1)
goto jump1;

if(sw2==1)
goto jump2;

if(sw3==1)
goto jump3;

if(sw4==1)
goto jump4;
}}

if(sw3==1)
  {
    jump3:
  while(sw3==1);
   

  m++;
  h=m/100;
  i=(m/10)%10;
  j=m%10;
		     lcd_cmd(0xcc);
	  lcd_data(arr[h]);
	  lcd_cmd(0xcd);
	    lcd_data(arr[i]);
	    lcd_cmd(0xce);
		  lcd_data(arr[j]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw3==0)
		 {
		     lcd_cmd(0xcc);
	  lcd_data(arr[h]);
	  lcd_cmd(0xcd);
	    lcd_data(arr[i]);
	    lcd_cmd(0xce);
		  lcd_data(arr[j]);
if(sw1==1)
goto jump1;

if(sw2==1)
goto jump2;

if(sw4==1)
goto jump4;

if(sw3==1)
goto jump3;}}
if(sw4==1)
{
jump4:
if(k>l&&k>m)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr4[a]);
  delay(32000);
  }
 }
if(l>k&&l>m)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr5[a]);
  delay(32000);
  }
 }
if(m>l&&m>k)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr6[a]);
  delay(32000);
  }
 }
  delay(32000);
 goto jump;	}					   }}
//Welcome to Kit4u Tech Blog //
#include<reg51.h>
sbit sw1=P1^0;
sbit sw2=P1^1;
sbit sw3=P1^2;
sbit sw4=P1^3;
sbit rs=P2^0;
sbit e=P1^1	;
sbit buz=P3^7;

char arr[10]={"0123456789"};
					 

char arr2[16]={"Bjp.. Cong..NOTA"};
char arr3[15]={"voting machine "};
char arr4[16]="winner is BJP...";
char arr5[16]="winner is CONG..";
char arr6[16]="winner is NOTA..";
void delay(int w)
{
int i;
for(i=0;i<w;i++);
}
void lcd_cmd(unsigned char x1)
{
P2=x1;
rs=0;
e=1;
delay(1000);
e=0;

}
void lcd_data(unsigned char x2)
{
P2=x2;
rs=1;
e=1;
delay(1000);
e=0;

}


void main()
{

char a,b,c,d,e,f,g,h,i,j,k,l,m;
k=l=m=buz=sw1=sw2=sw3=sw4=0;
lcd_cmd(0x38);
lcd_cmd(0x0c);
 jump:
 a=b=c=d=e=f=g=h=i=j=k=l=m=0;
 lcd_cmd(0x01);
  lcd_cmd(0x80);
  for(a=0;a<15;a++)
  {
  lcd_data(arr3[a]);
  delay(10000);
  }
 lcd_cmd(0x01);
  for(a=0;a<16;a++)
  {
  lcd_data(arr2[a]);
  delay(2000);
  }
  while(1)
 {
if(sw1==1)
  {
  jump1:
  while(sw1==1);
  
  
  k++;
  b=k/100;
  c=(k/10)%10;
  d=k%10;
    lcd_cmd(0xc0);
	  lcd_data(arr[b]);
	  lcd_cmd(0xc1);
	    lcd_data(arr[c]);
	    lcd_cmd(0xc2);
		  lcd_data(arr[d]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw1==0)
		 {
		     lcd_cmd(0xc0);
	  lcd_data(arr[b]);
	  lcd_cmd(0xc1);
	    lcd_data(arr[c]);
	    lcd_cmd(0xc2);
		  lcd_data(arr[d]);
if(sw1==1)
goto jump1;

if(sw4==1)
goto jump4;

if(sw2==1)
goto jump2;

if(sw3==1)
goto jump3;}}

if(sw2==1)
  {
   jump2:
  while(sw2==1);
  l++;
  e=l/100;
  f=(l/10)%10;
  g=l%10;
    lcd_cmd(0xc6);
	  lcd_data(arr[e]);
	  lcd_cmd(0xc7);
	    lcd_data(arr[f]);
	    lcd_cmd(0xc8);
		  lcd_data(arr[g]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw2==0)
		 {
    lcd_cmd(0xc6);
	  lcd_data(arr[e]);
	  lcd_cmd(0xc7);
	    lcd_data(arr[f]);
	    lcd_cmd(0xc8);
		  lcd_data(arr[g]);
if(sw1==1)
goto jump1;

if(sw2==1)
goto jump2;

if(sw3==1)
goto jump3;

if(sw4==1)
goto jump4;
}}

if(sw3==1)
  {
    jump3:
  while(sw3==1);
   

  m++;
  h=m/100;
  i=(m/10)%10;
  j=m%10;
		     lcd_cmd(0xcc);
	  lcd_data(arr[h]);
	  lcd_cmd(0xcd);
	    lcd_data(arr[i]);
	    lcd_cmd(0xce);
		  lcd_data(arr[j]);
		  buz=1;
		  delay(3200);
		  buz=0;
		  delay(3200);
		 while(sw3==0)
		 {
		     lcd_cmd(0xcc);
	  lcd_data(arr[h]);
	  lcd_cmd(0xcd);
	    lcd_data(arr[i]);
	    lcd_cmd(0xce);
		  lcd_data(arr[j]);
if(sw1==1)
goto jump1;

if(sw2==1)
goto jump2;

if(sw4==1)
goto jump4;

if(sw3==1)
goto jump3;}}
if(sw4==1)
{
jump4:
if(k>l&&k>m)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr4[a]);
  delay(32000);
  }
 }
if(l>k&&l>m)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr5[a]);
  delay(32000);
  }
 }
if(m>l&&m>k)
{
lcd_cmd(0x01);
lcd_cmd(0x80);
  for(a=0;a<16;a++)
  {
  lcd_data(arr6[a]);
  delay(32000);
  }
 }
  delay(32000);
 goto jump;	}					   }}

Output :-

Author: kits4ublog

Leave a Reply

Your email address will not be published.