0% found this document useful (0 votes)
31 views

Code of Voting Machine Using Avr

Code for everything

Uploaded by

Lone One
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Code of Voting Machine Using Avr

Code for everything

Uploaded by

Lone One
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//code of voting machine using avr ( MIKRO C PRO FOR AVR)

sbit switch1 at PINB.B0;


sbit switch2 at PINB.B1;
sbit switch3 at PINB.B2;
sbit switch4 at PINB.B3;
sbit LCD_RS at PORTA0_bit;
sbit LCD_EN at PORTA1_bit;
sbit LCD_D4 at PORTA2_bit;
sbit LCD_D5 at PORTA3_bit;
sbit LCD_D6 at PORTA4_bit;
sbit LCD_D7 at PORTA5_bit;

sbit LCD_RS_Direction at DDA0_bit;


sbit LCD_EN_Direction at DDA1_bit;
sbit LCD_D4_Direction at DDA2_bit;
sbit LCD_D5_Direction at DDA3_bit;
sbit LCD_D6_Direction at DDA4_bit;
sbit LCD_D7_Direction at DDA5_bit;

char a[]="0123456789";
void main()
{
int i=0;
int j=0;
int k=0;
lcd_init();
lcd_cmd(_lcd_cursor_off);

DDB0_bit=0;
DDB1_bit=0;
DDB2_bit=0;
DDB3_bit=0;
while(1)
{
lcd_out(1,3,"press key");
if(switch1==1)
{
i=i+1;
lcd_out(1,3,"thank you");
Delay_ms(500);
while(switch1==1);
Delay_ms(1000);
}
if(switch2==1)
{
j=j+1;
lcd_out(1,3,"thank you");
Delay_ms(500);
while(switch2==1);
Delay_ms(1000);
}
if(switch3==1)
{
k=k+1;
lcd_out(1,3,"thank you");
Delay_ms(500);
while(switch3==1);
Delay_ms(1000);
}
if(switch4==1)
{
if(i>j&&i>k)
{
while(1)
{
lcd_cmd(_lcd_clear);
lcd_out(1,2,"congrats AAP ");
Delay_ms(1000);
lcd_out(2,1,"votes to AAP=");
lcd_chr(2,14,a[(i/100)%10]);
lcd_chr(2,15,a[(i/10)%10]);
lcd_chr(2,16,a[i%10]);
Delay_ms(1000);
lcd_out(1,1,"votes to kkk=");
lcd_chr(1,14,a[(j/100)%10]);
lcd_chr(1,15,a[(j/10)%10]);
lcd_chr(1,16,a[j%10]);
Delay_ms(1000);
lcd_out(2,1,"votes to bjp=");
lcd_chr(2,14,a[(k/100)%10]);
lcd_chr(2,15,a[(k/10)%10]);
lcd_chr(2,16,a[k%10]);
Delay_ms(1000);
}
}
if(j>i&&j>k)
{
while(1)
{

lcd_cmd(_lcd_clear);
lcd_out(1,2,"congrats kkk");
Delay_ms(1000);
lcd_out(2,1,"votes to kkk=");
lcd_chr(2,14,a[(j/100)%10]);
lcd_chr(2,15,a[(j/10)%10]);
lcd_chr(2,16,a[j%10]);
Delay_ms(1000);
lcd_out(1,1,"votes to AAP=");
lcd_chr(1,14,a[(i/100)%10]);
lcd_chr(1,15,a[(i/10)%10]);
lcd_chr(1,16,a[i%10]);
Delay_ms(1000);
lcd_out(2,1,"votes to bjp=");
lcd_chr(2,14,a[(k/100)%10]);
lcd_chr(2,15,a[(k/10)%10]);
lcd_chr(2,16,a[k%10]);
Delay_ms(1000);
}
}
if(k>i&&k>j)
{
while(1)
{
lcd_cmd(_lcd_clear);
lcd_out(1,2,"congrats bjp");
Delay_ms(1000);
lcd_out(2,1,"votes to bjp=");
lcd_chr(2,14,a[(k/100)%10]);
lcd_chr(2,15,a[(k/10)%10]);
lcd_chr(2,16,a[k%10]);
Delay_ms(1000);
lcd_out(1,1,"votes to AAP=");
lcd_chr(1,14,a[(i/100)%10]);
lcd_chr(1,15,a[(i/10)%10]);
lcd_chr(1,16,a[i%10]);
Delay_ms(1000);
lcd_out(2,1,"votes to kkk=");
lcd_chr(2,14,a[(j/100)%10]);
lcd_chr(2,15,a[(j/10)%10]);
lcd_chr(2,16,a[j%10]);
Delay_ms(1000);
}
}
else
{
while(1)
{
lcd_out(2,1,"votes to bjp=");
lcd_chr(2,14,a[(k/100)%10]);
lcd_chr(2,15,a[(k/10)%10]);
lcd_chr(2,16,a[k%10]);
Delay_ms(1000);
lcd_out(1,1,"votes to AAP=");
lcd_chr(1,14,a[(i/100)%10]);
lcd_chr(1,15,a[(i/10)%10]);
lcd_chr(1,16,a[i%10]);
Delay_ms(1000);
lcd_out(2,1,"votes to kkk=");
lcd_chr(2,14,a[(j/100)%10]);
lcd_chr(2,15,a[(j/10)%10]);
lcd_chr(2,16,a[j%10]);
Delay_ms(1000);
}
}
}
}
}

You might also like