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);
}
}
}
}
-----------------------------------------------------------------------------------------------------------------------
19 comments:
sir,
u have included one lcd header file but there no availability of the header u included in it. so post the lcd.h file.
sir,
u have included one lcd header file but there no availability of the header u included in it. so post the lcd.h file.
Here is no need of lcd.h
... This code is compiled in cvavr ...
Download cvavr nd see cvavr tutorial in the blog
LCD IS SHOWING NOTHING
Try reducing the contrast of lcd
This program keep accepting multiple votes even for a single press. Kindly reply as soon as possible how to resolve it. Thank You
U cn use while(1) or break conditions in each loop.
Sir! i couldn't get the hex file of the code.. kindly help me to fix it !!!
Can you please tell me the error in detail
Very nice project can you give me its working in theory ??
daniyalsyed10@gmail.com
Thank you i want to make it..
full working theory is already given... please read full post carefully... you will understand very easily.. !!
Sir,
Can I know where did you get Atmega16.h library?
sir which switch have you used in proteus.. the exact name? will spst push button do the same thing?
This is a very great article.thanks for sharing.
Is simple push button can work for this
Thank u so much for the project. Bt no. Of votes is not showing in the coding. So how it can b done?
Yes simple push button will work.
I am not storing votes in code. They will be direcrly printed on lcd. If you want to store you can modify the code accordingly.
Post a Comment