Now a days Electronic Voting Machine is used for elections. So make your own EVM from here.
Introduction :-
In this project we use ATmega16 controller and a 16x2 alphanumeric LCD and Toggle switches. Program is loaded in the ATmega16 and the voting machine is ready to use.
Lcd Interfacing :-
see.. LCD INTERFACING WITH ATmega16 IN 4-BIT MODE
ATmega16 :-
Introduction :-
In this project we use ATmega16 controller and a 16x2 alphanumeric LCD and Toggle switches. Program is loaded in the ATmega16 and the voting machine is ready to use.
Lcd Interfacing :-
see.. LCD INTERFACING WITH ATmega16 IN 4-BIT MODE
ATmega16 :-
Components required :-
- 10k ohm registance
- 10k ohm variable registance
- 8 MHZ crystal oscilltor
- 16x2 LCD
- ATmega16 IC
- 12v battery
- Toggle button -5
- 7805 IC
- 330 ohm resistance
- 1N4007 diode
- 1000uf capacitor
- Green LED
Circuit Diagram :-
3 buttons are for votes and 4th button is for result. |
Code (compiled in CVAVR) :-
(see.. CVAVR TUTORIAL (CODE VISION AVR))
Note :- In CVAVR program window delete all the lines and paste the code given below. because there are so much unnecessary lines.
-----------------------------------------------------------------------------------------------------------------------
#include <mega16.h>
#include <delay.h>
#include <stdlib.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
#include <lcd.h>
// Declaration of global variables
int i,j,k;
char a[10], b[10], c[10];
void main(void)
{
// Port A initialization
PORTA=0x00;
DDRA=0x00;
// Port C initialization
PORTC=0x00;
DDRC=0x00;
i=j=k=0;
// LCD module initialization
lcd_init(16);
while (1)
{
//your code
lcd_gotoxy(0,0);
lcd_putsf("ENTER YOUR VOTE");
lcd_gotoxy(0,1);
lcd_putsf("1>BJP 2>JP 3>BSP");
if(PINA.0==1)
{
i=i+1;
delay_ms(100);
lcd_clear();
lcd_putsf("vote accepted");
delay_ms(100);
lcd_clear();
lcd_gotoxy(0,0);
}
if(PINA.1==1)
{
j=j+1;
lcd_clear();
delay_ms(100);
lcd_putsf("vote accepted");
delay_ms(100);
lcd_clear();
lcd_gotoxy(0,0);
}
if(PINA.2==1)
{
k=k+1;
lcd_clear();
delay_ms(100);
lcd_putsf("vote accepted");
delay_ms(100);
lcd_clear();
lcd_gotoxy(0,0);
}
if(PINA.3==1)
{
if(i>j)
{
if(i>k)
{
lcd_clear();
itoa(i,a);
lcd_putsf("winner is BJP=");
lcd_puts(a);
delay_ms(500);
}
}
else if(j>k)
{
lcd_clear();
itoa(j,b);
lcd_putsf("winner is JP=");
lcd_puts(b);
delay_ms(500);
}
else
{
lcd_clear();
itoa(k,c);
lcd_putsf("winner is BSP=");
lcd_puts(c);
delay_ms(500);
}
}
}
}
-----------------------------------------------------------------------------------------------------------------------