Top Banner
 Electronic Voting Machine BJP=5 CONGRESS=6 BSP=7 NDA=8 JD=9 UP Reset Switch Buzzer EN T DW  N 12V AC Input from Transformer 
40

Micrcontroller Based Electronic Voting Machine

Apr 06, 2018

Download

Documents

gayush20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 1/39

 

Electronic Voting Machine

BJP=5

CONGRESS=6BSP=7 NDA=8

JD=9

UP

Reset Switch Buzzer EN

T

DW N

12V AC Inputfrom Transformer 

Page 2: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 2/39

 

Microcontroller Based Electronic Voting

Machine

Description

Microcontroller Based Electronic Voting Machine is design for five contenders. To prevent unauthorised

ccess of this machine a system password is provided Without entering te password the machine willnot start. Further you can chage the password as per your desire the lenght of password if 4 digit.

Enter 

Password0

Let Password is 1234, press up button and release display shows

Enter 

Password1

Press Entre button display shows(You have entered first digit of password) and display shows seconddigit as 0

Enter 

Password10

 press up button and release two times display shows

Enter 

Password12

Press Entre button display shows(You have entered seconf digit of password) and display shows thirddigit as 0

Enter 

Password120

Page 3: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 3/39

 

 press up button and release display shows until display shows

Enter 

Password123

Press Entre button display shows(You have entered third digit of password) and display shows fourth

digit as 0

Enter Password1230

 press up button and release until display shows

Enter 

Password1234

Press Entre button display shows if password is correct LCD shows with a pass buzzer sound

Password

CorrectProceed

If password is wrong LCD shows with a fail buzzer sound

PasswordFails

If password is wrong LCD shows

Enter 

Password

Page 4: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 4/39

 

If passwod is correct LCD shows

Do you want to Change Password

Followed by

Press UP for Yes

ENTER/DWN for NO

IF UP button is pressed

 New

Password0

Feed 4 digit password one by one with the help of UP and ENTER button

Enter code for voting

BJP=05

CONGRESS=06BSP=07 NDA=08

JP=09Press UP button to vote the desired candidate or press ENTER button to see the total votes let us pressEnter button

Reading VotesBJP

XXXXXPress ENTER button to see next total for CONGRESS

Reading VotesCONGRESS

XXXXXPress ENTER button to see next total for BSP

Page 5: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 5/39

 

Press ENTER button to see next total for BSP

Reading Votes

BSP

XXXXXPress ENTER button to see next total for NDA

Reading Votes NDA

XXXXXPress ENTER button to see next total for JP

Reading Votes

JP

XXXXX

Want to EraseData

Press UP for 

YesENTER/DWN for  NO

Press UP button to erase votes store

Enter 

Password0

Use UP and Enter button to feed the password

Enter Password0

If feeded password is correct the all votes will erased otherwise data remains preserved

Page 6: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 6/39

 

Working of EVM is very straight forward During initiallization it initiallize LCD to work in 8 bit mode.The ask user for password , it continously check port pin 15,16 and 17 to reterive 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 16X2LCD display. For voting them you nedd to enter the appropriate code to vote them further you cansee the total vote for each contender as well as vote reset option with the same passwod. Data

stored is in flash memeory since PIC microcontroller has the ability to write its owm flash programmemeory. Evet\ry thing is in code.

LCDSet c u r s o r move d i r e c t i o n :

LCDs can add a lot to your application in terms of ID I n c r e m e n t t h e c u r s o r a f t e

r  providing a useful interface for the user, each b y t e w r i t t e n t o d i s p l a y i f sdebugging an application, or just giving it a professional

e tlook. The most common type of  S S h i f t d i s p l a y when b y t e w r i t

tLCD controller is the Hitachi 44780, which provides ae n t o d i s p l a y

relatively simple interface betweenEnable d i s p l a y l c u r s o r 

a processor and an LCD. Using this interface is often notD Turn d i s p l a y o n ( l ) / o f f 

( O )attempted by new designers and

C Turn c u r s o r o n ( l ) I o f f 

( O ) programmers because it is difficult to find good

B C u r s o r b l i n k o n ( l ) / o f f ( O )documentation on the interface, initializing Move c u r s o r l s h i f t d i s p l a y

the interface can be a problem, and the displaysSC D i s p l a y s h i f t o n ( l ) / o f f 

( O )themselves are expensive.

RL D i r e c t i o n o f s h i f t r i g h t ( l ) l

lI have worked with Hitachi 44780-based LCDs for a while

e f t ( O )now and I don't believe any

Set i n t e r f a c e l e n g t hof these perceptions. LCDs can be added quite easily to DL Set d a t a i n t e r f a c e l e n g t h 8

(an application and use as few as 1 ) / 4 ( 0 )two digital output pins for control. As for cost, LCDs can be

 N Number o f d i s p l a y l i n e s 1

( 0 ) /often pulled out of old devices or found in surplus stores

2 ( 1 )for less than a dollar.

F C h a r a c t e r f o n t 5 x 1 0 ( 1 ) / 5

~The purpose of this section is to give a brief tutorial on how

7 ( 0 )to interface with Hitachi P o l l t h e busy f l a g

Table BF T h i s b i t i s s e t w h i l e t h e LCD

is p r o c e s s i n g

1 Ground Move c u r s o r t o CGRAMldisplayA Address

2 Vcc R e a d l w r i t e ASCII t o t h e d i s p l

ay

3 Contrast H Data

4 Rs5 RW 44780-based LCDs. I have tried to provide all of the data

6 En necessary for successfullyadding LCDs to your application. In the book, I use Hitachi

7-14 D0-D14 44780-based LCDs for a number of different projects. The most common connector used for 

15 VA the 44780-based LCDs is 14 pins in a row, with pin centers0.100" apart. The pins are wired as in Table.

16 VK  As you would probably guess from this description, theinterface is a parallel bus, allowing simple and fast

Page 7: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 7/39

 

1 5

LC DVA

D 4 D 2 D 1 D 0 R/ W E n V C C V SSR S VLCVC D 7 D 6 D 5 D 3

1 4 1 2 11 6 5 4 3 2 1 1 4 1 2 1 116 13 13

. 1 uf 2k 

11

40 39 3 8 3 5 3 7 3 6 3 3 3 4 28 29 2 7

32

2.2k 

1

RST22pf 

13

PIC16f8777A

14

1222pf 

31

15 16 17

2.2k 2.2k 2.2k 

UP ENT DWN

TXFR1

7805D2 D131 2

230 V 1N4 007 X4A. C.

.1uf .1uf D3 D4

TXFR2

 Fig. 3 : Circuit diagram of Microcontroller Based Electronic Voting Machine

Page 8: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 8/39

 

an LCD in four-bit mode, just the top four bits (DB4-7) are1. Wait more t h a n 15 ms a f t e r power 

written to. The RJS bit is used to select whether data or ani s a p p l i e d . instruction is being transferred between the microcontroller 2. W r i t e 0x030 t o LCD and w a i t

5and the LCD. If the bit is set, then the byte at the current

ms f o r t h e i n s t r u c t i o n t o c o m

 pLCD cursor position can be read or written. When the bit is

l e t e . reset, either an instruction is being sent to the LCD or 3 . W r i t e 0x030 t o LCD and w a i t

160the execution status of the last instruction is read back 

usecs f o r i n s t r u c t i o n t o c o m p l(whether or not it has completed).

e t e . The bit descriptions for the different commands are:

4. W r i t e 0x030 A G A I N t o LCDand

Reading data back is best used in applications that requirew a i t 160 usecs o r P o l l t h e Busy F

ldata to be moved back and forth

a g . on the LCD (such as in applications that scroll data5 . Set t h e O p e r a t i n g C h a r a c t

e between lines). The busy flag can be

r i s t i c s o f t h e

LCD. polled to determine when the last instruction that has been

- W r i t e "Set I n t e r f a c e

Length"sent has completed processing.

- W r i t e 0x010 t o p r e v e n t s h i f t i n For most applications, there really is no reason to readg a f t e r c h a r a c t e r w r i t

e .from the LCD. I usually tie RIW

- W r i t e 0x001 t o C l e a r t h e D i s p

lto ground and just wait the maximum amount of time for 

a y each instruction (4.1 ms for clearing- W r i t e "Set C u r s o r Move D i r e c t

ithe display or moving the cursor/display to the home

o n " S e t t i n g C u r s o r B e h a v i or 

 position, 160 ps for all other B i t s commands). As well as making my application software- W r i t e "Enable D i s p l a y l C u r s o

r simpler, it also frees up a microcontroller 

" & e n a b l e D i s p l a y and O p t i on

 pin for other uses. Different LCDs execute instructions ata l C u r s o r  different rates and to avoid problems later on (such as if 

the LCD is changed to a slower unit), I recommend justusing the maximum delays listed here.reading/writing of data to and from the LCD. Write anIn terms of options, I have never seen a 5x10 pixelASCII byte out to the LCD's screen. The ASCII code to becharacter LCD display. This means

displayed is eight bits long and is sent to the LCD either that the F bit in the set interface instruction should always

four or eight bits at a time. If four-bit mode is used, two be reset (equal to 0).

nybbles of data (sent high four bits and then low four bitsBefore you can send commands or data to the LCDwith an E clock pulse with each nybble) are sent to makemodule, the module must be initialized.up a full eight-bit transfer. The E clock is used to initiate theFor eight-bit mode, this is done using the following seriesdata transfer within the LCD. Sending parallel data asof operations

either four or eight bits are the two primary modes of operation. Although there are secondary considerations

Microcontrllerand modes, deciding how to send the data to the LCD isthe most crucial decision to be made for an LCD interface Generally PIC architecture increases in complexity andapplication. Eight-bit mode is best used when speed is  power, so does the size, intricacy, and cost of the devices.required in an application and 10 110 pins are available. For many purposes an 80-pin PIC with 64Kbytes of Four-bit mode requires six bits. To wire a microcontroller to  program memory, 1K EERPOM, 70 I/O ports, 16

A/D

Data AddressProgram Address

Program

DataMemory PIC

Space CPU Memory

Data BusInstruction Bus

Page 9: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 9/39

 

channels, is more complex than necessary. In fact, some are required. This situation is often referred to as the vonhigh-end PICs appear to be closer to microprocessors than Neumann bottleneck andto microcontrollers. Furthermore, the programming machines that suffer from it are said to be memory

complexity of these high-end PICs is also much greater bound.complex, machine.than their mid-range counterparts because their instruction Several generations of microcontrollers, including theset has double the number of instructions and the Microchip PICs, have beenassembly language itself is more difficult to learn and based on the Harvard architecture. These processors havefollow. Finally, the circuits in which we typically find the separate storage for programhigh-end devices are more advanced and elaborate and and data and a reduced instruction set. The midrange

their design requires greater engineering skills. For these PICs, in particular, have 8-bit data words but either 12-, 14-reasons, and for the natural space limitations of a single , or 16-bit program instructions. Since the instructionvolume, we do not discuss the high-performance family or size is much wider than the data size, an instruction can8-bit PICs nor any of the 16-bit products. It can be argued contain a full-size datathat the baseline PICs do find extensive use and are quite Constant. practical for many applications. Although this is true, the RISC CPU

Design baseline PICs are quite similar in architecture and The CISC (Complete Instruction Set Computer) design is programming to their mid-range relatives. In most cases based on each low-level instruction performing severalthe difference between a baseline and mid-range device is operations. For example, one Intel 80x86 opcode canthat the low-end one lacks some features or has less decrement a counter register, determine the state of a program space or storage. So someone familiar with the processor flag, and execute amid-range devices can easily port their knowledge to any jump instruction if the flag is set or cleared. Another CISC

of the simpler baseline Products. Our conclusion has been instruction moves a number to limit the coverage to the mid-range family of PICs. of bytes of data contained in a counter register from an

Within this family we have concentrated our attention on area pointed at by a source register,the two most used, documented, and popular PICs: the into another area pointed at by a destination register. Any16F84 (also 16F84A) and the 16F877A. The F84 sets the popular Intel CISC CPU contains about 120 primitivelower limit of complexity and sophistications and the F877 operations in its instruction set. The original design idea of 

the higher limit. the CISC architecture was to provide high-levelinstructions in order to facilitate the implementation of high-

Processor Architecture and Design level languages. Supposedly, this would be achievedPIC microcontrollers are unique in many ways.We start by through complex instruction sets, multiple addressingmentioning several general modes, and primitive operations that performed multiplecharacteristics of the PIC: Harvard architecture, RISC functions. However, some argued that the CISC

 processor design, single-word instructions, machine and architecture did not result in better performance.data memory configuration, and characteristic instruction Furthermore, the more complex the instruction set resultedFormats. in greater decoding time. At the same time, implementing

large instruction sets required more silicon space andHarvard Architecture considerably more design effort. Some CISC processors

The PIC microcontrollers do not use the conventional von developed in the 1960s and 70s are the IBM System/360, Neumann architecture but the PDP-11, the Motorola 68000a different hardware design often referred to as Harvard family, and Intel 80x86 CPUs. In contrast, a RISCarchitecture. Originally, Harvard (Reduced Instruction Set Computer) machine containsarchitecture referred to a computer design in which data fewer instructions and each instruction performs moreand instruction used different signal paths and storage elementary operations. Consequences of this are a smaller 

areas. In other words, data and instructions are not silicon area, faster execution, and reduced program sizelocated in the same memory area but in separate ones. with fewer accesses to main memory. The PIC designersOne consequence of the traditional von Neumann have followed the RISC route. Other CPUs with

RISCarchitecture is that the processor can either read or write design are the MIPS, the IBM Power PC, and the

DECinstructions or data but cannot do both at the same time, Alpha.since both instructions and data use the same signal lines. Single-word Instructions

In a machine with a Harvard architecture, on the other One of the consequences of the PIC’s Harvardhand, the architecture is that the instructions can processor can read and write instructions and data to and be wider than the 8-bit data size. Since the device hasfrom memory at the same separate buses for instructionstime. This results in a faster, albeit more The most recent and data, it is possible for instructions to be sizedarguments in favor of the Harvard architecture are based differently than data items. Being able to vary the number 

on the of bits in each instruction opcode makes possible theaccess speed to main memory. Making a CPU faster while optimization of program memory and the use of single-memory accesses remain word instructions that can be fetched in one bus cycle. Inat the same speed represents little total gain, especially if the mid-range PICs each instruction is 14-bits wide andmany memory accesses every fetch operation brings into the execution unit one

Page 10: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 10/39

 

complete operation code. Since each instruction takes up Mid-range PICs support up to eight different oscillator one 14-bit word, the number of words of program memory modes. For example, inin a device exactly equals the number of program the 16F877, any of the eight modes can be used, while ininstructions that can be stored. In a von Neumann the 16F84 only four oscillator  machine, instruction storage and fetching becomes a much modes are available. The oscillator mode is selected atmore complicated issue. Since von Neumann instructions device programming time

can span multiple bytes, there is no assurance that each and cannot be changed at runtime. The configuration bits, program memory location contains the first opcode of a which are non-volatilemulti-byte instruction. As in conventional processors, the flags set during device programming, determine whichPIC architecture has a two-stage instruction pipeline; oscillator mode is used byhowever, since the fetch of the current instruction and the the program, among the following:

1. LP Low Frequency Crystalexecution of the previous one can overlap in time, onecomplete instruction is fetched and executed at every 2. XT Crystal Resonator  machine cycle. This is known as instruction pipelining. 3. HS High Speed Crystal Resonator Since each instruction is 14-bits wide and the program 4. RC External Resistor/Capacitor memory bus is also 14-bits wide, each instruction contains 5. EXTRC External Resistor/Capacitor all the necessary information, so it can be executed 6. EXTRC External Resistor/Capacitor with

CLKOUT7. INTRC Internal 4 MHz Resistor/Capacitor without anyadditional fetching. The one exception is when an 8. INTRC Internal 4 MHz Resistor/Capacitor with

CLKOUTinstruction modifies the contents of the Program Counter. The resistor/capacitor oscillator option is the leastIn this case, a new instruction must be fetched, requiring expensive to implement, butan also the least accurate one. This option is used only inadditional machine cycle. The PIC clocking system is systems where clock accuracy

and consistency are not issues. The low-power frequencydesigned so that an instruction is fetched, decoded, andexecuted every four clock cycles. In this manner, a PIC crystal option is the one with lowest power consumptionequipped with a 4MHz oscillator clock beats at a rate of and can be used in systems where the power consumption0.25 µs. Since each instruction executes at every four element is important. The first three oscillator modes (LP,clock cycles, each instruction takes 1 µs.. XT, and HS) allow selecting different frequency ranges.Oscillator The HS option has the highest frequency range and

consumes the most power. The XT option is based on aMid-range PICs require an external device to produce theclock cycles required for its standard crystal resonator and has a mid-range power  operation. The PIC executes an instruction every four consumption. The LP option has low gain and consumesclock cycles, so the oscillator the least power of the three crystal modes. The generalspeed determines the device performance. rule is to use the oscillator with the lowest possible gain

that still meets the circuit require ments. The RC mode with

EXTRC and CLKOUT features has the same functionalityas the straight RC oscillator Option. The XT option (crystalresonator) can be purchased in a ceramic package. This

device, called a ceramic resonator, contains three pins.The ones on the extremes are connected to thecorresponding oscillator input lines on the PIC, labeled

OSC1 and

OSC2.The reset mechanism places the PIC in a known condition.The reset mechanism isused to gain control of a runaway or hung-up program, asa forced interrupt in programexecution, or to make the device ready at program load

time. The processor’s !MCLR  pin produces the reset action when it reads logic zero. Theexclamation sign preceding

Page 11: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 11/39

 

the pin’s name (or a line over it) indicates that the action isactive-low. To prevent accidentalresets the !MCLR pin must be connected to the positive

voltage supply througha 5K or 10K resistor. When a resistor serves to place alogic one on a line it is called a pull-up resistor.The mid-range PICs are capable of several reset actions:1. Reset during power on (POR).

2. !MCLR reset during normal operation.3. Reset during SLEEP

mode.4. Watchdog timer reset (WDT).5. Brown-out reset (BOR).6. Parity error reset.The first two reset sources in the preceding list are the

most common. POR resetserves to bring all PIC registers to an initial state, includingthe program counter register. The second source of reset action takes placewhen the !MCLR line is intentionally brought down, usually by the action of a push-button reset switch. This

switch is useful during program development since it provides a way of forcefully

restarting execution. Figure shows a typical wiring of the!MCLR line to providea reset action The second one is a product of purposefully bringing-in a logical zero to the

MCLR pin during normal operation of the microcontroller.This second one is oftenused in program development.User RAM memory is not affected by a reset. The GPRs(general purpose register)are in an unknown state during power-up and are not

changed by reset. SFR registers,on the other hand, are reset to an initial state. Theinitialization conditions for each of the SFRs are found in the device data sheet. Themost important of these is

the program count (PC) which is reset to zero. This actiondirects execution to thefirst instruction and effectively restarts the program.During power-up the processor itself initiates a reset andthe power supply voltageincreases from 1.2 to 1.8V. Several bits in various registers

are related to the resetaction, but these are not available in all mid-range devices.For example, somehigh-end devices in the mid-range group, such as the16F87x, contain two reset-related bits in the PCON register. One of them (named

!POR) determines the power-on reset status...

Page 12: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 12/39

 

Start

Initialization Process

(I/O port settingPressed Digit3Option Register setting

LCD Initiallization  NoTime out Flag setting

Yes

Display LCDEnter Password

Pressed Digit4

 No

Pressed Digit1

Yes No

Yes Read Stored Password

Pressed Digit2

 No

PasswordMatched

 NoYes

Yes

Step2

Page 13: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 13/39

 

Step2

Step3 Change Password

 No

Yes

Pressed New Pressed NewPasswoword Passwoword

Digit1 Digit3 No No

Yes Yes

Pressed New Pressed New

Passwoword PasswowordDigit2 Digit4 No No

Yes Yes

Page 14: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 14/39

 

Step3

Display ElectionParty Names

Want to SeeWant to Vote?

Total Vote?Press UP

Press ENT/UP No No

Yes Yes

Step4 Step5

Page 15: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 15/39

 

Step5

Display Total Votes Display Total Votes

of Contender1 of Contender3

IS Dwn IS DwnButton Pressed Button Pressed

 No No

Yes Yes

Display Total Votes Display Total Votesof Contender2 of Contender4

IS Dwn IS DwnButton Pressed Button Pressed

 No No

Yes Yes

Step6

Page 16: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 16/39

 

Step6

Want to erase Votes

IS Dwn IS Dwn

Button Pressed Button Pressed No No

Yes Yes

Goto Step3 Earse &Goto Step3

Page 17: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 17/39

 

Step4

Count=5 No

IS DwnUP Button

 No

Yes

Count=6Yes Vote To Contender1 No

Increment CountYes

Vote To Contender2

Count=8 No

Yes

Count=7 NoVote To Contender4

Count=9 Yes No

Vote To Contender3

Yes

Step 3Vote To Contender5

Page 18: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 18/39

 

Page 19: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 19/39

 

#include<pic.h> Electronicvotingmacine1(0x01);#define bitset(var,bitno) ((var) |=(1 << (bitno))) Electronicvotingmacine4(0x45);#define bitclr(var,bitno) ((var) &=~(1 << (bitno))) Electronicvotingmacine4(0x4e);

void Electronicvotingmacine22(unsigned int h ); Electronicvotingmacine4(0x54);void Electronicvotingmacine24(void); Electronicvotingmacine4(0x45);void Electronicvotingmacine23(void); Electronicvotingmacine4(0x52);void Electronicvotingmacine1(unsigned int); Electronicvotingmacine4(0xA0);void Electronicvotingmacine2(unsigned char *); rd1=EEPROM_READ(0)

;void Electronicvotingmacine21(void); Electronicvotingmacine22(100);

void Electronicvotingmacine7(unsigned short); rd2=EEPROM_READ(1);void Electronicvotingmacine3(unsigned long); Electronicvotingmacine22(100);

void Electronicvotingmacine4(unsigned short); rd3=EEPROM_READ(2)

;void Electronicvotingmacine5(unsigned short); Electronicvotingmacine22(100);void Electronicvotingmacine6(unsigned short); rd4=EEPROM_READ(3)

;Electronicvotingmacine22(100);

unsigned char Electronicvotingmacine9(void); rd1=rd1%10;unsigned char Electronicvotingmacine8(unsigned char); rd2=rd2%10;void Electronicvotingmacine10(void); rd3=rd3%10;void Electronicvotingmacine11(void); rd4=rd4%10;unsigned int Electronicvotingmacine12(unsigned char, Electronicvotingmacine4(0x50);unsigned char); Electronicvotingmacine4(0x41);

void Electronicvotingmacine13(void); Electronicvotingmacine4(0x53);void Electronicvotingmacine14(void); Electronicvotingmacine4(0x53);

void Electronicvotingmacine15(void); Electronicvotingmacine4(0x57);void Electronicvotingmacine16(void); Electronicvotingmacine4(0x4F);void Electronicvotingmacine17(void); Electronicvotingmacine4(0x52);void Electronicvotingmacine18(void); Electronicvotingmacine4(0x44);

void Electronicvotingmacine19(void); kl1=Electronicvotingmacine8(0);void Electronicvotingmacine20(void); kl2=Electronicvotingmacine8(1);

kl3=Electronicvotingmacine8(2);void main() kl4=Electronicvotingmacine8(3);{ if(kl1==rd1)unsigned char {

i,vote,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a1 Electronicvotingmacine1(0x01);5,a16; Electronicvotingmacine4(0x50);unsigned char Electronicvotingmacine4(0x41);Electronicvotingmacine131,Electronicvotingmacine132,Ele Electronicvotingmacine4(0x53);ctronicvotingmacine141,Electronicvotingmacine142,Electro Electronicvotingmacine4(0x53);

nicvotingmacine151,Electronicvotingmacine152,Electronic Electronicvotingmacine4(0x57);votingmacine161,Electronicvotingmacine162,Electronicvoti Electronicvotingmacine4(0x4F);ngmacine171,Electronicvotingmacine172; Electronicvotingmacine4(0x52);unsigned char Electronicvotingmacine4(0x44);oldpassword,kl1,kl2,kl3,kl4,rd1,rd2,rd3,rd4,highcount,lowc Electronicvotingmacine4(0xa0);ount; Electronicvotingmacine4(0x43);

unsigned int finalcount; Electronicvotingmacine4(0x4F);ADCON1=0x86; Electronicvotingmacine4(0x52);INTCON=0

;

Electronicvotingmacine4(0x52);TRISB=0x00; Electronicvotingmacine4(0x45);TRISC=0x07; Electronicvotingmacine4(0x43);TRISD=0x00; Electronicvotingmacine4(0x54);

RD4=0; Electronicvotingmacine1(0XC0);RD5=0; Electronicvotingmacine4(0x50);RD6=0; Electronicvotingmacine4(0x52);RD7=0; Electronicvotingmacine4(0x4F);Electronicvotingmacine1(0x38); Electronicvotingmacine4(0x43);Electronicvotingmacine1(0x0C); Electronicvotingmacine4(0x45);

Electronicvotingmacine1(0x06); Electronicvotingmacine4(0x45);Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x44);Electronicvotingmacine1(0x80); for(i=0;i<20;i++){RD7=1;Electronicvotingmacine22(100);R  startagain: D7=0;Electronicvotingmacine22(100);}RD7=0; Electronicvotingmacine1(0x01);

Page 20: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 20/39

 

Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x4f);Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x52);Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0xa0);

Electronicvotingmacine4(0x59); Electronicvotingmacine4(0x4e);Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x4f);Electronicvotingmacine4(0x55);Electronicvotingmacine4(0xa0); while(1){Electronicvotingmacine4(0x57);Electronicvotingmacine4(0x41); if(RC0==0){Electronicvotingmacine19();Electronicvotingma

Electronicvotingmacine4(0x4e); cine10();break;}Electronicvotingmacine4(0x54); else if(RC1==0){Electronicvotingmacine19();break;}Electronicvotingmacine4(0xa0); else if(RC2==0){Electronicvotingmacine19();break;}Electronicvotingmacine4(0x54); }Electronicvotingmacine4(0x4f); }Electronicvotingmacine1(0xc0); else

Electronicvotingmacine4(0x43); {Electronicvotingmacine4(0x48); Electronicvotingmacine1(0x01);Electronicvotingmacine4(0x41);Electronicvotingmacine4(0x4E); Electronicvotingmacine4(0x50);Electronicvotingmacine4(0x47); Electronicvotingmacine4(0x41);Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x53);

Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x53);Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x57);

Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x4F);Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x52);Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x44);Electronicvotingmacine4(0x57); Electronicvotingmacine4(0xa0);

Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x46);Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x41);Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x49);Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x4C);Electronicvotingmacine22(2000); Electronicvotingmacine4(0x53);Electronicvotingmacine1(0x01);

Electronicvotingmacine4(0x50); RD7=1;Electronicvotingmacine4(0x52); Electronicvotingmacine22(4000);Electronicvotingmacine4(0x45); goto startagain;Electronicvotingmacine4(0x53); }Electronicvotingmacine4(0x53); while(1)

Electronicvotingmacine4(0xa0); {Electronicvotingmacine4(0x55); whileloop:Electronicvotingmacine4(0x50); Electronicvotingmacine1(0x01);Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x45);Electronicvotingmacine4(0x46); Electronicvotingmacine4(0x4e);Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x54);

Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x45);Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x52);Electronicvotingmacine4(0x59); Electronicvotingmacine4(0xa0);Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x43);Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x4f);Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x44);

Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x45);Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0xa0);Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x46);Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x4f);Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x52);Electronicvotingmacine4(0x2f); Electronicvotingmacine1(0xc0);

Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x56);Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4f);Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x54);Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x49);Electronicvotingmacine4(0x46); Electronicvotingmacine4(0x4e);

Page 21: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 21/39

 

Electronicvotingmacine4(0x47);Electronicvotingmacine22(1000);

}

for(;;){ void Electronicvotingmacine19(void)Electronicvotingmacine11(); {if(RC0==0) unsigned char i;{ for(i=0;i<2;i++)Electronicvotingmacine19(); {

Electronicvotingmacine1(0x01); RD7=1;vote=Electronicvotingmacine8(0); Electronicvotingmacine22(25);if(vote==5) RD7=0;{ Electronicvotingmacine22(25);RD7=1; }//end of for(i=0;i<5;i++)Electronicvotingmacine13(); }

Electronicvotingmacine22(5000);RD7=0;}else if(vote==6) unsigned char Electronicvotingmacine8(unsigned char sd){ {RD7=1; unsigned char a,xx,i;

Electronicvotingmacine14(); a=0;Electronicvotingmacine22(5000); while(1)

RD7=0; {} Electronicvotingmacine1((0xC0+sd));else if(vote==7) Electronicvotingmacine5(a);{ }

RD7=1; return(xx);Electronicvotingmacine15(); }Electronicvotingmacine22(5000); void Electronicvotingmacine10(void)RD7=0; {} unsigned char  else if(vote==8) newpassword1,newpassword2,newpassword3,newpasswo{ rd4;RD7=1; unsigned char fg1,fg2,fg3,fg4;Electronicvotingmacine16(); Electronicvotingmacine1(0x01);Electronicvotingmacine22(5000); Electronicvotingmacine4(0x4E);RD7=0; Electronicvotingmacine4(0x45);

} Electronicvotingmacine4(0x57);else if(vote==9) Electronicvotingmacine4(0xA0);{ Electronicvotingmacine4(0x50);RD7=1; Electronicvotingmacine4(0x41);Electronicvotingmacine17(); Electronicvotingmacine4(0x53);Electronicvotingmacine22(5000); Electronicvotingmacine4(0x53);

RD7=0; Electronicvotingmacine4(0x57);} Electronicvotingmacine4(0x4F);

Electronicvotingmacine4(0x52);} Electronicvotingmacine4(0x44);if(RC1==0){

Electronicvotingmacine19();Electronicvotingmacine18(); newpassword1=Electronicvotingmacine8(0);goto whileloop; newpassword2=Electronicvotingmacine8(1);} newpassword3=Electronicvotingmacine8(2);

newpassword4=Electronicvotingmacine8(3);

} EEPROM_WRITE(0,newpassword1)

;Electronicvotingmacine22(100);EEPROM_WRITE(1,newpassword2)

;Electronicvotingmacine22(100);} EEPROM_WRITE(2,newpassword3)

;

Page 22: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 22/39

 

Electronicvotingmacine22(100); Electronicvotingmacine4(0xA0);//EEPROM_WRITE(3,newpassword4)

;

Electronicvotingmacine4(0x43);//Electronicvotingmacine22(100); Electronicvotingmacine4(0x4f);//

Electronicvotingmacine4(0x4e);//fg1=EEPROM_READ(0)

;

Electronicvotingmacine4(0x47);//Electronicvotingmacine22(100); Electronicvotingmacine4(0x52);//fg2=EEPROM_READ(1)

;

Electronicvotingmacine4(0x45);//Electronicvotingmacine22(100); Electronicvotingmacine4(0x53);//fg3=EEPROM_READ(2)

;

Electronicvotingmacine4(0x53);//

Electronicvotingmacine22(100); Electronicvotingmacine4(0x3d);//fg4=EEPROM_READ(3)

;

Electronicvotingmacine4(0x36);//Electronicvotingmacine22(100); Electronicvotingmacine1(0xc0);fg1=fg1%10; Electronicvotingmacine4(0x42);//fg2=fg2%10; Electronicvotingmacine4(0x53);//fg3=fg3%10; Electronicvotingmacine4(0x50);//

fg4=fg4%10; Electronicvotingmacine4(0x3d);//Electronicvotingmacine4(0x37);//

Electronicvotingmacine1(0x01); Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x4e);//Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x44);//Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x41);//

Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x3d);//Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x38);//

Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0xA0);//Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x4a);//Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x44);//Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x3d);//

Electronicvotingmacine4(0x49); Electronicvotingmacine4(0x39);//Electronicvotingmacine4(0x53); }Electronicvotingmacine4(0xa0);Electronicvotingmacine5(fg1); unsigned int Electronicvotingmacine12(unsigned char  Electronicvotingmacine5(fg2); timerhigh, unsigned char timerlow)

{Electronicvotingmacine5(fg3);Electronicvotingmacine5(fg4); unsigned intElectronicvotingmacine22(2000); total,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15

,a16;}

if(timerhigh & 0x80){a16=32768;}else{a16=0;}

if(timerhigh & 0x40){a15=16384;}else{a15=0;}unsigned char Electronicvotingmacine9(void) if(timerhigh & 0x20){a14=8192;}else{a14=0;}{ if(timerhigh & 0x10){a13=4096;}else{a13=0;}unsigned char a,xx; if(timerhigh & 0x08){a12=2048;}else{a12=0;}a=0; if(timerhigh & 0x04){a11=1024;}else{a11=0;}

if(timerhigh & 0x02){a10=512;}else{a10=0;}

while(1) if(timerhigh & 0x01){a9=256;}else{a9=0;}{

if(timerlow & 0x80){a8=128;}else{a8=0;}Electronicvotingmacine1(0xC0); if(timerlow & 0x40){a7=64;}else{a7=0;}Electronicvotingmacine7(a); if(timerlow & 0x20){a6=32;}else{a6=0;}} if(timerlow & 0x10){a5=16;}else{a5=0;}

return(xx); if(timerlow & 0x08){a4=8;}else{a4=0;}} if(timerlow & 0x04){a3=4;}else{a3=0;}

if(timerlow & 0x02){a2=2;}else{a2=0;}void Electronicvotingmacine11(void) if(timerlow & 0x01){a1=1;}else{a1=0;}{Electronicvotingmacine1(0x80); total=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13

Electronicvotingmacine4(0x42);// +a14+a15+a16;Electronicvotingmacine4(0x4a);// return(total);Electronicvotingmacine4(0x50);// }Electronicvotingmacine4(0x3d);//Electronicvotingmacine4(0x35);// void Electronicvotingmacine3(unsigned long tt)

Page 23: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 23/39

 

{ Electronicvotingmacine22(100);unsigned short ch,v,b,cc=0x2E; Electronicvotingmacine152=EEPROM_READ(15);ch=ch+48; Electronicvotingmacine22(100);

Electronicvotingmacine4(ch);} Electronicvotingmacine161=EEPROM_READ(16);

Electronicvotingmacine22(100);Electronicvotingmacine162=EEPROM_READ(17);

void Electronicvotingmacine7(unsigned short tt) Electronicvotingmacine22(100);{

unsigned short ch,v,b,cc=0x2E; Electronicvotingmacine171=EEPROM_READ(18);ch=ch+48; Electronicvotingmacine22(100);Electronicvotingmacine4(ch); Electronicvotingmacine172=EEPROM_READ(19);ch=ch+48; Electronicvotingmacine22(100);Electronicvotingmacine4(ch);} Electronicvotingmacine13counter=Electronicvotingmacine1

2(Electronicvotingmacine131,Electronicvotingmacine132);void Electronicvotingmacine5(unsigned short tt) Electronicvotingmacine14counter=Electronicvotingmacine1{ 2(Electronicvotingmacine141,Electronicvotingmacine142);unsigned short ch,v,b,cc=0x2E; Electronicvotingmacine15counter=Electronicvotingmacine1ch=ch+48; 2(Electronicvotingmacine151,Electronicvotingmacine152);Electronicvotingmacine4(ch); Electronicvotingmacine16counter=Electronicvotingmacine1

} 2(Electronicvotingmacine161,Electronicvotingmacine162);Electronicvotingmacine17counter=Electronicvotingmacine1

void Electronicvotingmacine18(void) 2(Electronicvotingmacine171,Electronicvotingmacine172);{unsigned char Electronicvotingmacine1(0xc0);Electronicvotingmacine131,Electronicvotingmacine132,Ele Electronicvotingmacine4(0x42);//

ctronicvotingmacine141,Electronicvotingmacine142,Electro Electronicvotingmacine4(0x4a);//nicvotingmacine151,Electronicvotingmacine152,Electronic Electronicvotingmacine4(0x50);//votingmacine161,Electronicvotingmacine162,Electronicvoti Electronicvotingmacine4(0xa0);//ngmacine171,Electronicvotingmacine172; Electronicvotingmacine3(Electronicvotingmacine13counter  unsigned int );Electronicvotingmacine13counter,Electronicvotingmacine1 Electronicvotingmacine4(0xa0);//

4counter,Electronicvotingmacine15counter,Electronicvoting Electronicvotingmacine4(0xa0);//macine16counter,Electronicvotingmacine17counter; Electronicvotingmacine4(0xa0);//Electronicvotingmacine1(0x01); Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0xa0);//

Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0x44);// while(RC2==1);Electronicvotingmacine4(0x49);// Electronicvotingmacine19();Electronicvotingmacine4(0x4e);//Electronicvotingmacine4(0x47);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine1(0xc0);

Electronicvotingmacine4(0x56);// Electronicvotingmacine4(0x43);//Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0x4f);//Electronicvotingmacine4(0x54);// Electronicvotingmacine4(0x4e);//Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x47);//Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x52);//

Electronicvotingmacine4(0x45);//

Electronicvotingmacine131=EEPROM_READ(10); Electronicvotingmacine4(0x53);//Electronicvotingmacine22(100); Electronicvotingmacine4(0x53);//Electronicvotingmacine132=EEPROM_READ(11); Electronicvotingmacine4(0xa0);//Electronicvotingmacine22(100); Electronicvotingmacine3(Electronicvotingmacine14counter  

);Electronicvotingmacine141=EEPROM_READ(12); while(RC2==1);

Electronicvotingmacine22(100); Electronicvotingmacine19();Electronicvotingmacine142=EEPROM_READ(13);Electronicvotingmacine22(100); Electronicvotingmacine1(0xc0);

Electronicvotingmacine4(0x42);//Electronicvotingmacine151=EEPROM_READ(14); Electronicvotingmacine4(0x53);//

Page 24: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 24/39

 

Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0x52);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x41);//Electronicvotingmacine3(Electronicvotingmacine15counter Electronicvotingmacine4(0x53);//

); Electronicvotingmacine4(0x45);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine1(0xc0);Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x44);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x41);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x54);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x41);//

Electronicvotingmacine4(0xa0);// Electronicvotingmacine22(2000);Electronicvotingmacine4(0xa0);//while(RC2==1); Electronicvotingmacine1(0x01);Electronicvotingmacine19(); Electronicvotingmacine4(0x50);//

Electronicvotingmacine4(0x52);//Electronicvotingmacine4(0x45);//

Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x53);//Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x53);//Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0x55);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x50);//Electronicvotingmacine3(Electronicvotingmacine16counter Electronicvotingmacine4(0xa0);//

); Electronicvotingmacine4(0x46);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x4f);//

Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x52);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x59);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x45);//

Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x53);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine1(0xc0);while(RC2==1); Electronicvotingmacine4(0x45);//Electronicvotingmacine19(); Electronicvotingmacine4(0x4e);//

Electronicvotingmacine4(0x54);//Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x45);//

Electronicvotingmacine4(0x4a);// Electronicvotingmacine4(0x52);//Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x2f);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x44);//Electronicvotingmacine3(Electronicvotingmacine17counter Electronicvotingmacine4(0x57);//); Electronicvotingmacine4(0x4e);//

Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x46);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x4f);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x52);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);//Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x4e);//

Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x4f);//Electronicvotingmacine4(0xa0);//while(RC2==1);Electronicvotingmacine19();

}

Electronicvotingmacine1(0x01); void Electronicvotingmacine4(unsigned short k)Electronicvotingmacine4(0x57);// {Electronicvotingmacine4(0x41);// unsigned short b,v;Electronicvotingmacine4(0x4e);// unsigned int ii;Electronicvotingmacine4(0x54);// Electronicvotingmacine21();

Electronicvotingmacine4(0xa0);// PORTB=k  

;Electronicvotingmacine4(0x54);// RD4=1;Electronicvotingmacine4(0x4f);// RD5=0;Electronicvotingmacine4(0xa0);// RD6=1;Electronicvotingmacine4(0x45);// for(ii=0;ii<100;ii++)Electronicvotingmacine24();

Page 25: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 25/39

 

RD6=0; Electronicvotingmacine4(0x53);} Electronicvotingmacine4(0x49);

Electronicvotingmacine4(0x4e);

Electronicvotingmacine4(0x47);void Electronicvotingmacine20(void) for(i=0;i<20;i++){RD7=1;Electronicvotingmacine22(100);R  { D7=0;Electronicvotingmacine22(100);}unsigned char kl1,kl2,kl3,kl4,rd1,rd2,rd3,rd4,i;Electronicvotingmacine1(0x01); EEPROM_WRITE(10,0)

;Electronicvotingmacine4(0x45); Electronicvotingmacine22(100);

Electronicvotingmacine4(0x4e); EEPROM_WRITE(11,0);Electronicvotingmacine4(0x54); Electronicvotingmacine22(100);

Electronicvotingmacine4(0x45);rd1=EEPROM_READ(0)

;

EEPROM_WRITE(12,0)

;Electronicvotingmacine22(100); Electronicvotingmacine22(100);rd2=EEPROM_READ(1)

;

EEPROM_WRITE(13,0)

;Electronicvotingmacine22(100); Electronicvotingmacine22(100);rd3=EEPROM_READ(2)

;Electronicvotingmacine22(100); EEPROM_WRITE(14,0)

;rd4=EEPROM_READ(3)

;

Electronicvotingmacine22(100);Electronicvotingmacine22(100); EEPROM_WRITE(15,0)

;rd1=rd1%10; Electronicvotingmacine22(100);

rd2=rd2%10;rd3=rd3%10; EEPROM_WRITE(16,0)

;rd4=rd4%10; Electronicvotingmacine22(100);Electronicvotingmacine4(0x52); EEPROM_WRITE(17,0)

;Electronicvotingmacine4(0xA0); Electronicvotingmacine22(100);Electronicvotingmacine4(0x50);

Electronicvotingmacine4(0x41); EEPROM_WRITE(18,0)

;Electronicvotingmacine4(0x53); Electronicvotingmacine22(100);Electronicvotingmacine4(0x53); EEPROM_WRITE(19,0)

;Electronicvotingmacine4(0x57); Electronicvotingmacine22(100);Electronicvotingmacine4(0x4F);

Electronicvotingmacine4(0x52);Electronicvotingmacine4(0x44); }kl1=Electronicvotingmacine8(0); elsekl2=Electronicvotingmacine8(1); {kl3=Electronicvotingmacine8(2); Electronicvotingmacine1(0x01);kl4=Electronicvotingmacine8(3); Electronicvotingmacine4(0x50);

if(kl1==rd1) Electronicvotingmacine4(0x41);{ Electronicvotingmacine4(0x53);Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x53);Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x57);Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x4F);Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x52);

Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x44);Electronicvotingmacine4(0x57); Electronicvotingmacine4(0xa0);Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x46);Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x41);Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x49);Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x4C);

Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x53);Electronicvotingmacine4(0x4F); RD7=1;Electronicvotingmacine4(0x52); Electronicvotingmacine22(4000);Electronicvotingmacine4(0x52); RD7=0;Electronicvotingmacine4(0x45); }Electronicvotingmacine4(0x43);

Electronicvotingmacine4(0x54); }Electronicvotingmacine1(0XC0);Electronicvotingmacine4(0x45); void Electronicvotingmacine1(unsigned int a)Electronicvotingmacine4(0x52); {Electronicvotingmacine4(0x41); unsigned int i;

Page 26: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 26/39

 

unsigned int b; Electronicvotingmacine22(100);Electronicvotingmacine21(); EEPROM_WRITE(11,lowcount)

;TRISB=0x00; Electronicvotingmacine22(100);

PORTB=a

;

Electronicvotingmacine1(0x01);RD4=0;RD5=0; Electronicvotingmacine4(0x56);RD6=1; Electronicvotingmacine4(0x4f);for(i=0;i<100;i++)Electronicvotingmacine24(); Electronicvotingmacine4(0x54);RD6=0; Electronicvotingmacine4(0x45);

} Electronicvotingmacine4(0x44);Electronicvotingmacine4(0xa0);

void Electronicvotingmacine13(void) Electronicvotingmacine4(0x54);{ Electronicvotingmacine4(0x4f);unsigned char Electronicvotingmacine4(0xa0);Electronicvotingmacine131,Electronicvotingmacine132,low Electronicvotingmacine4(0x42);

count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, Electronicvotingmacine4(0x4a);a13,a14,a15,a16; Electronicvotingmacine4(0x50);unsigned int finalcount;

Electronicvotingmacine1(0xc0);Electronicvotingmacine131=EEPROM_READ(10); Electronicvotingmacine6(Electronicvotingmacine131);Electronicvotingmacine22(200); Electronicvotingmacine4(0xa0);

Electronicvotingmacine132=EEPROM_READ(11); Electronicvotingmacine6(Electronicvotingmacine132);Electronicvotingmacine22(200); Electronicvotingmacine4(0xa0);

finalcount=Electronicvotingmacine12(Electronicvotingmaci Electronicvotingmacine6(highcount);ne131,Electronicvotingmacine132); Electronicvotingmacine4(0xa0);if(finalcount<65535){finalcount=finalcount+1;} Electronicvotingmacine6(lowcount);if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 Electronicvotingmacine4(0xa0);

0000 0000 }if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 00000000 0000 void Electronicvotingmacine21(void)if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000 {0000 0000 unsigned int i;if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 RD4=0;

0000 0000 RD5=1;if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 while(RB7)0000 0000 {if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 RD6=0;0000 0000 for(i=0;i<100;i++)Electronicvotingmacine24();

if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 RD6=1;0000 0000 }if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 }0000highcount=a16+a15+a14+a13+a12+a11+a10+a9; void Electronicvotingmacine14(void)if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 {

1000 0000 unsigned char  if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 Electronicvotingmacine141,Electronicvotingmacine142,low0100 0000 count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 a13,a14,a15,a16;0010 0000 unsigned int finalcount;if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000

0001 0000 Electronicvotingmacine141=EEPROM_READ(12);if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 Electronicvotingmacine22(100);1000 Electronicvotingmacine142=EEPROM_READ(13);if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 Electronicvotingmacine22(100);0100 finalcount=Electronicvotingmacine12(Electronicvotingmaciif(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 ne141,Electronicvotingmacine142);

0010 if(finalcount<65535){finalcount=finalcount+1;}if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 00000001 0000 0000lowcount=a8+a7+a6+a5+a4+a3+a2+a1; if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000EEPROM_WRITE(10,highcount)

;

0000 0000

Page 27: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 27/39

 

if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000 if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 00000000 0000 0000 0000if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000

0000 0000 0000 0000if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 00000000 0000 0000 0000if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 00000000 0000 0000 0000if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000

0000 0000 0000 0000if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 01000000 0000 0000highcount=a16+a15+a14+a13+a12+a11+a10+a9; if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 0000 00001000 0000 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000

if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 00000100 0000 highcount=a16+a15+a14+a13+a12+a11+a10+a9;if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 00000010 0000 1000 0000if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 00000001 0000 0100 0000

if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 00001000 0010 0000

if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 00000100 0001 0000if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 00000010 1000

if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 00000001 0100lowcount=a8+a7+a6+a5+a4+a3+a2+a1; if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000EEPROM_WRITE(12,highcount)

;

0010Electronicvotingmacine22(100); if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000EEPROM_WRITE(13,lowcount)

;

0001

Electronicvotingmacine22(100); lowcount=a8+a7+a6+a5+a4+a3+a2+a1;Electronicvotingmacine1(0x01); EEPROM_WRITE(14,highcount)

;Electronicvotingmacine22(100);Electronicvotingmacine6(Electronicvotingmacine141); EEPROM_WRITE(15,lowcount)

;Electronicvotingmacine4(0xa0); Electronicvotingmacine22(100);

Electronicvotingmacine6(Electronicvotingmacine142); Electronicvotingmacine1(0x01);Electronicvotingmacine4(0xa0); }Electronicvotingmacine6(highcount);Electronicvotingmacine4(0xa0); void Electronicvotingmacine16(void)Electronicvotingmacine6(lowcount); {Electronicvotingmacine4(0xa0); unsigned char  

} Electronicvotingmacine161,Electronicvotingmacine162,lowcount,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,

void Electronicvotingmacine15(void) a13,a14,a15,a16;{ unsigned int finalcount;unsigned char Electronicvotingmacine151,Electronicvotingmacine152,low Electronicvotingmacine161=EEPROM_READ(16);

count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, Electronicvotingmacine22(100);a13,a14,a15,a16; Electronicvotingmacine162=EEPROM_READ(17);unsigned int finalcount; Electronicvotingmacine22(100);

finalcount=Electronicvotingmacine12(ElectronicvotingmaciElectronicvotingmacine151=EEPROM_READ(14); ne161,Electronicvotingmacine162);Electronicvotingmacine22(100); if(finalcount<65535){finalcount=finalcount+1;}

Electronicvotingmacine152=EEPROM_READ(15); if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000Electronicvotingmacine22(100); 0000 0000finalcount=Electronicvotingmacine12(Electronicvotingmaci if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000ne151,Electronicvotingmacine152); 0000 0000if(finalcount<65535){finalcount=finalcount+1;} if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000

Page 28: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 28/39

 

0000 0000 0000 0000if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 01000000 0000 0000 0000

if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 00100000 0000 0000 0000if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 00000000 0000 0000if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 highcount=a16+a15+a14+a13+a12+a11+a10+a9;0000 0000 if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000

if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 1000 00000000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000highcount=a16+a15+a14+a13+a12+a11+a10+a9; 0100 0000if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 00001000 0000 0010 0000if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000

0100 0000 0001 0000if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 00000010 0000 1000if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 00000001 0000 0100if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000

1000 0010if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000

0100 0001if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 lowcount=a8+a7+a6+a5+a4+a3+a2+a1;0010 EEPROM_WRITE(18,highcount)

;if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 Electronicvotingmacine22(100);

0001 EEPROM_WRITE(19,lowcount)

;lowcount=a8+a7+a6+a5+a4+a3+a2+a1; Electronicvotingmacine22(100);EEPROM_WRITE(16,highcount)

;Electronicvotingmacine22(100); }EEPROM_WRITE(17,lowcount)

;Electronicvotingmacine22(100); void Electronicvotingmacine22(unsigned int h )

Electronicvotingmacine1(0x01); {} unsigned int j;

for(j=0;j<h*10;j++){Electronicvotingmacine24();Electronicvotingmacine24();}

void Electronicvotingmacine17(void) }

{unsigned char Electronicvotingmacine171,Electronicvotingmacine172,lowcount,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16; void Electronicvotingmacine23(void)unsigned int finalcount; {

unsigned int i;Electronicvotingmacine171=EEPROM_READ(18); for(i=0;i<6000;i++)Electronicvotingmacine22(100); Electronicvotingmacine24();Electronicvotingmacine172=EEPROM_READ(19); }Electronicvotingmacine22(100);finalcount=Electronicvotingmacine12(Electronicvotingmaci

ne171,Electronicvotingmacine172); void Electronicvotingmacine24(void)if(finalcount<65535){finalcount=finalcount+1;} {if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 ;0000 0000 }if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 00000000 0000

if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 00000000 0000if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 00000000 0000if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000

Page 29: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 29/39

 

Page 30: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 30/39

 

Page 31: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 31/39

 

Page 32: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 32/39

 

Page 33: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 33/39

 

Page 34: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 34/39

 

Page 35: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 35/39

 

Page 36: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 36/39

 

Page 37: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 37/39

 

Page 38: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 38/39

 

Page 39: Micrcontroller Based Electronic Voting Machine

8/3/2019 Micrcontroller Based Electronic Voting Machine

http://slidepdf.com/reader/full/micrcontroller-based-electronic-voting-machine 39/39