intoduction to electronic voting machine2
TRANSCRIPT
DEPARTMENT OF ELECTRONIC SCIENCE NEW PRINCE SHRI BHAVANI ARTS AND SCIENCE COLLEGE MEDAVAKKAM, CHENNAI- 600 100 UNIVERSITY OF MADRAS
A PROJECT “ELECTRONIC VOTING MACHINE” –BY MICROPROCESSOR 8085 Submitted in partial fulfillment of the requirements for the award Of the bachelor’s degree in the discipline of
ELECTRONIC SCIENCE
BY K.ARUN SHANKAR REG.NO: S603640
Under the guidance of
NEW PRINCE SHRI BHAVANI ARTS AND SCIENCE COLLEGE MARCH 2009
1
BONAFIDE CERTIFICATE
This is certify that the project report titled
“ELECTRONIC VOTING MACHINE” BY MICROPROCESSOR 8085
Is a bonafide record of work done by
K. ARUN SHANKAR REG.NO.s603640
OF ELECTRONIC SCIENCE DEPARTMENT
NEW PRINCE SHRI BHAVANI ARTS AND SCIENCE COLLEGE
Patel road, medavakkam, Chennai – 6
In partial fulfillment of the requirements for the award
Of the Bachelor’s degree in the discipline of
Electronic science during the year 2006-2009.
Mrs. . Mrs.D.Beula.m.sc., m.phil., Guide Head of the DepartmentDepartment of electronics Department of electronics Science Science
2
INTRODUCTION TO ELECTRONIC VOTING MACHINE
Digital integrated chips as if microprocessor
provides a broader base for only computers but also to many
applications of communications and, industrial automation and so
on. One such gadget is the voting machine, which is dealt in this
project. Microprocessor based voting machines the election process
simple and highly reliable.
EVM’s manufactured in 1989-90 were used for the first time in
legislative assemblies held in 1998.
VARIOUS FORM OF EVM
A electronic voting machine that consist of
two units
The control unit is with the presiding officer who can start the
election,
end the election or suspend the election temporarily if there
is any
3
confusion etc.
The balloting unit is placed inside the voting
compartment.
Instead of issuing a ballot paper, the polling officer in charge
of the control unit will press the button on the balloting unit
against the
candidate and symbol of his choice.
Ballot, in modern usage , a sheet of paper used
in voting, usually in an electoral system that allows the voter to
make choices secretly. The term may also designate the method and
act of voting secretly by means of a mechanical device.
Used in elections in all democratic countries,
the ballot method protects voters from coercion and reprisal in the
exercise of their vote. Wherever the practice of deciding questions
by free vote has prevailed, some form of secret voting has always
been found necessary.
4
The ballot box unit is designed in such a way that
it very closely resembles the existing ballot paper. The electoral
codes and names of the candidates are printed and pasted on the
box itself. The only difference is that the desired candidate is
selected by pressing a switch.
After polling the vote, a led is lighted up
confirming the voter that the machine his read his choice.
As we stated earlier we cannot
easily cheat
Microprocessor to favor any candidate. This voting machine is a
straightforward one.
In this, microprocessors based voting machine project, we have
eliminated invalid votes. We use microprocessors for fast actions for
example, the keyboard (i.e.) the valid keys are enabled for a voter
to cast his vote and can be disabled within few microseconds after
casting vote.
5
Thus can avoid a voter casting vote for two
candidates. The microprocessors based voting machine also uses
the microprocessors to display the current votes polled done by the
microprocessors simultaneously controlling the whole procedure of
elections.
To store the results and the individual votes
acquired can be stored in the memory of the microprocessors itself.
Another important fact is we cannot read the individual votes during
the election time but only after End of election key is pressed by the
presiding officer the election results can be read. This is yet another
important feature of this machine.
The software developed for this machine has
been done with sufficient and necessary came that if two or more
people have got same number of votes then also the microprocessor
6
displays their names or code and also their maximum votes, but it is
our duty to select the candidate.
The stamp used in the present voting system is
replaced by a switch “ON”…by pressing the vote switch and then
the machine records the voter’s choice in the memory of the
microprocessors.
At the end of the day the results are retrieved
by operating a END OF ELECTION switch. The biggest advantage of
the electronic machine is that the results are available immediately
at the end of voting period.
In this important that is one is machine
software. It has been designed in such a way that multiple voting is
not possible. Once the key is enabled, only that one vote can be
cast. After that casting one, within few microprocessor the ballot
box is disabled. This is achieved by microprocessor software.
7
Therefore, this microprocessor software is
applicable for all the electronic device of interfacing of voting
machine.
These software programs are achieved by
own electronic engineer which is to make this device, for only to
given the machine by using software application of programs.
These software programs are written in the
microprocessors of 8085 integrated chips.
Therefore these indicates that the , within all
the software programs can had the operating system by controlling
module, balloting module, and these are done by interfacing within
peripheral
device are such as explained.
Thus all the digital device which is having the
basic property that contain the application of microprocessor and
some peripherals device and some interfacing chips are to be used
although these devices is the basic processor.
8
The microprocessors 8085 is a programmed
integrated device that has computing and decision making
capability similar to that of the CPU of a computer. The
microprocessors communications and operates in the binary
numbers 0 and 1 called BITS. Therefore the binary instructions are
given abbreviated names called MNEMONICS, which form the
assembly languages for a given microprocessor .IC 8255 is a widely
used programmable , parallel I/O device. It can be programmed to
transfer data under various conditions , for simple I/O and interrupt
I/O.
VARIOUS UNITS OF EVM
CONTROL UNIT
BALLOTING UNIT
KEYBOARD UNIT
9
CONTROL UNIT
As the name implies that it is used for
controlling the whole voting machine. That is control module, which
are used for controlling the microprocessor by some software
programs which are implemented. When these control module,
which are controlling by the control officer of presiding in election
committee.
During this controlling, there may be some
important contributes that is, control module which is used for the
election committee through the presiding officer.
When the control officer is set to work for
identifying the candidate by some clarification of the government.
After checking the people is set to put the vote for desired
nominees during the election.
When sometimes ,there may be some
malpractices is done during election, the control module that is
control officer is set to controlling the whole election is set to
suspend that is stop the election.
10
After this the problem was solved, then the
election is start as such regularly, by this control module , some
kinds of machine is used for safer and more compatibility of
machine. The control module has five important switches, which
controls the electronic voting machine with their corresponding to
identify the button is pressed when the LED is glowing for desire
switches.
The control module has five important control
switches, which controls the whole voting machine with their
corresponding LED’s. The function of each key is explained below.
CLEAR KEY
The clear key is used to identify the accumulator and
goes into the accumulator. When the code is enter into the
microprocessors clear the memory content specified by the address
of voting machine.
11
START KEY
The start key are used to start the election, by after
the clear key is pressed, its clear the memory location to start key is
pressed.
SUSPEND KEY
The suspend key are used after during the election
system is set suspend (or) paused in such a time by control officer.
VOTER KEY
After checking the control officer of voters, this key
is pressed, whether the voter is valid is set to put a vote. And when
is key is press it indicate the voter is a bonafide voter.
END KEY
When these key are used, that is election comes to
an end, That is key is pressed all the input and output process are
send to an end Moreover, these, by control module.
12
BALLOTING UNIT
Ballot box unit are designed in such a way
that, it is closely resembles that and existing a ballot paper.
Electoral codes and names of he candidates are selected by
pressing a switch.
After polling the votes are identify by led is
glowing up and conforming the votes that the machine has read his
choice. Therefore, these ballot box units consist of number of
candidate, which are take an part of election member. There may be
have a candidate switch and led are used for candidate to identify
by people.
These led are used for identified, whether
the vote are put to the correct member by people. In addition, the
candidates switch and are connected by software programs by the
13
microprocessors of 8085 IC. That is, when the switch is pressed the
candidate led is glowing.
Although, when these balloting unit consist
of some kind of memory by using microprocessors of 8085
integrated IC.
When people are get to ready to put the
vote for desired candidate for its voter then the microprocessor is
ready to keen the vote, that is memory is ready to catch the signal
and storing the date.
Balloting unit is presiding connected with
the control module which are interfacing through the electronic
lines, therefore control module is set to work for controlling the
date should presiding in electronic device.
KEYBOARD UNIT
14
Keyboard module contains seven keys with
eight LED’s. when the valid voter key is pressed the ENABLE LED
glows indicating that the keys are enabled and the voter can cast
(i.e.)., a particular candidate key is pressed the contents of the
corresponding memory location of the candidate gets incremented
by one. Immediately the LED of that corresponding candidate glows
along with a buzzer denoting that the vote has been entered.
OUTPUT OF PORTS B and PORT C
The output of ports B and ports C are connected to a buffer IC
74LS244. the LED’s and the buzzer to indicate which key is pressed
etc., One output is used to control, (i.e.), enable or disable the
keyboard.
15
PROGRAMMABLE PERIPHERAL DEVICE
8255
Intel 8255 is a programmable peripheral interface (PPI), also known
as a programmable interface adapter (PIA). It is a 40 pin IC. The
8255 is a widely used programmable, parallel I/O device that can be
used with almost any microprocessor.
It can be programmed to transfer data under various
conditions, for simple I/O and interrupt I/O. The 8255 has 24 I/O pins
that can be grouped primarily in two 8 bit parallel ports A&B, with
remaining eight bits as port C. The eight bits of port C can be used
as,
Two 4-bit ports namely port C upper (CU) and port C
lower (CL). Each port can be programmed as in input port or an
output port.
The functions of these ports are defined by writing a
control word in the control word in the control register.
16
All the functions of 8255, are classified according to
two modes,
The bit set/reset (BSR) mode
I/O mode
The BSR mode is used to set or reset the bits in ports C.
The I/O mode is further divided into 3 modes, are mode 0, mode 1, mode 2.
In mode 0, all the ports function as simple I/O ports.
In mode 1, is a handshake mode where by ports A or ports B uses
bits from
port C as handshake signals.
In mode 2, port A can be set up for bi – directional data transfer
using handshake signals from port C and port B can be set up either
in mode 0 or mode 1. Handshake signal are exchanged between the
MPU and Peripherals prior to data transfer.
17
PIN CONFIGURATION OF 8255
18
BLOCK DIAGRAM OF 8255
19
8255- FUNCTIONAL DESCRIPTION
DATABUS BUFFER
This tri-state bidirectional 8-bit buffer is used to
interface the 8255 to the system data bus. Data is transmitted or
received by the buffer upon execution of I/P Or O/P instruction by
the CPU control words and status information are also transmitted
through the data bus buffer.
READ/WRITE CONTROL LOGIC
The function of this block is managing all the
internal and external transfers of both data and control status
words. It accept inputs from the CPU address and control busses
and in turn, issues command to both of control groups.
20
RD(Read) :
It is a active low control signal, which enables the
read operation. When the signal is low , the MPU reads from a
selected I/O ports of the 8255A.
WR(Write) :
It is an active low signal. Which enables a write
operation.
CS(Chip select):
It is an active low signal, which enables the
communication between the 8255A chip and the microprocessors.
21
A0 and A1:
A0 and A1 are device select signals. These are
generally connected to MPU address lines A0 and A1 respectively.
And these address lines are used to select one of the ports or a
control register which is used to initialize the ports that are given
below.
A
1
A
0
RD W
R
C
S
INPUT OPERATION
(READ)
0 0 0 1 0 Port AData bus
0 1 0 1 0 Port B Data bus
1 0 0 1 0 Port C Data bus
1 1 0 1 0 Control word Data
22
bus
D0 – D7:
These are the data input /output lines for the device.
All information read from and written to the 8255 occurs via these 8
data lines.
RESET:
The 8255 is placed into its reset state if this input line
is a logical 1. all peripheral orts are set t the input mode.
PA0 – PA7,PB0 –PB7, PC0 – PC7
These signal lines are used as 8- bit I/O ports.
They can be connected to the peripheral devices. The 8255 has
three 8 bit I/O ports and each one can be connected to the physical
lines of an external devices. These lines are labeled PA0-PB7 and
23
PC0-PC7. The groups of the signals are divided into three different
I/O ports labeled port A (PA), port B (PB), port C(PC).
Two control groups, labeled group A control and
group B control define how the three I/O ports operate. There are
several different operating modes for the 8255 and these modes
must be defined by the CPU writing programming or control words
to the device 8255. The line group of port C consists of two 4 bit
ports. One of the four bit groups is associated with group A control
and the other 4 bit group with group B device signals. The upper 4
bits of port C are associated with A control while the lower 4 bits
are associated with group B control.
PORT SELECTION 0 and PORT SELECTION 1
These input signals in conjunction with the RD and WR
inputs, control the selection of one of the three ports or the control
24
word registers. They are normally connected to the least significant
bits of the address bus A0 and A1.
PORTS A, B and C
The 8255 contains three 8 bits ports (A, B and C) all can
be configured in a wide variety of functional characteristics by the
system software but each has its own special features to further
enhance the power and flexibility of the 8255.
PORT A
Port A contains are eight bit data output latch/buffer and
eight bit data input latch.
PORT B
Port B contains one eight-bit data input/output
latch/buffer and one 8 bit data input buffer.
25
PORT C
Port c contains one eight-bit data latch/buffer and one
eight bit data input buffer (no latch for input). This port can be
divided into two four bit ports under the mode control. Each four bit
port contains a four bit latch and it can be used for the control
signals outputs and status signals inputs is conjunction with port A
and port B.
MODE SLECTION
There are three basic modes of operation that can be
selected by the system software. They are as follows :
MODE 0 - Basic input / output
MODE 1 - Strobe input/ output
MODE 2 - Bi-directional bus
26
When the reset input goes high all the ports will be set
to the input mode. After the reset, the 8255 can remain in the input
mode with no additional initialization required.
During the execution of the system program of any of
the other modes may be selected using a single output instruction.
This allows a single 8255 to service a variety of peripheral devices
with a simple software maintenance routine.
The functions of 8255 are classified according to two modes:
BIT SET/RESET MODE (BSR MODE):
When D7 bit in control word is zero, 8255 is in BSR mode each
mode in port C alone can be set or rest.
I/O MODE:
In I/O Mode, the chip operates under Mode 0, Mode 1 and Mode
2.
27
Mode 0:
Ports A and B operate as either inputs or outputs and
Ports C is divided into two 4-bit groups either of which can be
operated as inputs or outputs. The disadvantage of this mode is
that it does not have handshake or interrupt capability.
Mode 1:
Same as Mode 0 but Port C is used handshaking and
control. This mode is also known as strobe input/output mode.
The mode 1 has input control signals such as STB and IBF.
STB(Strobe Input)
It is an active low signal generated by a peripheral
device to indicate that it has transmitted a byte of
data.
IBF(Input Buffer Full)
28
It is a high acknowledge signal by the 8255A to
indicate that the input latch has received that data
byte.
INTR(Interrupt Request)
It is an active high output signal used to interrupt
the microprocessors.
INTE(Interrupt Enable)
This is an internal flip-flop used to enable or
disable the generation.
The mode 1 has output signals such as :
OBF(Output Buffer full)
It is an active low output signal generated,
when the microprocessors writes into the output latch of the 8255A.
ACK(Acknowledge)
29
It is an active low input signal from a
peripherals device that must output a low when the peripherals
device receives data from the ports of 8255A.
INTR(Interrupt request)
This is an output signal and it is set by the
raising edge of the ACK signal. This signal is used to interrupt the
MPU to request the next data byte for output. The INTR is set when
OBF, ACK and INTE are all one and reset by the falling edge of WR.
INTE(Interrupt enable)
This is an internal flip-flop to a port and needs
to be set to generate the INTR signal. The Two flip-flops INTEA and
INTEB are controlled by bits PC6 and PC2, through the BSR mode.
PC4,5:
These two lines can be set up either as input
or output.
PORT A as INPUT PORT:
When port A acts as an input port, port C bits
PC3, PC4 and PC5 acts as handshake signals. When port B acts as
30
input port, port C bits PC0, PC1 and PC2 act as handshake signals.
The remaining port C bits PC6 and PC7 can be used as input or
output ports.
In Mode1, if port A is configured as an input
port, PC4 bit receives a strobe(STB) signal from an input device and
PC5 bit sends out an input buffer full signal(IBF). The input device
places 8 bits of data as PA0 and PA7 of the input latch. This makes
the IBF signal to determine whether data is available for input the
microprocessor.
PORT A as OUTPUT PORT:
In mode 1, when port A is configured as an output port,
port C bits PC3, PC6 and PC7, act as handshake signals. The
microprocessor writes data to port A and port A outputs data to an
output device. When port A receives data, a signal called output
buffer full(OBF) is reset to logic ‘0’. The output device monitors
OBF to determine when data is available. After accepting the data,
the output device sends an active low acknowledgement
signal(ACK) to the 8255 and this clears OBF. Now the
microprocessor can send the next data.
31
Mode 2:
Port A is bi-directional(both input and output) and Port
C is handshaking. Port B is not used. Port A uses five signals from
port C as Handshake signals for data transfer. The remaining three
signals from port C can be used either as simple I/O or as handshake
for port B.
CONTROL WORD
8255 is initialized by writing a control word in the
control register. The contents of control register is called control
word. This specifies an I/O function for each port.
Bit D7 of the control register I/O function or BIT
SET/RESET function, as classified in the following fig 1. if bit D7 =1,
bits D6-D0 determined I/O functions in various modes as shown in
fig. if bit D7=0, port C operates in the BIT SET/RESET mode. The BSR
control word does not affect the functions of port A and port B.
32
There are three steps are needed to communicate
with peripherals through the 8255a. They are,
The address of PORT A, B and C of the control
register according the chip select logic and
address lines A0 and A1.
Writing a control word in the control register.
Writing an I/O instruction to communicate with
peripherals through port A,B and C.
MODE 0 : SIMPLE INPUT PORT OR OUTPUT PORT
In mode 0, port A and port B are used as two simple 8-
bit I/O ports and port C as two 4- bit I/O ports without handshake
facility. The 4-bits of port (Cl) lower and 4- bit of port(Cu) upper can
be individually initialized to act as import port or output port. The
I/O features in mode 0 are as follows:
o Output are latched.
33
o Input are not latched.
o Ports do not have handshake or
interrupt capability.
PORT ADDRESSES
PORT A : DC
PORT B : DD
PORT C : DE
CONTROL REGISTER : DF
34
VOTING MACHINE ARCHITECTURE
In this chapter let us consider the hardware
description of the system. The block diagram of the hardware part is
as shown in the fig. in general the control keys and the ballot keys
are connected to a encoder which converts each key into a
particular code. This binary information is sent through a buffer
35
where it is amplified in current amplification and fed into the port of
a microprocessor.
In the similar way the output of the microprocessors
is sent to a buffer through the port. The output information is again
amplified and sent to drive the systems like LED etc. let us see each
section of the hardware in detail.
OCTAL TO BINARY : ( IC 74148)
When a particular key is pressed then that key is
grounded. To convert the key pressed into a particular binary code
we use IC 74148. this is an “octal to binary Encoder” we can have 8
key is as inputs. If any one of the key is grounded then there will be
equivalent binary output. It has active low inputs and active low
outputs. The chip is enabled when EI is taken low.
This chip is a higher order priority encoder , (i.e.) if
two key is pressed simultaneously then the chip will take the input
value which has higher order compared with order. It will give low
outputs from 0 to 8 values.
PIN DIAGRAM OF IC 74148
36
Various function of this pin out configuration
Chip is given in tables
EI I N P U T S OUT PUT ACT IVE LOW
37
S BIN ARY O/P
0 1 2 3 4 5 6 7 8 GS ED C B A
1 X X X X X X X X X 1 1 1 1 1
0 0 1 1 1 1 1 1 1 1 0 1 1 1 1
0 X 0 1 1 1 1 1 1 1 0 1 1 1 0
0 X X 0 1 1 1 1 1 1 0 1 1 0 1
0 X X X 0 1 1 1 1 1 0 1 1 0 0
0 X X X X 0 1 1 1 1 0 1 0 1 1
0 X X X X X 0 1 1 1 0 1 0 1 0
0 X X X X X X 0 1 1 0 1 0 0 1
0 X X X X X X X 0 1 0 1 0 0 0
0 X X X X X X X X 0 0 1 0 0 0
0 1 1 1 1 1 1 1 1 1 1 0 1 1 1
In our project we need to convert as OCTAL key into
BINARY data. This is efficiently done by IC 74148.
Also in the keyboard module, the chip enable pin EI is
controlled by the software programmed. (i.e.), that is connected to
38
the output port of the microprocessors when any key is pressed,
immediately the microprocessors senses the key pressed and sends
signals to disable the IC 74148. Thus second time voting are
prevented.
The seven candidate keys are connected with the
three bits of port A and five control keys are encoded with the
other three bits of port A using this encoder.
HEX INVERTER IC 7404
Since, IC 74148 is an active low output chip, we need
to use an inverter. IC 7404 in an Hex inverter. That is it has six NOT
gates with six inputs and six outputs.
We use this chip for inverting three outputs of IC
74148 from control module and three outputs of IC 74148 from
keyboard module. IC 7404 pin out configuration is as shown in the
fig, the outputs of Hex inverter is given to buffer as data input.
PIN CONFIGURATION OF IC 7404
39
OCTAL BUFFER(LS 74244)
In octal buffer, there are two groups, which have
4 tri-state output buffers. The buffer is controlled by 2 active low
enabled lines (Pin no.1 and Pin no.19). These pins are connected
40
which is called as an output enabled input pin (OE). It has 3 states,
logic 0, logic 1 and high impedance Z.
When OE is low (Logic 0), the device passes the
non-inverted data from an input to the Y output. When OE is high,
the outputs are in the high impedance state (i.e.). The output is
disconnected from the rest of the circuit.
PIN DIAGRAM OF 74LS244
EVM – CIRCUIT DIAGRAM
41
SOFTWARE DEVELOPMENT
OF
ELECTRONIC VOTING MACHINE
42
This chapter deals with the whole programming method
of electronic voting machine. The important aspect in the first part
of the software is to communicate with the peripherals devices. The
8085 microprocessors has two instructions for data transfer
between the processor and I/O device. The instruction IN inputs the
data from a input device such as LED dislplay. These are two byte
instructions with second byte specifying the address of the port
number of an I/O device. The 8085 executes the OUT instructions in
the three machine cycles and it taken ten 7T- states to complete the
execution.
This type of interfacing with the peripherals is called
POLLED or PROGRAMMED I/O transfer. In this case executing the IN
instruction the microprocessors waits till the input is given through
it wastes a lot of time in micro seconds , we are using this type of
I/O transfer for our project work.
This program checks for any key closure and executes the
operation each time. After executing the END of election key closure
43
operation the software is written for collecting the number of votes
with the candidates code from particular memory locations.
The candidate codes are verified and the corresponding
memory locations are incremented.
The codes for the control module layout and ballot box layout is
given below:
CONTROL MODULE LED CODE:
LED CODES 8-BIT PATTERN
CLEAR LED (7F)H (0111 1111)H
START LED (BF)H (1011 1111)H
SUSPEND LED (DF)H (1101 1111)H
VALID VOTER LED (EF)H (1110 1111)H
END OF ELECTION LED (F7)H (1111 1011)H
CONTROL MODULE KEY CODE:
KEYS CODE 8-BIT PATTERN
44
CLEAR (01)H (0000 0001)H
START (02)H (0000 0010)H
SUSPEND (03)H (0000 0011)H
VALID VOTER (04)H (0000 0100)H
END (05)H (0000 0101)H
BALLOT BOX LED CODES:
LEDS CODE 8-BIT PATTERN
CANDIDATE 1 (7F)H (0111 1111)H
CANDIDATE 2 (BF)H (1011 1111)H
CANDIDATE 3 (DF)H (1101 1111)H
CANDIDATE 4 (EF)H (1110 1111)H
CANDIDATE 5 (F7)H (1111 0111)H
CANDIDATE 6 (FB)H (1111 1011)H
CANDIDATE 7 (FD)H (1111 1101)H
45
BALLOT BOX KEY CODES:
KEYS CODE 8-BIT PATTERN
CANDIDATE 1 (10)H (0001 0000)H
CANDIDATE 2 (20)H (0010 0000)H
CANDIDATE 3 (30)H (0011 0000)H
CANDIDATE 4 (40)H (0100 0000)H
CANDIDATE 5 (50)H (0101 0000)H
CANDIDATE 6 (60)H (0110 0000)H
CANDIDATE 7 (70)H (0111 0000)H
CONTROL WORD
D0 = 0 = PORT C1 = Output
46
D1 = 0 = PORT B = Output
D2 = 0 = MODE SEL. = Mode 0
D3 = 0 = PORT CU = Output
D4 = 1 = PORT A = Input
D5 = 0 = MODE SEL. = Mode 0
D6 = 0
D7 = 1 = I/O MODE
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 1 0 0 0 0
CONTROL WORD - 90AH
47
48