Microcontroller Based Electronic Voting Machine: Enter Password 0
Microcontroller Based Electronic Voting Machine: Enter Password 0
EM TESTED EM TESTED
EM TES
TED
MUDIT AGARWAL
Enter Password 0
Working of EVM is very straight forward During initialization it initialize LCD to work in 8 bit mode. The ask user for password , it continuously check port pin 15,16 and 17 to revertive the password after getting four digit it check the password with its value if it is correct then it proceed to next step other wise it ask for password again with a buzzer sound. If password was correct it ask you to change the password? If you want then it will change it otherwise you can proceed to voting mode. In voting mode there are five contender shown on 16X2 LCD display. For voting them you need to enter the appropriate code to vote them further you can see the total vote for each contender as well as vote reset option with the same password. Data stored is in flash memory since PIC microcontroller has the ability to write its own flash program memory.
LCD
LCDs can add a lot to your application in terms of providing a useful interface for the user, debugging an application, or just giving it a professional look. The most common type of LCD controller is the Hitachi 44780, which provides a relatively simple interface between a processor and an LCD. LCDs can be added quite easily to an application and use as few as two digital output pins for control. The most common connector used for the 44780-
based LCDs is 14 pins in a row, with pin centers 2.5mm apart. The interface is a parallel bus, allowing simple and fast reading/writing of data to and from the LCD. The ASCII code to be displayed is eight bits long and is sent to the LCD either four or eight bits at a time. If four-bit mode is used, two nibbles of data are sent to make up a full eight-bit transfer. The Enable clock is used to initiate the data transfer within the LCD. Sending parallel data as either four or eight bits are the two primary modes of operation. Although there are secondary considerations and modes, deciding how to send the data to the LCD is the most crucial decision to be made for an LCD interface application. Eight-bit mode is best used when speed is required in an application. To wire a microcontroller to an LCD in four-bit mode, just the top four bits (DB4-7) are written to. The RS bit is used to select whether data or an instruction is being transferred between the microcontroller and the LCD. If the bit is set, then the byte at the current LCD cursor position can be read or written. When the bit is reset, either an instruction is being sent to the LCD or the execution status of the last instruction is read back. The bit descriptions for the different commands are: Reading data back is best used in applications that require data to be moved back and forth on the LCD. The busy flag can be polled to determine when the last instruction that has been sent has completed processing. For most applications, there really is no reason to read from the LCD. Usually tie R/W to ground and just wait the maximum amount of time for each instruction.
Microcontrller
PIC microcontrollers are unique in many ways. Several general characteristics of the PIC are Harvard architecture, RISC processor design, single-word instructions, machine and data memory configuration. The working can be well understand by the flow chart of the electronics
CONSTRUCTION
Step3
Start
Initialization Process (I/O port setting Option Register setting LCD Initiallization Time out Flag setting
Pressed Digit3 No
No
No
Yes
Yes
Yes
Yes Step2
voting machine provided here. Circuit Diagram of microcontroller based electronic voting machine is shown in fig.1. PCB layout of microcontroller based electronic voting machine is shown in fig.2. Component Layout of microcontroller based electronic voting machine is shown in fig.3. #include<pic.h> #define bitset(var,bitno) ((var) |=(1 << (bitno))) #define bitclr(var,bitno) ((var) &=~(1 << (bitno)))
Step2
void Electronicvotingmacine22(unsigned int h ); void Electronicvotingmacine24(void); void Electronicvotingmacine23(void); void Electronicvotingmacine1(unsigned int); void Electronicvotingmacine2(unsigned char *); void Electronicvotingmacine21(void); void Electronicvotingmacine7(unsigned short); void Electronicvotingmacine3(unsigned long); void Electronicvotingmacine4(unsigned short); void Electronicvotingmacine5(unsigned short); void Electronicvotingmacine6(unsigned short); unsigned char Electronicvotingmacine9(void); unsigned char Electronicvotingmacine8(unsigned
Step4
No
Yes
Step3 No
Change Password
Yes
Count=8 No
Vote To Contender2
No
No
Yes Count=7
Yes
Yes
Vote To Contender4
No
Count=9 No
Yes
No
No
Vote To Contender3
Yes
Yes
Vote To Contender5
Step 3
CONSTRUCTION
15 VA VC 16 LCD
D7 D6 D5 D4 D3 D2 D1 D0 14 13 12 11 14 13 12 11
En R/W RS 6 5 4
VLC 3
VCC 2
VSS 1
Pr1
C6
11
40 39 38 37 36 35 34 33 29 28 27
32
R1 1
RST C4
13 X1
Ic2
14 C5 12
31
15
Ic1 7805 Ic2 PIC16f877A R1-R4 10K Pr1 2k C1 1000uf/25v C2,C3,C6 0.1uf C4,C5 22pf X1 4MHZ Rst, S1, S2, S3 Push To On Switch LCD 16X2 Liquid Crystal Display
16
17
R2
R3
R4
S1
S2
S3
D2
230V A.C.
D1 C1
1 C2
D3
D4
CONSTRUCTION
J2 J1 J3
J4
J5
PR1 LCD C6
J6 J7J8 R7
char); void Electronicvotingmacine10(void); void Electronicvotingmacine11(void); unsigned int Electronicvotingmacine12(unsigned char, unsigned char); void Electronicvotingmacine13(void); Void Electronicvotingmacine14(void); void Electronicvotingmacine15(void); void Electronicvotingmacine16(void); void Electronicvotingmacine17(void);
Step5
Void Electronicvotingmacine18(void); void Electronicvotingmacine19(void); void Electronicvotingmacine20(void); void main() { unsignedchar I, vote, a1, a2, a3, a4, a5, a6, a7, a8,a9, a10, a11, a12, a13, a14, a15, a16; unsigned char Electronicvotingmacine131, Electronicvotingmacine132, Electronicvotingmacine141, Electronicvotingmacine142, Electronicvotingmacine151, Electronicvotingmacine152, Electronicvotingmacine161, Electronicvotingmacine162, Electronicvotingmacine171, Electronicvotingmacine 172;
Step6
No
No
Yes
Yes
Yes
Yes
Step6
Goto Step3