Professional Documents
Culture Documents
SYNOPSIS
PROJECT REPORT SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE AWARD OF THE DEGREE OF BACHELOR OF ENGINEERING (ELECTRONICS AND COMMUNICATION ENGG) (M.D. University, Rohtak) By 1. 2. 3. 4. 5. Kartik Thakkar Kavita Semwal Kritika Miglani Lokesh Sharma Mani Kaur (10179)VIII ECE IB (10180)VIII ECE IB (10182)VIII ECE IB (10183)VIII ECE IB (10184)VIII ECE IB
This is to certify that we have examined the Project titled 3G BASED ELECTRONIC VOTING MACHINE and its Project report submitted by Kartik Thakkar(10179), Kavita Semwal(10180), Kritika Miglani(10182), Lokesh Sharma(10183), Mani Kaur(10184) students of final year B.tech (Electronics and Communication Engg). We hereby accord our approval of it as a project carried out and presented in a manner required for partial fulfillment for the Bachelor of Technology (Electronics and Communication) degree of Maharishi Dayanand University (Rohtak). This approval does not necessarily endorse or accept every statement made, opinion expressed or conclusion drawn as recorded in the Project Report; it only signifies the acceptance of the Project report for the purpose for which it is submitted.
Date
Date
Date
ACKNOWLEDGEMENT
We are grateful to the authorities of Dronacharya College of Engineering for having permitted us to go ahead with the project on 3G BASED ELECTRONIC VOTING MACHINE in partial fulfillment of Bachelor of Technology (Electronics and Communication Engg.) degree syllabus of Maharishi Dayanand University (Rohtak). We are very thankful to Prof. H.S. Dua, Head of the Department of Electronics and Communication Engineering for approving our project, timely encouragement and supervision. We are thankful & grateful to Mrs Swati Jha, Faculty of Electronics and Communication Engineering Department for her valuable guidance on principles, fundamentals, concepts, and execution regarding the project which has helped us in design , fabrication and completion of project & preparation of the project report. Our sincere thanks and gratitude also to Mr Ajit for his valuable guidance regarding the project. We would like to place our thankfulness to Mr. Mohit Rai on record without whose guidance and timely help the project could not have been completed in time. Last but not the least, we would like to thank our group mates for any other help and cooperation in execution of the project work, typing / editing of the project report.
Kartik Thakkar Kavita Semwal Kritika Miglani Lokesh Sharma Mani Kaur
Date:
CERTIFICATE
This is to certify that the project titled 3G BASED ELECTRONIC VOTING MACHINE has been completed by following final year students of DCE College in partial fulfillment of Bachelor of Technology (Electronics & Communication) degree of Maharishi Dayanand University (Rohtak) during the academic session 2010 2011. 1. Kartik Thakkar (10179) 2. Kavita Semwal (10180) 3. Kritika Miglani (10182) 4. Lokesh Sharma (10183) 5. Mani Kaur (10184)
This project has been completed by the students under the guidance and supervision.
Date
Date
Date
Introduction Theory of Operation Block Diagram & explanation Circuit Diagram & explanation Software Description Components Testing procedure Operating procedure in steps Observations / result analysis Problems faced in the Project Execution Cost Analysis of the Project Conclusion Bibliography Appendix
13 14 17 18 19 25 33 34 35 36 37 38 39 40
SYNOPSIS
Aim of Project: CELL PHONE BASED VOTING SYSTEM Group Members: Kartik Thakkar(10179) Kavita Semwal(10180) Kritika Miglani(10182) Lokesh Sharma(10183) Mani Kaur(10184) VIII ECE 1B VIII ECE 1B VIII ECE 1B VIII ECE 1B VIII ECE 1B
Abstract:
In this project we are basically using a cell phone to cast a vote. This project is basically helpful to the working people because they donot have to go to the both to cast their votes. In this we can use dtmf decoder and rfid. But we are using dtmf decoder because if we use rfid then the range will be limited.. Cell phone based voting machine is capable of saving considerable printing stationery and transport of large volumes of electoral material This project is based on assembly language programming
INTRODUCTION
1. India is worlds largest democracy. Fundamental right to vote or simply voting in elections forms the basis of Indian democracy. 2. Earlier in elections a voter used to cast his vote by using ballot paper. This was a longtime-consuming process as well as very much prone to errors. 3. This situation continued till election scene was completely changed by electronic voting machine. Now no more ballot paper, ballot boxes, stamping,etc.all this condensed into a simple box called ballot unit of the electronic voting machine. 4. Cell phone based voting machine is capable of saving considerable printing stationery and transport of large volumes of electoral material. It is easy to transport, store, and maintain. It completely rules out the chance of invalid votes. 5. It use results reduction of polling time, resulting in fewer problems in electoral preparations, law and order, candidates' expenditure,etc. and easy and accurate counting without any mischief at the counting centre.
Theory of Opertion
Our cell phone based voting machine consists of microcontroller ATMEL AT89S52, a DTMF decoder CM8870C,. DTMF is sent to the microcontroller which is decoded by CM8870C and the password is fed with the candidate number The user can dial the specific number from any land line or mobile phone to cast his vote. Once the user is connected to the voting machine he can enter his password & choice of vote. If he has entered a valid choice & password his vote will be caste with two short duration beeps. For invalid password/choice long beep will be generated. User is allotted 15 seconds to enter his password & choice. A reset button is provided for resetting the system. A total key is provided to display the result. In this project all information is transmitted through DTMF tones.In DTMF decoder circuit we use IC 8870. IC 8870 converts the dual tones to corresponding binary outputs
Fig no1 block diagram The major components of the project are 1. MICRO-CONTROLLER AT89S52 ----- The AT89S52 is a low-power, highperformance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density non-volatile memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed insystem or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. 2. IC CM8870 ---The CAMD CM8870/70C provides full DTMF receiver capability by integrating both the band-split filter and digital decoder functions into a single 18-pin DIP, SOIC, or 20-pin PLCC package. The CM8870/70C is manufactured using state-ofthe-art CMOS process technology for low power consumption (35mW, MAX) and precise data handling. The filter section uses a switched capacitor technique for both high and low group filters and dial tone rejection. The CM8870/70C decoder uses digital counting techniques for the detection and decoding of all 16 DTMF tone pairs into a 4-bit code. This device contains input protection against damage due to high static voltages or electric fields; however, precautions should be taken to avoid application of voltages higher than the maximum rating. 3. LCD DISPLAY ----This is the first interfacing example for the Parallel Port. We will start with something simple. This example doesn't use the Bi-directional feature found on 9
newer ports, thus it should work with most, if not all Parallel Ports. These LCD Modules are very common these days, and are quite simple to work with, as all the logic required to run them is on board.
10
LIST OF FIGURES
Figure no 1 Block Diagram Figure no 2Block Diagram Figure no 3Circuit Diagram Figure no 4Voltage Regulator Figure no 5LCD Figure no 6-- Crystal Figure no 7-- Diode Figure no 8-- Resistor Figure no 9-- Capacitor Figure no 10-- LED Figure no 11 Transformer Figure no 12Pin Diagram Of CM8870 Figure no 13Pin Diagram Of 8952
11
LIST OF TABLES
Table no 1Pin Description Of LCD
12
CHAPTER 1 INTRODUCTION
India is worlds largest democracy. Fundamental right to vote or simply voting in elections forms the basis of Indian democracy. In India all earlier elections a voter used to cast his vote by using ballot paper. This is a longtime-consuming process and very much prone to errors. This situation continued till election scene was completely changed by electronic voting machine. No more ballot paper, ballot boxes, stamping,etc.all this condensed into a simple box called ballot unit of the electronic voting machine. Cell phone based voting machine is capable of saving considerable printing stationery and transport of large volumes of electoral material. It is easy to transport, store, and maintain. It completely rules out the chance of invalid votes. Its use results reduction of polling time, resulting in fewer problems in electoral preparations, law and order, candidates' expenditure,etc. and easy and accurate counting without any mischief at the counting centre. The aim of our project is to design & develop a mobile based voting machine. In this project user can dial the specific number from any land line or mobile phone to cast his vote. Once the user is connected to the voting machine he can enter his choice of vote. User is allotted 15 seconds to enter his choice. Every voter has to enter number 8 pressed before entering the choice. There will be 6 candidates to whom voter can vote. To display a total of each candidate a key will be present. Our cell phone based voting machine consists of microcontroller ATMEL AT89S52, a DTMF decoder CM8870C. DTMF is sent to the microcontroller which is decoded by CM8870C . This project is based on assembly language programming. The software platform used in this project are Keil uVision3 and SPIPGM37.
13
14
A microprocessor, integrated circuit containing the arithmetic, logic, and control circuitry required to interpret and execute instructions from a computer program (computer program, a series of instructions that a computer can interpret and execute; programs are also called software to distinguish them from hardware, the physical equipment used in data processing. These programming instructions cause the computer to perform arithmetic and logical operations or comparisons (and then take some additional action based on the comparison) or to input or output data in a desired sequence). When combined with other integrated circuits that provide storage for data and programs, often on a single semiconductor base to form a chip, the microprocessor becomes the heart of a small computer or microcomputer. Microprocessors are classified by the semiconductor technology of their design (TTL, transistor-transistor logic; CMOS, complementary-metal-oxide semiconductor; or ECL, emitter-coupled logic), by the with of the data format (4 bit, 8 bit, 16 bit,32 bit, or 64 bit) they process; and by their instruction set (CISC, complex instruction set computer, or RISC, reduced instruction set computer; see RISC processor TTL technology is most commonly used, while CMOS is favored for portable computers and other battery powered devices because of its low power consumption. ECL is used where the need for its greater speed offsets the fact that it consumes the most power. Four bit devices, while inexpensive, are good only for simple control applications; in genera, the wider the data format, the faster and more expensive the device. CISC processors, which have 70 to several hundred instructions, are easier to program than RISC processors, but are slower and more expensive. Developed during the 1970s, the microprocessor became most visible as the central processor of the personal computer. Microprocessors also play supporting roles within larger computers as smart controllers for graphics displays, storage devices, and high-speed printers. However, the vast displays, storage devices, and high speed printers. However, the vast majority of microprocessors are used to control everything from consumer appliances to smart weapons. The microprocessor has made possible the inexpensive hand held electronic calculator the digital wristwatch, and the electronic game Microprocessors are used to control consumer electronic devices, such as the programmable microwave oven land videocassette recorder to regulate gasoline consumption and antilock brakes in automobiles; to monitor alarm systems; and to operate automatic tracking and targeting systems in aircraft, tanks and missiles and to control radar arrays that track and identify aircraft, among other defense applications.
2.3 Applications
In addition to the home monitoring system, embedded processors and microcontrollers are frequently found in : appliances (microwave oven, refrigerators, television and VCRs stereos), computers and computer equipment (laser printers, modems, disk drives) , automobiles (engine control, diagnostics, climate control), environmental control (greenhouse, factory, home), 15
Microcontrollers are typically used where processing power isnt so important. Although some of you out there might find a microwave oven controlled by a Unix system an attractive idea, controlling a microwave oven is easily accomplished with the smallest of microcontrollers. On the other hand, if youre putting together a cruise missile to solve the problem of your neighbors dog barking 3 in the morning, you will probably need to use processors with a bit more computing power. Embedded processors and microcontrollers are used extensively in robotics. In this application, many specific tasks might be distributed among a large number of controllers in one system. Communications between each controller and a central, possibly more powerful controller (or micro/mini/mainframe) would enable information to be processed by the central computer, or to be passed around to other controllers in the system. A special application that microcontrollers are well suited for is data logging. Stick one of these chips out in the middle of a corn field or up in a balloon, and monitor and record environmental parameters (temperature, humidity, rain etc). Small size, low power consumption and flexibility make these devices ideal for unattended data monitoring and recording.
16
3.1 Step down transformer is connected to the power supply. It is basically used to step down the incoming voltage to +/- 12v. The voltage regulator is used to further reduce the voltage to a level of 5 V so that correct voltage can be supplied to the various other components.
3.2 DTMF Decoder MM8870 is used. Mobile phone is attached to the DTMF decoder. The signals coming from the mobile phone are feed to the DTMF decoder converts the input signal to a 4 digit binary number. This 4 digit number is feed to the 4:16 demultiplexer where it is converted into a 16 digit binary number. Now this number is feed into the microcontroller. DTMF decoder.
3.3 8952 Microcontroller is used. The 16 digit binary number output from the demultiplexer is
17
feed into the microcontroller. The input is given at the port 1 of the microcontroller. It processes the data and when vote is casted it sends a signal to the LCD to display vote is casted . A 16*2 lcd is used which is connected to the micro controller
18
19
CHAPTER 5 SOFTWARE
#include<at89x52.h> #include<stdio.h> sbit l1=P2^4; sbit p1=P3^4; sbit p2=P3^5; sbit p3=P3^6; sbit p4=P3^7; sbit up=P2^1; sbit down=P2^3; sbit show=P2^0; sbit vid=P2^2; sbit s1=P1^0; sbit s2=P1^1; sbit s3=P1^2; sbit s4=P1^3; sbit rs=P0^1; sbit rdwr=P0^2; sbit lcde=P0^3; sbit d4=P0^4; sbit d5=P0^5; sbit d6=P0^6; sbit d7=P0^7; int i=0; void delay() { unsigned char i,j; for(i=0;i<40;i++) { for(j=0;j<160;j++) {} }} unsigned char xch(unsigned char data1) { unsigned char temp,temp1; temp=data1; data1=data1>>4; temp1=data1; data1=temp; data1=data1<<4; data1=data1|temp1; return(data1); } 20
void datatr(unsigned char data1) { d4=data1&0x01; data1=data1>>1; d5=data1&0x01; data1=data1>>1; d6=data1&0x01; data1=data1>>1; d7=data1&0x01; } void send_command(unsigned char data1) { unsigned char data2; rdwr=0; rs=0; delay(); lcde=1; delay(); data2=xch(data1); datatr(data2); lcde=0; delay(); lcde=1; datatr(data1); delay(); lcde=0; delay(); rs=1; } void senddata(unsigned char data1) { unsigned char data2; rdwr=0; rs=1; delay(); lcde=1; delay(); data2=xch(data1); datatr(data2); lcde=0; delay(); lcde=1; datatr(data1); delay(); lcde=0; delay(); rs=0; } 21
void clr_lcd() { send_command(0x01); delay(); send_command(0x02); delay(); } /********************** INITIALIZATION OF LCD ***********************************/ void lcdinit() { clr_lcd(); /*FUNCTION SET */ send_command(0x28); delay(); send_command(0x28); delay(); send_command(0x28); delay(); send_command(0x06); //ENTRY MODE delay(); send_command(0x0e); //DISPLAY ON/OFF delay(); clr_lcd(); }
/************************** FUNCTION FOR WRITING DATA ON THE LCD******************/ #define lcdport P0 char m[4]; int n; void next_line() { send_command(0xc0); delay(); }
/**************COMMAND FOR CLEARING LCD AND BRINGING LCD CURSOR ON FIRST LINE********/
const unsigned char slogan1[]=" VOTING MACHINE "; const unsigned char slogan2[]=" SYSTEM "; 22
void clr_lcd(); void send_command(unsigned char); void senddata(unsigned char); /************FUNCTION FOR SHORT DELAY**************************************************/ int no=0; void dispslogan(unsigned char *p) { unsigned char data1; while(*p) { data1=*p; senddata(data1); p++; } }
int u1=0,u2=0,u3=0,u4=0; int c1=0,c2=0,c3=0,c4=0; void cllcd() {send_command(0x01); } void disp(int j) {char buf[4]; sprintf(buf, "%d", j); dispslogan(buf); }
void u(int i,int n) {if(i==1){u1=n; c1++;} if(i==2){u2=n;c2++;} if(i==3){u3=n;c3++;} if(i==4){u4=n;c4++;} } int j; void party(int i) { dispslogan(" ENTER PARTY "); while(1) { for(j=0;j<10;j++)delay(); next_line(); if(p1==0){u(i,1);dispslogan("BJP");break;} 23
int j; longdel(){for(j=0;j<10;j++)delay();} void partyshow() { i=0; while(1) {i++; if(i==1){dispslogan(" 1BJP ");} longdel(); if(i==2){dispslogan(" 2CONG ");} longdel(); //for(j=0;j<10;j++)delay(); if(i==3){dispslogan(" 3RJD ");} longdel(); //for(j=0;j<10;j++)delay(); if(i==4){dispslogan(" 4BSP ");} longdel(); cllcd(); if(i==9){dispslogan(" ENTER VOTE ");break;} } } void voteshow() { i=0; while(1) {i++; if(i==1){dispslogan("
BJP ");disp(c1);}
int check() { if(s1==0||s2==0||s3==0||s4==0) while(1) { if(s1==1&&s2==1&&s3==0&&s4==0&&u4==0){no=3;break;} if(s1==0&&s2==1&&s3==0&&s4==0&&u3==0){no=2;break;} if(s1==1&&s2==0&&s3==0&&s4==0&&u2==0){no=1;break;} if(s1==0&&s2==0&&s3==0&&s4==0&&u1==0){no=0;break;} } return no; } void vote() {i=check(); if(i==1){dispslogan("V1");for(j=0;j<50;j++)delay();party(i);} if(i==2){dispslogan("V2");for(j=0;j<50;j++)delay();party(i);} if(i==3){dispslogan("V3");for(j=0;j<50;j++)delay();party(i);} if(i==4){dispslogan("V4");for(j=0;j<50;j++)delay();party(i);} longdel(); } void main() { lcdinit(); clr_lcd();
25
26
27
There is total 8 data line on the lcd for data receiving , but here we use only 4 data lines for data receiving from the microcontroller. Pin no 33,34,35,36 is connected to thepin no 11,12,13,14 of the lcd data lines. Pin no 4,5,6 is the RS/RW/ENABLE pin no of the lcd , These pins are connected to the pin no 39,38,37 of the microcontroller Pin no 40 of controller is connected to the positive supply. On this pin we provide a positive 5 volt and its from 7805 regulator. Ic 7805 is a 5 volt regulator and provide a 5 volt regulated supply. IC 7805 is a three pin regulator . Pin no 1 is input pin , pin no 2 is ground pin and pin no 3 is output pin. Here 78 mean positive voltage and 5 means 5volt. 79 means negative voltage . There are so many regulator available from 7805 to 7818 volt, here 18 means 18 volt. Pin no 20 of the controller is connected to ground pin. Pin no 1 to 8 is for the port 1. Pin no 9 is for the reset pin. On this pin we connect one resistor and one capacitor with positive and resistance is to be ground. With the help of this circuit controller is automatic reset when power is on. Pin no 10 to 17 is for the port p3. Pin no 18, 19 is the pin for crystal pins. On this pin we connect a crystal to provide a proper clock to 28
the controller. In this project we use 12 Mhtz crystal to pin no 18,19. Pin no 20 of the controller is connected to the ground pin. Pin no 21 to 28 is for the port p2 and pin no 39 to 32 is for the port p0. Pin no 30 is ale pin , pin no 29 is Psen and pin no 31 is excess enable. We use these three pin when we require a extra memory for controller. If not required then we connect a pin no 31 to the positive supply. In this project there is no need of extra memory so we connect pin no 31 to the positive supply.
6.4 Crystals
Crystals provide the synchronization of the internal function and to the peripherals. Whenever ever we are using crystals we need to put the capacitor behind it to make it free from noises. It is good to go for a 33pf capacitor.
Fig6 CRYSTAL
We can also resonators instead of costly crystal which are low cost and external capacitor can be avoided. But the frequency of the resonators varies a lot. And it is strictly not advised when used for communications projects.
6.5 DIODE
The diode is a p-n junction device. Diode is the component used to control the flow of the current in any one direction. The diode widely works in forward bias.
29
Fig 7-- DIODE When the current flows from the P to N direction. Then it is in forward bias. The Zener diode is used in reverse bias function i.e. N to P direction. Visually the identification of the diode`s terminal can be done by identifying he silver/black line. The silver/black line is the negative terminal (cathode) and the other terminal is the positive terminal (cathode).
Fig 9 CAPACITOR
30
6.7 LED
LED falls within the family of P-N junction devices. The light emitting diode (LED) is a diode that will give off visible light when it is energized. In any forward biased P-N junction there is, with in the structure and primarily close to the junction, a recombination of hole and electrons. This recombination requires that the energy possessed by the unbound free electron be transferred to another state. The process of giving off light by applying an electrical source is called electroluminescence.
Fig10 LED
6.8 TRANSFORMER
In our project we are using a step down transformer. This is a very useful device, indeed. With it, we can easily multiply or divide voltage and current in AC circuits. This transformer converts high-voltage, low-current power into low-voltage, high-current power. Indeed, the transformer has made long-distance transmission of electric power a practical reality, as AC voltage can be stepped up and current stepped down for reduced wire resistance power losses along power lines connecting generating stations with loads. Voltage levels are reduced transformers for safer operation and less expensive equipment. A transformer that decreases voltage from primary to secondary (more Primary winding turns than secondary winding turns) is called a step-down transformer. Conversely, a transformer designed to do just the opposite is called a step-up transformer. The step down transformer is used here to step down the voltage from 220 volt supply to 12 volt supply.
31
Fig11-- TRANSFORMER
6.9 IC CM8870
FEATURES Full DTMF receiver Less than 35mW power consumption Industrial temperature range Uses quartz crystal or ceramic resonators Adjustable acquisition and release times 18-pin DIP, 18-pin DIP EIAJ, 18-pin SOIC, 20-pin PLCC DESCRIPTION The CAMD CM8870/70C provides full DTMF receiver capability by integrating both the bandsplit filter and digital decoder functions into a single 18-pin DIP, SOIC, or 20-pin PLCC package. The CM8870/70C is manufactured using state-of-the-art CMOS process technology for low power consumption (35mW, MAX) and precise data handling. The filter section uses a switched capacitor technique for both high and low group filters and dial tone rejection. The CM8870/70C decoder uses digital counting techniques for the detection and decoding of all 16 DTMF tone pairs into a 4-bit code. This device contains input protection against damage due to high static voltages or electric fields; however, precautions should be taken to avoid application of voltages higher than the maximum rating.
32
6.10 DEMULTIPLEXER
The 74HC154; 74HCT154 is a high-speed Si-gate CMOS device and is pin compatible with Low-power Schottky TTL (LSTTL). The 74HC154; 74HCT154 decoders accept four active HIGH binary address inputs and provide 16 mutually-exclusive active LOW outputs. The twoinput enable gate can be used to strobe the decoder to eliminate the normal decoding 'glitches' on the outputs, or can be used for the expansion of the decoder. The enable gate has two ANDed inputs which must be LOW to enable the outputs. The 74HC154; 74HCT154 can be used as a 1-to-16 demultiplexer by using one of the enable inputs as the multiplexed data input. When the other enable input is LOW, the addressed output will follow the state of the applied data. Features and benefits
16-line demultiplexing capability Decodes 4 binary-coded inputs into 16 mutually-exclusive outputs Complies with JEDEC standard no. 7A Specified from -40 Cel to +85 Cel and -40 Cel to +125 Cel ESD protection: o HBM EIA/JESD22-A114D exceeds 2000 V o MM EIA/JESD22-A115-A exceeds 200 V
33
34
35
36
37
38
CHAPTER 12 CONCLUSION
The EVM consists of a control unit (CU) and ballot unit (BU), both the units are working independently and in collaboration with each other as well. The CU is accepting password in voting mode and is responding accordingly. In voting mode, CU communicates with BU in order to exchange various signals. CU is counting the votes for individual candidate (6 in number) and total number of votes cast can be checked at anytime. In casting mode, the voter information is verified and voter will cast the vote. In result mode, the CU displays the votes of individual candidate, in consecutive order, whenever the Result Button is pressed. The total number of votes can be checked in result mode in the same way as in voting mode.
In total, the complete system (including all the hardware components and software routines) is working as per the initial specifications and requirements of our project. Because of the creative nature of the design, and due to lack of time, some features could not be fine-tuned and are not working properly. So certain aspects of the system can be modified as operational experience is gained with it. As the users work with the system, they develop various new ideas for the development and enhancement of the project.
39
REFRENCES
Muhammad Ali Mazidi , Janice Gillispie Mazidi, Rolin D. Mckinlay. Second edition, THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEM
-interfacing/ WEBSITES
-elections.com/electoralsystem/electricvotingmachine.html
40
APPENDIX:
DESCRIPTION
The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density non-volatile memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five vector twolevel interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset.
PIN DIAGRAM
PIN CONFIGURATION
IN+: Non-inverting IN: Inverting GS: Gain select VREF: Reference Output Voltage (nominally VDD/2) 41
INH: Inhibits OSC3: Digital buffered oscillator output PD: Power down OSC1: Clock input OSC2: Clock output VSS: Negative power supply TOE: Three-state output enable (Input) Q1: Three-state outputs Q2, Q3, Q4: Tone pair received StD: Delayed Steering output ESt: Early steering output St/Gt: Steering input/guard VDD: Positive power supply IC: Internal connection
Pin no. 10 R/W Pin no. 11 RS Pin no. 12 VEE Pin no. 13 VSS Pin no. 14 VCC
Enable signal for row 2 and 3 (2ndcontroller) Not Connected Table No.1--Pin description of the LCD
DDRAM - Display Data RAM Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for display can be used as general data RAM. So whatever you send on the DDRAM is actually displayed on the LCD. BF - Busy Flag Busy Flag is a status indicator flag for LCD. When we send a command or data to the LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed successfully this flag is cleared (BF = 0). This is helpful in producing and exact amount of delay. For the LCD processing. To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept next command or data and BF = 0 means LCD is ready for the next command or data to process. Instruction Register (IR) and Data Register (DR) There are two 8-bit registers controller Instruction and Data register. Instruction register corresponds to the register where you send commands to LCD e.g. LCD shift command, LCD clear, LCD address etc. and Data register is used for storing data which is to be displayed on LCD. When send the enable signal of the LCD is asserted, the data on the pins is latched in to the data register and data is then moved automatically to the DDRAM and hence is displayed on the LCD. Commands and Instruction set Only the instruction register (IR) and the data register (DR) of the LCD can be controlled by the MCU. Before starting the internal operation of the LCD, control information is temporarily stored into these registers to allow interfacing with various MCUs, which operate at different speeds, or various peripheral control devices. The internal operation of the LCD is determined by signals sent from the MCU. Sending Commands to LCD To send commands we simply need to select the command register. Everything is same as we have done in the initialization routine. But we will summarize the common steps and put them in a single subroutine. Following are the steps: Move data to LCD port Select command register Select write operation 43
AT89C2051 Features
Fig13 Pin diagram of 8952 Compatible with MCS-51 Products 2K Bytes of Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles 2.7V to 6V Operating Range Fully Static Operation: 0 Hz to 24 MHz Two-level Program Memory Lock 128 x 8-bit Internal RAM 15 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial UART Channel Direct LED Drive Outputs On-chip Analog Comparator Low-power Idle and Power-down Modes Description The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt 44
architecture, a full duplex serial port, a precision analog comparator, on-chip oscillator and clock circuitry. In addition, the AT89C2051 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The power-down mode saves the RAM contents but free. Pin Description VCC Supply voltage. GND Ground. Port 1 Port 1 is an 8-bit bi-irectional I/O port. Port pins P1.2 to P1.7 provide internal pullups. P1.0 and P1.1 require external pullups. P1.0 and P1.1 also serve as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port 1 output buffers can sink 20 mA and can drive LED displays directly.When 1s are written to Port 1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled low, they will source current (IIL) because of the internal pullups.Port 1 also receives code data during Flash programming and verification. Port 3 Port 3 pins P3.0 to P3.5, P3.7 are seven bi-irectional I/O pins with internal pullups. P3.6 is hardwired as an input to the output of the on-chip comparator and is not accessible as a general purpose I/O pin. The Port 3 output buffers can sink 20 mA. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of various special features of the AT89C2051 as listed below: Port 3 also receives some control signals for Flash programming and verification. RST Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for two machine cycles while the oscillator is running resets the device.Each machine cycle takes 12 oscillator or clock cycles. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 45
Output from the inverting oscillator amplifier. Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively,of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.
46