project report 8051,eembedded system,pcb designing,electronic voting machine
Upcoming SlideShare
Loading in...5
×
 

project report 8051,eembedded system,pcb designing,electronic voting machine

on

  • 2,187 views

 

Statistics

Views

Total Views
2,187
Views on SlideShare
2,187
Embed Views
0

Actions

Likes
0
Downloads
138
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

project report 8051,eembedded system,pcb designing,electronic voting machine project report 8051,eembedded system,pcb designing,electronic voting machine Document Transcript

  • 1. INTRODUCTION TO EMBEDDED SYSTEMS An embedded system is a special-purpose system in which the computer is completely encapsulated by the device it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs pre-defined tasks, usually with very specific requirements. Since the system is dedicated to a specific task, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, so the cost savings may be multiplied by millions of items. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. Embedded systems contain processing cores that are either microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Robotics and automation are a part of embedded systems itself. Robot development and automation needs study of embedded systems. Examples of Embedded System:I. II. automatic teller machines (ATMs) avionics, such as inertial guidance systems, flight control hardware/software and other integrated systems in aircraft and missiles III. cellular telephones and telephone switches IV. computer equipment such as routers and printers V. VI. engine controllers and antilock brake controllers for automobiles home automation products, like thermostats, air conditioners, sprinklers, and security monitoring systems VII. VIII. handheld calculators household appliances, including microwave ovens, washing machines, television sets IX. medical equipment X. handheld computers XI. videogame consoles [1]
  • 2.SOFTWARE DEVELOPEMENT 2.1 ECLIPSE 2.1.1 INTRODUCTION Developing programs using a text editor such as TextPad is simple and straightforward.While such editors allow students to begin programming with a minimum of distractions, asprograms become larger and more complicated, a more sophisticated tool for developingprograms is quite valuable. In this chapter, we examine one particular tool for developinglarge programs, the Eclipse system. Eclipse can be used to develop programs in Java and inC/C++ (plus various other languages as well). In this chapter, we examine how to install Eclipse. 2.2 INTERACTIVE DEVELOPMENT ENVIRONMENTS Interactive development environments (IDE) provide a wealth of features to support the programmer that are not available in a simple editor. There are many IDE’s currently available, some are shareware and some must be purchased and are often expensive. Most IDE’s provide similar facilities, such as the ability to view different classes at the same time, debuggers that step through a program line-byline in order to assist in locating errors, etc. One of the newest and most popular IDE’s is the Eclipse IDE which is available at no cost from the Eclipse website (http://www.eclipse.org/). 2.3 THE ECLIPSE IDE Eclipse is an IDE (actually it is more than an IDE but we will concentrate on Eclipse as an IDE) that was initially controlled by IBM but then IBM released the source code for Eclipse, making the project open source. Eclipse development is taking place in several cities, including Winnipeg, Ottawa, and Zurich, although there is also a large community of programmers who provide extensions to Eclipse in order to improve the Eclipse environment. The facilities in Eclipse can be extended by defining “plugins” which provide additional features or support additional languages.. Eclipse runs on most operating systems, including Unix, Linux, Windows, and Mac OS X. [2]
  • 2. 4 TINA PRO :THE COMPLETE ELECTRONICS LAB FOR WINDOWS INTRODUCTION:-TINA is a powerful yet affordable software package for designing, simulating and analyzing electronic circuits. It works equally well with linear and nonlinear analog circuits, digital and mixed circuits. Analysis results can be displayed as sophisticated diagrams or on a range of virtual instruments. Comprehensive DTP tools and powerful text and equation editors can be used to produce professional reports and presentations. The standard library contains over 20000 components and can be extended by the user. Electronics engineers will find TINA an invaluable, easy to use and high performance tool. TINA can also be used in the training environment. It includes unique tools for testing students’ knowledge, monitoring progress and introducing troubleshooting techniques. With optional hardware it can be used to test real circuits for comparison with the results obtained from simulation. Of great importance to educators, the package includes all the tools needed to prepare educational materials. The circuit diagrams and the calculated or measured results can be printed or saved to files in standard Windows WMF format. These output files can be processed by a number of well known software packages (Microsoft Word, Corel Draw etc.). Net lists can be exported and imported in Pspice format and also to drive popular PCB packages such as ORCAD, TANGO, PCAD, PROTEL, REDAC and EDS. TINA has special operating modes for training and for examination. In these modes, under TINA’S control, the students solve problems assigned by the teacher. The solution format depends on the types of problems: they can be selected from a list, calculated numerically, or given in symbolic form. The interpreter - providing a number of solution tools - can also be used for problem solving. If the student cannot solve the problem, he/she can turn to the multi-level Advisor. The package includes all the tools needed to produce educational materials. A collection of examples and problems worked out by teachers is also part of the package. Another special educational function of TINA is the software or hardware simulation of circuit faults to practice troubleshooting. Using TINA, you can transform existing PC classrooms into contemporary electronics training labs at low cost. [3]
  • THE BASIC SCREEN FORMAT:- 1. The menu bar 2. The cursor or pointer 3. The Schematic window 4. The Tool bar 5. 6. 7. 8. 9. The Component bar Find component tool Open files tab The TINA Task bar The Help line 3.PCB DESIGNING 3.1 INTRODUCTION:- [4]
  • PCB Stands for "Printed Circuit Board." A PCB is a thin board made of fiberglass, composite epoxy, or other laminate material. Conductive pathways are etched or "printed" onto board, connecting different components on the PCB, such as transistors, resistors, and integrated circuits. PCBs are used in both desktop and laptop computers. They serve as the foundation for many internal computer components, such as video cards, controller cards, network interface cards, and expansion cards. These components all connect to the motherboard, which is also a printed circuit board. While PCBs are often associated with computers, they are used in many other electronic devices besides PCs. Most TVs, radios, digital cameras, cell phones, and tablets include one or more printed circuit boards. While the PCBs found in mobile devices look similar to those found in desktop computers and large electronics, they are typically thinner and contain finer circuitry. HISTORY : The inventor of the printed circuit was the Austrian engineer Paul Eisler (1907–1995) who, while working in England, made one circa 1936 as part of a radio set. MATERIAL: Conducting layers are typically made of thin copper foil. Insulating layers dielectric are typically laminated together with epoxy resin prepreg. The board is typically coated with a solder mask that is green in color. Other colors that are normally available are blue and red. There are quite a few different dielectrics that can be chosen to provide different insulating values depending on the requirements of the circuit. Some of these dielectrics are polytetrafluoroethylene (Teflon), FR-4, FR-1, CEM-1 or CEM-3. Well known prepreg materials used in the PCB industry are FR-2 (Phenolic cotton paper), FR-3 (Cotton paper and epoxy), FR-4 (Woven glass and epoxy), FR-5 (Woven glass and epoxy), FR-6(Matte glass and polyester), G-10(Woven glass and epoxy), CEM1 (Cotton paper and epoxy), CEM-2 (Cotton paper and epoxy), CEM-3 (Woven glass and epoxy),CEM-4 (Woven glass and epoxy), CEM-5 (Woven glass and polyester). Thermal expansion is an important consideration especially with BGA and naked die technologies, and glass fiber offers the best dimensional stability. 3.2 TYPES OF PRINTED CIRCUIT BOARDS Single Sided Board:-This is the least complex of the Printed Circuit Boards, since there is only a single layer of substrate. All electrical parts and components are fixed on one side and copper traces are on the other side. Double Sided Board:-This is the most common type of board, where parts and components are attached to both sides of the substrate. In such cases, double-sided PCBs that have connecting traces on both the sides are used. Double-sided Printed Circuit Boards usually use through-hole construction for assembly of components. [5]
  • Multi Layered Board:-Multi layered PCB consists of several layers of substrate separated by insulation. Most common multilayer boards are: 4 layers, 6 layers, 8 layers, and 10 layers. However, the total number of layers that can be manufactured can exceed over 42 layers. These types of boards are used in extremely complex electronic circuits. 3.3 PCB DESIGN STEPS IN OrCad 10.5 3.3.1 ENTRY OF SCHEMATIC DIAGRAM Schematic diagram provides the functional flow and the graphical representation of an electronic circuit. The entry of schematic diagram is the first step in PCB design using OrCad. A schematic diagram consists of:Electrical connections(nets) Junctions Integrated circuits symbols Discrete components symbols like resistors, capacitors etc. Input / output connectors Power and ground symbols Buses No connection symbols Components reference names Text 3.3.2 THE SCHEMATIC PAGE EDITOR: The schematic page editor is used to display and edit schematic pages. So that one can parts; wires; buses and draw graphics. The schematic page editor has a tool palette that you can use to draw and place everything you need to create a schematic page. One can print from within the schematic page editor, or from the project window. [6]
  • Fig 7.1 Schematic Page Editor 3.3.3 THE PART EDITOR: The part editor is used to create and edit parts. From the view menu of the part editor you can choose either part or package. In part view one can:Create and edit parts and symbols, then store in new or existing libraries. Create and edit power and ground symbols, off-page connector symbols, and title block Use the tool palette’s electrical tools to place pins on parts, and its drawing tools to draw parts and symbols. 3.3.4 THE SESSION LOG: The session log lists the events that have occurred during the current Capture session, includes message resulting from using capture’s tools. To display context-sensitive help for an error message, put the cursor in the error message line in the session log press F1.The ruler along the top appears in either inches or mill meters, depending on which measurement system is selected in the window panel. Your tab setting are saved and used each time you start capture. [7]
  • Fig 7.2 Session Log window One can search for information in the session log using the find command on the Edit menu. You can also save the contents of the of the session log to a file, which is useful when working with Orcad’s technical support to solve technical problems. The default filename is SESSION.TXT. 3.3.5 THE TOOLBAR:Capture’s toolbar is dock able (that means you can select and drag the toolbar to new location) as well as resizable, and displays tool tips for each tool; by choosing a tool button you can quickly perform a task. If tool button is dimmed, you can’t perform that task in the current situation. Fig 7.3 Toolbar Some of the tools operate only on what you have selected, while others give you a choice of either operating on what is selected or expanding the scope to entire project. You can hide the toolbar, then display it again when u need it. For hiding select from the schematic page editor’s view menu, choose TOOLBAR. 3.3.6 THE TOOL PALETTE:Capture has two tool palettes: one for the schematic page editor and one for the part editor. Both tool palettes are dock able and resizable. They can also display tool tips that identify each tool. The drawing tools on the two tool palettes are identical, however, each tool palette has different electrical tools after you choose a tool, and you press the right mouse button to display a context- sensitive pop-up menu. [8]
  • 3.3.7 THE SCHEMATIC PAGE EDITOR TOOL PALETTE: The first group of tools on the tool palette is electrical tools, used to place electrical connectivity objects. The second group of tools is Drawing tools, used to create graphical objects without electrical connectivity. Fig7.4 schematic page editor tool palette 3.3.8 THE PART EDITOR TOOL PALETTE: The first group of tools on the part palette is electrical tools, used to place pins and symbols. They have been already explained above within the schematic page editor tools. The second group of tools is drawing tools, used to create graphical objects without objects any electrical connectivity and is described: Pin Tools: Place pins on part Pin Array: Place multiple pins on part 3.4 CREATING NET LIST FILE Net-list file is a document file which contains information about the logical interconnections between signals and pins. Before one create a net list file, be sure one’s project is completed, annotated and it is free from electrical rule violations. A net list file consists of nets, components, connectors, junctions, no connection symbol, power and ground symbols. 3.4.1 CREATION OF NET LIST IN CAPTURE: Select your design in the project manager. From the tools, choose create net list. The net list dialog box displays. Choose a net list format tab. If necessary, set the part value and PCB foot print combined property strings to reflect the information you want in the net list. Click ok to create the net list. In the net list file text box, enter a name for the output file. If the selected format creates an additional file, enter its file name in the second text box. [9]
  • 3.5 LAYOUT PLUS Layout plus is one part for the PCB design in which we place as well as route the components an set unit of measurement, grids, and spacing in OrCad. Within other soft wares you also have to place and route the components in similar way. For the placement and routing of the components we normally use auto-placement and auto-routing. Unfortunately, in a lot of soft wares some critical signals have to be routed manually before auto-routing. In layout plus we also define the layer stacks, pad stacks and via's. 3.5.1 STEPS FOR BOARD DESIGN: At first, we have created a net list from our schematic diagram by using capture. Layout plus includes design rules in order to guide logical placement and routing. That means, load the net list into layout to create the board. At the same time you have to specify the board parameters. Specify board parameters: Specifying global setting for the board, including nits of measurements, grid, and spacing Place components: Use the components tool in order to place manually the components which are fixed by the system designer on the board or otherwise use auto-placement. Route the board: Use different routing technologies to route the board and take advantage of push and shove (a routing technology), which moves track you are currently routing as well as you can also auto route the board. Provide finishing of the board: Layout supplies an ordered progression of commands on the auto menu for finishing your design. These commands include design rule check, cleanup design, rename components, back annotate, run post processor, and create reports. 3.5.2 THE DESIGN WINDOW: The design window provides a graphical display of printed circuit board, it is primary window you use when designing your board. It also provides tools to facilitate the design process such as to update components and design rule violation. [10]
  • Fig 7.5 design window 3.5.3 MAIN WINDOW: Method to create a board with Layout Plus: Ensure that net list with all footprints and necessary information has been created. Create a directory in which the schematic design, net list, and boar will co-exit and put the schematic design and net list. OrCad provides a directory for this purpose. From the layout session frame’s file menu, choose New. The load template file in the dialog box displayed. Fig 7.6 main window [11]
  • 3.5.4 DESIGN STEPS: Select the technology template (.TCH), then choose the open button and load the net list in other box. Then apply the auto ECO. If necessary, respond to link footprints to component dialog. Draw the board outline by using the obstacle tool in the tool bar. 3.5.5 SETTING BOARD PARAMETERS: There is some parameter which should be set before placing the components on board. They are as follows:Set Datum Create a board outline Set units of measurements Set system grid Add mount holes 3.5.6 CREATING OF BOARD OUTLINE: Board outline is the graphical representation of the size of the actual PCB board. So it is the main step in layout, to draw the board outline of the actual size of PCB board. 3.5.7 PLACEMENT OF COMPONENTS: Placement of components means that to place the components in designed box. A designer should follow the following steps before going for it:Optimize the board for component placement. Load the placement strategy file. Place components on the board. Optimize placement using various placements Components can be placed by using two techniques:1) Manual placement of components 2) Auto placement of components Choose the components tool bar button. From the pop up men, choose the queue for placement. The components selection criteria dialog box appears. Enter the reference designator of the components that you want to place in the appropriate text box, and click ok. Drag the components to desired location, place it there. [12]
  • 3.5.8 CONDUCTOR ROUTING IN LAYOUT:After placing all the components the other main step is to route the board from the electrical connections between the components. One may route board manually or automatically by auto router. 100% auto routing can be achieved only when components are placed in the order of functional flow of electronic circuit. The main routing tool available in OrCad is as flow:Add/edit route mode Edit segment mode Shove track mode Auto path route mode 3.5.9 DESIGN RULE CHECK:In manual designs every thing was checked as a possible source of error. Components sizes, hole sizes, conductor widths and clearance, land-to-hole-ratio, board areas to be free of components, clearance to the edges, positional accuracy and of course electrical interconnections had tad to be personally reviewed with a great deal of care. After completing the design of printed circuit board with the help of an EDA-Tool, a designer has again to verify the PCB in order to find out errors. [13]
  • 4.THE 8051 MICROCONTROLLER 4.1 INTRODUCTION The microcontroller incorporates all the features that are found in microprocessor. The microcontroller has built in ROM, RAM, Input Output ports, Serial Port, timers, interrupts and clock circuit. A microcontroller is an entire computer manufactured on a single chip. Microcontrollers are usually dedicated devices embedded within an application. For example, microcontrollers are used as engine controllers in automobiles and as exposure and focus controllers in cameras. In order to serve these applications, they have a high concentration of on-chip facilities such as serial ports, parallel input output ports, timers, counters, interrupt control, analog-to-digital converters, random access memory, read only memory, etc. The I/O, memory, and on-chip peripherals of a microcontroller are selected depending on the specifics of the target application. Since microcontrollers are powerful digital processors, the degree of control and programmability they provide significantly enhances the effectiveness of the application. The 8051 is the first microcontroller of the MCS-51 family introduced by Intel Corporation at the end of the 1970s. The 8051 family with its many enhanced members enjoys the largest market share, estimated to be about 40%, among the various microcontroller architectures. The microcontroller has on chip peripheral devices. In this unit firstly we differentiate microcontroller from microprocessor then we will discuss about Hardware details of 8051 and then introduce the Assembly level language in brief. MICROCONTROLLERS Microcontroller (MC) may be called computer on chip since it has basic features of microprocessor with internal ROM, RAM, Parallel and serial ports within single chip. Or we can say microprocessor with memory and ports is called as microcontroller. This is widely used in washing machines, vcd player, microwave oven, robotics or in industries. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC. 8 bit microcontroller, means it can read, write and process 8 bit data. Ex. 8051 microcontroller. Basically 8 bit specifies the size of data bus. 8 bit microcontroller means 8 bit data can travel on the data bus or we can read, write process 8 bit data. [14]
  • 4.2 MICROCONTROLLER FAMILIES 8051- These microcontrollers are old but still trendy and most of the companies fabricate these microcontrollers. The older types of 8051 have 12 clocks per instruction that make it sluggish whereas the recent 8051 have 6 clocks per instruction. The 8051 microcontroller does not have an in built memory bus and A/D converters. In 1980, Intel fabricated the single chip microcontroller 8051 with Harvard architecture. PIC- Programmable Interface Controller is usually referred as PIC. They are slightly older than 8051 microcontrollers but excel cause of their small low pin count devices. They perform well and are affordable. The Microchip technology fabricated the single chip microcontroller PIC with Harvard architecture. The programming part is very tedious and hence it is not recommended for beginners. AVR(Advanced Version RISC) - In 1996, Atmel fabricated this single chip microcontroller with a modified Harvard Architecture. This chip is loaded with C- compiler, Free IDE and many more features. This microcontroller is a bit difficult for the starters to handle. 4.3 DIFFERENCE BETWEEN MICROCONTROLLER AND MICROPROCESSOR:- It is very clear from figure that in microprocessor we have to interface additional circuitry for providing the function of memory and ports, for example we have to interface external RAM for data storage, ROM for program storage, programmable peripheral interface (PPI) 8255 for the Input Output ports, 8253 for timers, Sartor serial port. While in the microcontroller RAM, ROM, I/O ports, timers and serial communication ports are in built. Because of this it is called as “system on chip”. So in micro-controller there is no necessity of additional circuitry which is interfaced in the microprocessor because memory and input output ports are inbuilt in the microcontroller. Microcontroller gives the satisfactory performance for small applications. But for large applications the memory requirement is limited because only 64 KB memory is available for program storage. So for large applications we prefer microprocessor than microcontroller due to its high processing speed. [15]
  • 4.4 PIN DIAGRAM OF 8051:- Pins 1-8 (Port 1) - Each of these pins can be configured as an input or an output. Pin 9 (Reset) - A logic one on this pin disables the microcontroller and clears the contents of most registers. In other words, the positive voltage on this pin resets the microcontroller. By applying logic zero to this pin, the program starts execution from the beginning. Pins 10- 17 (Port 3) -Similar to port 1, each of these pins can serve as general input or output. Besides, all of them have alternative functions: Pin 10 (RXD) - Serial asynchronous communication input or Serial synchronous communication output. Pin 11(TXD) - Serial asynchronous communication output or Serial synchronous communication clock output. Pin 12 (INT 0) - Interrupt 0 input. [16]
  • Pin 13(INT 1) - Interrupt 1 input. Pin 14(T0) - Counter 0 clock input. Pin 15(T1) - Counter 1 clock input. Pin 16(WR) -Write to external (additional) RAM. Pin 17 (RD) -Read from external RAM. Pin 18 and 19(X1, X2) - Internal oscillator input and output. A quartz crystal which specifies operating frequency is usually connected to these pins. Instead of it, miniature ceramics resonators can also be used for frequency stability. Later versions of microcontrollers operate at a frequency of 0 Hz up to over 50 Hz. Pin 20 (GND) - Ground. Pin 21-28 (Port 2) - If there is no intention to use external memory then these port pins are configured as general inputs/outputs. In case external memory is used, the higher address byte, i.e. addresses A8A15 will appear on this port. Even though memory with capacity of 64Kb is not used, which means that not all eight port bits are used for its addressing, the rest of them are not available as inputs/outputs. Pin 29 (PSEN) - If external ROM is used for storing program then a logic zero (0) appears on it every time the microcontroller reads a byte from memory. Pin 30 (ALE) - Prior to reading from external memory, the microcontroller puts the lower address byte (A0-A7) on P0 and activates the ALE output. After receiving signal from the ALE pin, the external register memorizes the state of P0 and uses it as a memory chip address. Immediately after that, the ALU pin is returned its previous logic state and P0 is now used as a Data Bus. As seen, port data multiplexing is performed by means of only one additional (and cheap) integrated circuit. In other words, this port is used for both data and address transmission. Pin 31 (EA) - By applying logic zero to this pin, P2 and P3 are used for data and address transmission with no regard to whether there is internal memory or not. It means that even there is a program written to the microcontroller, it will not be executed. Instead, the program written to external ROM will be executed. By applying logic one to the EA pin, the microcontroller will use both memories, first internal then external (if exists). Pin 32-39 (Port 0) - Similar to P2, if external memory is not used, these pins can be used as general inputs/outputs. Otherwise, P0 is configured as address output (A0-A7) when the ALE pin is driven high (1) or as data output (Data Bus) when the ALE pin is driven low (0). Pin 40 (Vcc) - +5V power supply. [17]
  • 4.5 MICROCONTROLLER 8051 ARCHITECTURE It is 8-bit microcontroller, means MC 8051 can Read, Write and Process 8 bit data. This is mostly used microcontroller in the robotics, home appliances likemp3 player, washing machines, electronic iron and industries. Mostly used blocks in the architecture of 8051 are as follows: Address bus-For a device (memory or I/O) to be recognized by the CPU, it must be assigned an address. The address assigned to a given device must be unique. The CPU puts the address on the address bus, and the decoding circuitry finds the device. Data bus-The CPU either gets data from the device or sends data to it. Control bus-Provides read or write signals to the device to indicate if the CPU is asking for information or sending it information . [18]
  • 4.6 Memory and Registers The 8051 microcontroller has a total of 256 bytes of RAM in which 128 is visible or useraccessible and extra 128 is for special function registers. The user accessible RAM is used for temporary data storage. The user accessible RAM is from the address range 00 to 7Fh.From the user accessible RAM, 32 bytes of RAM is used for registers and rest for Stack operations. The 32 Bytes of RAM is divided into four register Banks i.e. Bank0, Bank 1, Bank 2, Bank3. Each of these banks have 8 Registers i.e. R0 to R7 each. RAM locations from 0 to 7 are set aside for bank 0 of R0 – R7 where R0 is RAM location 0, Rl is RAM location 1, and R2 is location 2, and so on, until memory location 7, which belongs to R7 of bank 0. The second bank of registers R0 – R7 starts at RAM location 08 and goes to location 0FH. The third bank of R0 – R7 starts at memory location 10H and goes to location 17H. Finally, RAM locations 18H to 1FH are set aside for the fourth bank of R0 – R7. Generally for normal operations, Register bank Bank0 is set by default. But we can switch to other banks by using PSW Commands. [19]
  • SFRs (Special Function Register) - These Registers are in extra 128 bytes of the memory. This part of memory is not user accessible and these registers are used for special purposes. These registers range from 80h to FFh. There are a total of only 21 SFRs in this range and all other addresses from 80h to FFh are invalid and there use can cause errors and not valuable results. Some of the SFRs are TCON, SBUF, ACC, B, SCON, TMOD SP, P0, PSW, TL0, and TL1. These all the registers have some specific function that has to be performed after they are programmed. Byte Addressable SFR with byte address SP – Stack printer – 81H DPTR – Data pointer 2 bytes DPL – Low byte – 82H DPH – High byte – 83H TMOD – Timer mode control – 89H TH0 – Timer 0 Higher order bytes – 8CH TL0 – Timer 0 Low order bytes – 8AH TH1 – Timer 1 High bytes = 80H TL1 – Timer 1 Low order byte = 86H SBUF – Serial data buffer = 99H PCON – Power control – 87H. DPTR - Data Pointer in 8051 16 bit register; it is divided into two parts DPH and DPL. DPH for Higher order 8 bits, DPL for lower order 8 bits. DPTR, DPH, DPL these all are SFRs in 8051. [20]
  • 4.7 Timers and Counters: The 8051 has two timers T0 and T1, which may be configured and used individually. The 8052 has an additional Timer T2.All these counters count up on negative going edges at their inputs. These can be used as event counters (where they count the number of negative transitions on a pin connected to some external source), or as Timers, where they count up once every twelfth clock cycle. A special use of timers is for generating baud rates for the serial port. The usage of these timers is somewhat different from common general purpose timer/counters such as the 8253 and 8254. This difference stems partly from the fact that we cannot afford to have a large numbers of pins dedicated to the functioning of these timer counters. Thus, just two multifunction pins are used as external inputs in 8051. Gating is accomplished by control bits in the special function registers, and using the external interrupt pins as gate inputs. There are no output pins associated with the timers. The processor can be interrupted by the timers and as a part of the interrupt service routine, the processor can performing IO function through its ports. When used as baud rate generators, the output goes directly to the serial port hardware within the microcomputer. 8051 timers always count up. Each counter has a 16 bit count register in the SFR area. The low and high count bytes rolls can over from be the accessed maximum as count separate to 0000, bytes. they set When the their corresponding timer flag (TF1 or TF0) in TCON. The 8051 can be set up so that an interrupt occurs whenever TF1 or TF0 is set. when 8051 branches to the interrupt vector, it automatically clears the TF flag. Timer means which can give the delay of particular time between some events. For example on or off the lights after every 2 sec. This delay can be provided through some assembly program but in microcontroller two hardware pins are available for delay generation. These hardware pins can be also used for counting some external events. How much times a number is repeated in the given table is calculated by the counter. • In MC8051, two timer pins are available T0 and T1, by these timers we can give the delay of particular time if we use these in timer mode. • We can count external pulses at these pins if we use these pins in counter mode. • 16 bits timers are available. Means we can generate delay between 0000H [21]
  • to FFFFH. • Two special function registers are available. • In the same way for T1. • TMOD, TCON registers are used for controlling timer operation. Basic registers of the timer Timer 0 and Timer 1 are 16 bits wide each 16-bit timer is accessed as two separate registers of low byte and high byte. Timer 0 registers low byte register is called TL0 (Timer 0 low byte) and the high byte register is referred to as TH0 (Timer 0 high byte) can be accessed like any other register, such as A, B, R0, R1, R2, etc. "MOV TL0, #4 FH" moves the value 4FH into TL0 "MOV R5, TH0" saves TH0 (high byte of Timer 0) in R5 Timer 1 registers also 16 bits split into two bytes TL1 (Timer 1 low byte) and TH1 (Timer 1 high byte) accessible in the same way as the registers of Timer 0. TMOD (timer mode) register timers 0 and 1 use TMOD register to set operation modes (only learn Mode 1 and 2) 8-bit register lower 4 bits are for Timer 0 [22]
  • upper 4 bits are for Timer 1 lower 2 bits are used to set the timer mode (only learn Mode 1 and 2) upper 2 bits to specify the operation (only learn timer operation) Clock source for timer timer needs a clock pulse to tick if C/T = 0, the crystal frequency attached to the 8051 is the source of the clock for the timer frequency for the timer is always 1/12th the frequency of the crystal attached to the 8051 XTAL = 11.0592 MHz allows the 8051 system to communicate with the PC with no errors In our case, the timer frequency is 1MHz since our crystal frequency is 12MHz Using Windows calculator to find TH, TL Windows scientific calculator can be use to find the TH, TL values Lets say we would like to find the TH, TL values for a time delay that uses 35,000 clocks of 1.085ms open scientific calculator and select decimal [23]
  • enter 35,000 select hex - converts 35,000 to hex 88B8H select +/- to give -35000 decimal (7748H) the lowest two digits (48) of this hex value are for TL and the next two (77) are for TH C/T bit in TMOD register used as a timer, the 8051's crystal is used as the source of the frequency used as a counter, pulse outside the 8051 increments the TH, TL registers counter mode, TMOD and TH, TL registers are the same as for the timer timer modes are the same as well C/T bit in TMOD register C/T bit in the TMOD register decides the source of the clock for the timer C/T = 0, timer gets pulses from crystal C/T = 1, the timer used as counter and gets pulses from outside the 8051 C/T = 1, the counter counts up as pulses are fed from pins 14 and 15 pins are called T0 (Timer 0 input) and T1 (Timer 1 input) these two pins belong to port 3 Timer 0, when C/T = 1, pin P3.4 provides the clock pulse and the counter counts up for each clock pulse coming from that pin Timer 1, when C/T = 1 each clock pulse coming in from pin P3.5 makes the counter count up [24]
  • TCON register TR0 and TR1 flags turn on or off the timers bits are part of a register called TCON (timer control) upper four bits are used to store the TF and TR bits of both Timer 0 and Timer 1 lower four bits are set aside for controlling the interrupt bits "SETB TRl" and "CLR TRl“ "SETB TCON. 6" and "CLR TCON. 6“ Timer Functions When used as timers, the 8051 timers count up every 12th clock cycle. This is selected by clearing the corresponding C/T flags in the TMOD special function register, placed at the address 89H. [25]
  • Timer modes The timers may operate in one of four modes: Mode 0 In this mode, the timers act as 13 bit counters. This mode is largely meant for providing compatibility with an older microcontroller from Intel(8048). This mode is practically never used in fresh designs. Except for the counter size, this mode is identical to mode 1. Mode 1 In this mode, the timers are 16 bits in size. This is a commonly used mode. It is common to configured the timer to cause an interrupt when it overflows. The interrupt routine then reloads the timer. Mode 2 This mode provides an 8 bit counter with auto-reload. It uses the high byte of the count register to store the count value and the low byte as the actual counter. The counter is automatically re-loaded from TH when it overflows. Thus, there is no software overhead for re-loading the registers. This is convenient for generating baud rates etc. The timing resolution is much lower in this mode (only 8 bits). Therefore crystal frequencies have to be carefully chosen to generate accurate baud rates. Crystals of 11.059MHz are often used rather than 12 MHz for this reason. Mode 3 In this mode Timers T0 and T1 behave quite divergently. T0 acts as two independent 8 bit counters. Count register TL0 uses the resources (such as the RUN flag, overflows flag) in TCON, TMOD etc. meant for T0. Similarly,TH0 uses the resources meant for T1. Thus, TR1 will enable running the 8 bit counter made up of TH0. TF1 will be set whenever TH0 overflows.T1 now has no control bits at all! It can only be used for services which require no control, no gating and no interrupts. Thus, T1 can be used for Baud rate generation, while we still have two timers available (both with 8 bit resolution). Serial Port • There are two pins available for serial communication TXD and RXD. • Normally TXD is used for transmitting serial data which is in SBUF register, RXD is used for receiving the serial data. • SCON register is used for controlling the operation. • There are four modes of serial communication which has been discussed in next chapter. [26]
  • OSSCILLATORS It is used for providing the clock to MC8051 which decides the speed orbaud rate of MC. We use crystal which frequency vary from 4MHz to 30 MHz, normally we use 11.0592 MHz frequency. INTERRUPTS Interrupts are defined as requests because they can be refused (masked) if they are not used, that is when an interrupt is acknowledged. A special set of events or routines are followed to handle the interrupts. These special routines are known as interrupt handler or interrupt service routines (ISR). These are located at a special location in memory. INT0 and INT1 are the pins for external interrupts. [27]
  • ARCHUTECTURE OF 8051:- ALU Arithmetic Logical Unit: This unit is used for the arithmetic calculations. Accumulator: This register is used for arithmetic operations. This is also bit addressable and 8 bit register. B-Register: This register is used in only two instructions MUL AB and DIV AB. This is also bit addressable and 8 bit register. PC-Program Counter • Points to the address of next instruction to be executed from ROM • It is 16 bit register means the 8051 can access program address from 0000H to FFFFH. A total of 64KB of code. 16 bit register means. [28]
  • STACKS IN 8051:- [29]
  • 5.PROGRAMMING AND INTERFACING:5.1 INPUT DEVICES INTERFACING 5.1.1 SWITCH Fig-2.1-Various Types Of Switches Fig. 1 Switches are used to open/close a circuit Fig. 2  S1 is a "single pole on/off" switch in the off position Fig. 3 This is a "2 pole on/off" switch which completely isolates the lamp from the supply in the off position. This may be important if it is a high voltage supply. The dotted line indicates that S1a and S1b are part of the same switch "ganged" together and operate simultaneously. Fig. 4 This is a "single pole changeover" switch. Either lamp 1 or lamp 2 is on. Fig. 5this is a "2 pole changeover" switch. The unlit lamp is completely isolated from the supply. Again S1a and S1b are part of the same switch Fig. 6this is a "single pole 5 way" switch. It can select 1 of 5 circuits. You can have 2p 5w, 3p 4w etc Fig. 8 This is a "changeover" slide switch. When operated a-b opens and b-c closes [30]
  • 1 INTERFACING WITH AT89S52In 8051 PORT 1, PORT 2 & PORT 3 have internal 10k Pull-up resistors whereas this Pull-up resistor is absent in PORT 0. Hence PORT 1, 2 & 3 can be directly used to interface a switch whereas we have to use an external 10k pull-up resistor for PORT 0 to be used for switch interfacing or for any other input. Figure 2.2 shows switch interfacing for PORT 1, 2 & 3. Figure 2.3 shows switch interfacing to PORT 0. Fig 2.2 - Switch Interfacing For Port 1, 2 & 3 For any pin to be used as an INPUT PIN a HIGH (1) should be written to the pin if you don’t do this the pin will always be read as LOW.In the above figure when the switch is not pressed the 10k resistor provides the current needed for LOGIC 1 closure of switch provides LOGIC 0 to the controller PIN.Let's write a small program where whenever a switch is pressed a LED is turned ON. Consider that switch is connected to P2.0 & an LED connected to P2.1. Program of switch interfacingMain() { P2_0==1; SETB P2_1==0; While(1) { If(P2_0==0) { P2_1==1; } Else { P2_1==0; } } [31]
  • OUTPUT DEVICES INTERFACING 5.2.1 LED INTERFACING C CODE FOR BLINKING LEDS CONNECTED ON PORT2: #include<at89s8252.h> void delay(unsigned int i); void main(void) { While(1) { P2=0x00; Delay(0xffff); P2=0x00; Delay(0xff); } } void delay(unsigned int i) { while(i!=0) { i--; } } Fig:-3.1-Hardware Interfacing Of Led With At89s52 [32]
  • 3.1.2 C CODE FOR RUNNING LED CONNECTED ON PORT2: #include<at89s8252.h> void delay(unsigned int i); void main () { P0=0x00; while (1) { delay(0xffff); P2_0=1; delay(0xffff); P2_0=0; P2_1=1; delay(0xffff); P2_1=0; P2_2=1; delay(0xffff); P2_2=0; P2_3=1; delay(0xffff); P2_3=0; P2_4=1; delay(0xffff); P2_4=0; P2_5=1; delay(0xffff); P2_5=0; P2_6=1; delay(0xffff); P2_6=0; P2_7=1; delay(0xffff); P2_7=0; P2_0=1 } }void delay(unsigned int i) { while (i!=0) { i--; } } [33]
  • 5.2.2 LCD(JHD162A) INTERFACING: On most displays, the pins are numbered on the LCD’s printed circuit board, but if not, it is quit easy to locate pin1. Since the pin is connected to ground, it often has a thicker PCB track connected to it, and it is generally connected to the metal work at some point. Fig:-3.2-Jhd162a LCD(16x2) Three command control inputs. When this line is low, data bytes transferred to the display are treated as commands, and data bytes read from the display indicate its status. By setting the RS line high, character data can be transferred to and from the module. Pin 5 is (R/W) line. This line is pulled low in order to write commands or character data to the module, or pulled high to read character data or status information from its registers. Pin 6 is Enable (E) line. This input is used to initiate the actual transfer of commands or character data between the module and the data lines. When writing to the display, data is transferred only on the high to low transition of this signal. However, when reading from the display, data will become available shortly after the low to high transition and remain available until the signal falls low again C CODE FOR LCD DISPLAY //Program to study basics of LCD #include"AT89S8252.h" //macro directives of LCD #define LCD P1 #define RS P3_3 #define EN P3_4 //prototyping various functions of LCD void delay(unsigned int d); void lcd_cmd(unsigned char c); void lcd_init(void); void cursor_position(unsigned char p); void display(unsigned char h); //program to display character 'A' void main() { [34]
  • lcd_init(); cursor_position(0); display('A'); } //defining delay function void delay(unsigned int d) { while(d!=0) d--; } //subprogram to send various commands to LCD void lcd_cmd(unsigned char c) { delay(300); LCD=c; RS=0; EN=1; EN=0; } //subprogram too initialize LCD void lcd_init(void) { lcd_cmd(0x01); lcd_cmd(0x38); lcd_cmd(0x0C); } //subprogram to set cursor position void cursor_position(unsigned char p) { lcd_cmd(0x80+p); } //subprogram to display data on LCD void display(unsigned char h) { delay(300); LCD=h; RS=1; EN=1; EN=0; } [35]
  • C CODE FOR STRING DISPLAY ON LCD: void main() { while(1) { unsigned char name[]={"hello&"}; unsigned char group[]={"Group 3&"}; lcd_init(); cursor_position(0); string_display(name); cursor_position(40); //to display string on second row of LCD string_display(group); } } //function to display string void string_display(unsigned char *s) { while(*s!='&') { display(*s); delay(0xffff); s++; } } [36]
  • 5.2.3 SEVEN SEGMENT DISPLAY The 7 segment display is used as a numerical indicator on many types of test equipment. Fig:-3.4-Basic Diagram Of A Seven Segment Display It is an assembly of light emitting diodes which can be powered individually. They most commonly emit red light. They are arranged and labeled as shown in the figure 3.4. Powering all the segments will display the number 8. Powering a,b,c d and g will display the number 3. Numbers 0 to 9 can be displayed. The d.p represents a decimal point. The one shown is a common anode display since all anodes are joined together and go to the positive supply. The cathodes are connected individually to zero volts. Resistors must be placed in series with each diode to limit the current through each diode to a safe value. Early wrist watches used this type of display but they used so much current that the display was normally switched off. To see the time you had to push a button. Common cathode displays where all the cathodes are joined are also available. Liquid crystal displays do a similar job and consume much less power. Alphanumeric displays are available which can show letters as well as numbers C CODE TO INTERFACE SEVEN SEGMENT WITH AT89S52 AND DISPLAY NUMBERS 0 TO 99 #include"at89s8252.h" void delay(unsigned int d); void bcd(unsigned int x); void main() { unsigned char i; while(1) { for(i=0;i<100;i++) { [37]
  • bcd(i); } } } void delay(unsigned int d) { while(d!=0) { d--; } } 5.2.4 RELAY INTERFACING The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an electromagnet. When the coil is energised, by passing current through it, the core becomes temporarily magnetised. Fig:-3.5-Basic Relay Circuit The magnetized core attracts the iron armature. The armature is pivoted which causes it to operate one or more sets of contacts. When the coil is de-energized the armature and contacts are released. The coil can be energized from a low power source such as a transistor while the contacts can switch high powers such as the mains supply. The relay can also be situated remotely from the control source. Relays can generate a very high voltage across the coil when switched off. This can damage other components in the circuit. To prevent this a diode is connected across the coil. The cathode of the diode is connected to the most positive end of the coil. [38]
  • Fig:-3.6-Basic Relay Leads The spring sets (contacts) can be a mixture of normally open , normally closed and change over.The actual contact points on the springsets are available for high current and low current operation. Relays are devices which allow low power circuits to switch a relatively high Current/Voltage ON/OFF. For a relay to operate a suitable pull-in & holding current should be passed through its coil. Generally relay coils are designed to operate from a particular voltage often its 5V or 12V. The function of relay driver circuit is to provide the necessary current (typically 25 to 70ma) to energize the relay coil. Fig:-3.7- Basic Relay Interfacing With At89s8252 Figure 3.7 shows the basic relay driver circuit. As you can see an NPN transistor BC547 is being used to control the relay. The transistor is driven into saturation (turned ON) when a LOGIC 1 is written on the PORT PIN thus turning ON the relay. The relay is turned OFF by writing LOGIC 0 on the port pin. [39]
  • 5.2.5 MOTORS INTERFACING 4.1 L293D DUAL H-BRIDGE MOTOR DRIVER L293D is a dual H-Bridge motor driver, So with one IC we can interface two DC motors which can be controlled in both clockwise and counter clockwise direction and if you have motor with fix direction of motion the you can make use of all the four I/Os to connect up to four DC motors. L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for protection of circuit from back EMF output diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V, which has made L293D a best choice for DC motor driver. . Fig 4.1- Interfacing A Dc Motor Using L293d As you can see in the circuit, three pins are needed for interfacing a DC motor (A, B, Enable). If you want the o/p to be enabled completely then you can connect Enable to VCC and only 2 pins needed from controller to make the motor work. As per the truth mentioned in the image above its fairly simple to program the microcontroller. Its also clear from the truth table of BJT circuit and L293D the programming will be same for both of them, just keeping in mind the allowed combinations of A and B. We will discuss about programming in C as well as assembly for running motor with the help of a microcontroller . [40]
  • C CODE FOR INTERFACING STEPPER MOTOR #include<8051.h> #define s4 P0_0 #define s2 P0_1 #define s3 P0_2 #define s1 P0_3 void delay(unsigned int a); void full_stepping(void); void main() { P0=0x00; while(1) { full_stepping(); } } void full_stepping(void) { s1=1;s2=1;s3=0;s4=0; delay(1500); s1=0;s2=1;s3=1;s4=0; delay(1500); s1=0;s2=0;s3=1;s4=1; delay(1500); s1=1;s2=0;s3=0;s4=1; delay(1500); } void delay(unsigned int a) { while(a!=0) { a--; } } [41]
  • 5.2.6 INTERFACING CONVERTERS (ADC) 5.1 ADC-0804 INTERFACING WITH AT89S52: The ADC0804 family is CMOS 8-Bit, successive-approximation A/D converters which use a modified potentiometer ladder and are designed to operate with the 8080A control bus via three-state outputs. These converters appear to the processor as memory locations or I/O ports, and hence no interfacing logic is required. The differential analog voltage input has good common mode- rejection and permits offsetting the analog zero-input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution. 5.1.1 Features • 80C48 and 80C80/85 Bus Compatible - No Interfacing Logic Required • Conversion Time < 100us • Easy Interface to Most Microprocessors • Differential Analog Voltage Inputs • TTL Compatible Inputs and Outputs • On-Chip Clock Generator • 0V to 5V Analog Voltage Input Range (Single + 5V Supply) • No Zero-Adjust Required 5.1.2 ADC-0804 PIN DIAGRAM Fig.-5.1-adc-0804 pin diagram [42]
  • Hardware interfacing of ADC-0804 CON16_0 VCC VCC 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 LCD C13 104 RS EN R55 56E R2 10K 11 30 29 16 10 17 40 2 R6 220E 20 P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 21 22 23 24 25 26 27 28 P3.1/TXD ALE/PROG 15 PSEN P3.5/T1 P3.6/WR P3.2/INT0 12 P3.0/RXD P3.7/RD 18 17 16 15 14 13 12 11 EOC 5 SOC DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 +IN -IN VREF/2 CLKR CLKIN INTR CS RD WR C9 CAP 3 U4 ADC0804 1 6 7 R5 10K 2 VCC P0.7/AD7 P0.6/AD6 P0.5/AD5 P0.4/AD4 P0.3/AD3 P0.2/AD2 P0.1/AD1 P0.0/AD0 AT89S8252 VCC VCC P3.3/INT1 P3.4/T0 VCC/VREF 32 33 34 35 36 37 C6 38 10uF 16V 39 1 VCC GND VCC 13 14 VCC R53 1k AGND RS EN RST GND OUTPUT 8 9 1 2 3 4 5 6 7 8 U21 TL431 C14 1uf /16v 9 19 4 C8 1uf /16v 1 2 3 10 C5 XTAL1 XTAL2 P1.0/T2 P1.1/T2-EX P1.2 P1.3 P1.4/SS P1.5/MOSI P1.6/MISO P1.7/SCK GND 33pF 19 18 U22 LM35/SO 3 20 3 EA/VPP 4 12 33pF C4 Y2 31 VCC CRY STAL U2 R17 10K C7 150pF Temprature monitoring system Fig.-5.2- hardware interfacing of adc-0804 for temperature monitoring When interfacing is being done then gets lowered then only it allows the controller to read the data, otherwise controller can not read the data. is always grounded. is software controlled. C- CODE FOR TEMPERATURE MONITORING SYSTEM #include <at89s8252.h> #define SOC P3_2 #define EOC P3_5 unsigned char read_adc(void); void disp_dec(unsigned int digit); code unsigned char table[16]={'0','1','2','3','4','5','6','7','8','9'}; void main(void) { unsigned char e; P2=0xff; Init_lcd(); while(1) { [43]
  • cursor_position(0x00); e=read_adc(); disp_dec(e); } } unsigned char read_adc(void) { unsigned char n; SOC=0; SOC=1; while(EOC==1) { n=P2; } return n; } void disp_dec(unsigned int digit) { unsigned int temp; if(digit<100) { temp=digit/10; display(table[temp]); temp=digit-temp*10; display(table[temp]); } if(digit>99 && digit<1000) { temp=digit/100; display(table[temp]); digit=digit-(temp*100); temp=digit/10; display(table[temp]); digit=digit-(temp*10); temp=digit; display(table[temp]); } [44]
  • 5.2.7 COMMUNICATION 6.1 Serial communication between At89s52 and PC One of the 8051s many powerful features is its integrated UART, otherwise known as a serial port. The fact that the 8051 has an integrated serial port means that you may very easily read and write values to the serial port. If it were not for the integrated serial port, writing a byte to a serial line would be a rather tedious process requring turning on and off one of the I/O lines in rapid succession to properly "clock out" each individual bit, including start bits, stop bits, and parity bits. 6.1.1 SETTING THE SERIAL PORT MODE The first thing we must do when using the 8051s integrated serial port is, obviously, configure it. This lets us tell the 8051 how many data bits we want, the baud rate we will be using, and how the baud rate will be determined. First, lets present the "Serial Control" (SCON) SFR and define what each bit of the SFR represents: Bit Name Bit Address Explanation of Function 7 SM0 9Fh Serial port mode bit 0 6 SM1 9Eh Serial port mode bit 1. 5 SM2 9Dh Mutliprocessor Communications Enable (explained later) 4 REN 9Ch 3 TB8 9Bh Transmit bit 8. The 9th bit to transmit in mode 2 and 3. 2 RB8 9Ah Receive bit 8. The 9th bit received in mode 2 and 3. 1 TI 99h Transmit Flag. Set when a byte has been completely transmitted. 0 RI 98h Receive Flag. Set when a byte has been completely received. Receiver Enable. This bit must be set in order to receive characters. Table 6.1-Scon Register [45]
  • SERIAL TRANSMISSION INTERFACING 12 13 14 15 40 VCC XTAL1 XTAL2 RST P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 VCC 1 2 3 4 5 6 7 8 P3.7/RD P1.0/T2 P3.6/WR P1.1/T2-EX PSEN P1.2 ALE/PROG P1.3 P3.1/TXD P1.4/SS P3.0/RXD P1.5/MOSI P1.6/MISO P1.7/SCK AT89S8252 GND R4 10K 17 16 29 30 11 10 U6 C23 104 VCC 11 12 7 8 C20 10UF/16V 1 3 2 VCC T1IN R1OUT J7 R1IN T1OUT T2OUT R2IN T2IN C1+ C1V+ C21 10UF/16V 20 C18 10uF 16V 21 22 23 24 25 26 27 28 16 9 39 38 37 36 35 34 33 32 VCC 19 18 P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 R2OUT GND 3 C17 C19 104 15 12 Y4 4 33pF EA/VPP CRY STAL U5 33pF C16 31 VCC VCC C2+ C2V- 13 14 10 SPT TXD 1 2 3 SPT RXD SERIAL PORT OF PC C24 10UF/16V 9 4 5 6 C22 MAX232 10UF/16V Fig.7.1-Max232 Interfacing With At89s52 For Serial Transmission C- CODE FOR SERIAL TRANSMISSION(FROM MICROCONTROLLER TO PC) #include<at89s8252.h> void Init_SPT(void); void transmit_serial(unsigned char a); void delay(unsigned int i); void main(void) { Init_SPT(); while(1) { delay(0XFFFF); transmit_serial('N'); delay(0XFFFF); transmit_serial('E'); delay(0XFFFF); transmit_serial('T'); delay(0XFFFF); transmit_serial('M'); delay(0XFFFF); [46]
  • transmit_serial('A'); delay(0XFFFF); transmit_serial('X'); delay(0XFFFF); } } void Init_SPT(void) { TMOD=0x20; TH1=0xfd; TR1=1; SCON=0x40; } void transmit_serial(unsigned char a) { SBUF=a; delay(500); TI=0; } void delay(unsigned int i) { while(i!=0) { i--; } } [47]
  • ELECTRONIC VOTING MACHINE USING 8051 MICROCONTROLLER List of Contents Abstract 50 1. Background 51 2. Microcontroller 56 2.1 Introduction 56 2.2 History 56 2.3 Definition of a Microcontroller 58 2.4 Microcontrollers vs Microprocessors 58 2.5 Memory Unit 58 2.6 Central Processing Unit 59 2.7 Bus 59 2.8 Input Output Unit 59 2.9 Serial Communication 60 2.10 Timer Unit 60 2.11 Watch Dog 61 2.12 Analog to Digital Converter 61 3. Introduction to 16X2 LCD Display 63 3.1 Pin description 63 3.2 DDRAM - Display Data RAM 64 3.3 BF - Busy Flag 64 3.4 Instruction Register (IR) and Data Register (DR) 64 3.5 Commands and Instruction set 64 3.6 Sending Commands to LCD 64 4. Project Description 65 4.1 Block diagram 65 4.2 General working 65 4.3 C language code 68 [48]
  • 5. Project Methodology 72 5.1 Components 72 5.2 Software used 72 5.3 Equipments used 72 6. Result and Conclusion 73 7. Applications 73 8. Future Scope 73 9. References and Bibliography 74 [49]
  • ABSTRACT India is world’s largest democracy. It is perceived to be charismatic one as it accommodates cultural, regional, economical, social disparities and still is able to stand on its own. Fundamental right to vote or simply voting in elections forms the basis of Indian democracy. In India all earlier elections be it state elections or centre elections a voter used to cast his/her vote to his/her favorite candidate by putting the stamp against his/her name and then folding the ballot paper as per a prescribed method before putting it in the Ballot box. This is a long, timeconsuming 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. EVM 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 in 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. It is also eco friendly. Our EVM consists of one microcontroller AT89S52. The unit consists of one LCD, 6 push buttons, couple of switches, an LED and a buzzer, etc. The port 0 of microcontroller is used for interfacing the led, port 2 is used for control switches, port 3 is used for Interfacing push buttons for voting. [50]
  • BACKGROUND Democracy and Voting Democracy has come to be accepted as the most preferred form of political system all over the world. However, the success of a democratic structure is to be judged by the successes that can be solely attributed to this system. There are various challenges before democracy. These are foundational challenges, challenge of expansion and deepening of democracy. All of these are dependent on how the democracy is perceived by people who form the government, participate in formation of government and are benefited by it. As we all know that India is world’s largest democracy. It is perceived to be charismatic one as it accommodates cultural, regional, economical, social disparities and still is able to stand on its own. India follows a federal form of government. It means that governance power is not residing with one authority, but is distributed at various levels. In India power is distributed between states and central authority. What forms the basis of such vast and complex system of governance? One needs not to be an Einstein to guess the answer. It is fundamental right to vote or simply voting in elections. Indian constitution provide every adult above the age of 18 years irrespective of his/her religion, region, caste, creed, color, economic status, education and sex the essential right to vote and elect her/his candidate to represent her/him. Hence voting can be termed as backbone of not just democracy in India but all around the world. Voting can be done in various ways. In early Roman Empire voting used to be done by raising hands in favor or against. In board rooms voting is done in similar way, some write their vote down, some choose to speak, some choose to cast vote using latest technology. Voting Techniques In India all earlier elections be it state elections or centre elections a voter used to cast his/her vote to his/her favorite candidate by putting the stamp against his/her name and then folding the ballot paper as per a prescribed method before putting it in the Ballot box. This is a long, time-consuming process and very much prone to errors. This method wanted voters to be skilled voters to know how to put a stamp, and methodical folding of ballot paper. Millions of paper would be printed and heavy ballot boxes would be loaded and unloaded to and from ballot office to polling station. All this 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. [51]
  • The marking system of voting was introduced in 1962 to make it possible for a substantial number of illiterate voters to indicate easily their preferences in choosing their representatives. Over the years, there was a pronounced increase in the volume of work: crores of ballot papers had to be printed and lakhs of ballot boxes had to be prepared, transported, and kept in storage; and a great amount of time was taken up by the conduct of elections. To overcome these difficulties, the Election Commission of India (ECI) thought of Hyderabad, electronic and gadgets. Bharat The Electronics Electronics Ltd. (BEL), Corporation Bangalore, of India developed Ltd. the (ECIL), electronic voting machine in 1981. The Electronic Voting Machine The complete EVM consists mainly of two units - (a) Control Unit and (b) Balloting Unit with cable for connecting it with Control unit. A Balloting Unit caters upto 16 candidates. Four Balloting Units linked together catering in all to 64 candidates can be used with one control unit. The control unit is kept with the Presiding Officer and the Balloting Unit is used by the voter for polling. The Balloting Unit of EVM is a small Box-like device, on top of which each candidate and his/her election symbol is listed like a big ballot paper. Against each candidate's name, a red LED and a blue button is provided. The voter polls his vote by pressing the blue button against the name of his desired candidate. How the Vote is cast with this EVM? The entire process is very easy to understand: • Like in earlier system, your name is called and you are asked to sign or put your thumb impression in a register. • After your identification is done by Election Officer, an ink mark is put on your finger, same as earlier. • Then the Election Officer gives you a slip that bears the Voter register number where you signed or put your thumb impression. • You hand over this slip to the presiding officer who confirms the serial number and permits you to vote by pressing the button of the Control Unit of EVM. • You are not given any ballot thereafter, and are sent to the EV Machine placed behind a card board in a corner. The machine is placed in such a way that your polled vote will be a secret. On the Balloting Unit of EVM, you press the button placed in front of your favorite candidate and release. [52]
  • Compare and Contrast: Paper Voting and EVM We have so far discussed three different voting systems. These systems are being used or considered obsolete because of certain positive and negative points. These are summarized as follows: Device type Ballot paper : Papers and boxes EVM : Embedded system with Assembly code Visual Output Ballot paper : Stamp on paper EVM : Single LED against each candidate's name Operating System/ Software Ballot paper : No operating system EVM : None, the Assembly code to register number of votes is all it has Hence it is simple automation of voting, no complexities. Records/ Audits Ballot paper : Manual counting to be done by officials, lengthy, time consuming Process. Inaccurate due to human errors. EVM : The Voting unit doesn't store anything, the control unit records the number of votes cast for each candidate against his serial number. No record to link person-to-vote. Control and Operation Ballot paper: Manual operation EVM : Automatic operation. The control Unit accumulates the votes, it is a device with flash storage and seven segment LED displays. The ballot unit has a button to issue a ballot for a voter. Security Issues Ballot paper : No security provided by the system, neither during polling nor during voting. EVM : During polling, a facility is provided to seal the machine in case of booth capturing. No further voting can be done afterwards. Ballot Issue Ballot paper : Ballot paper is issued by Electoral officer on which voter could cast his vote. EVM : Ballot is issued by Electoral officer by pressing a button on the control Unit. It allows the voter to press any button on the ballot unit to cast his vote. [53]
  • Storage of Votes Ballot paper : In ballot boxes assigned for the purpose of storing votes, highly insecure method of storage. EVM : In Internal Non removable memory of the Control Units. No transfer over network. Security increases with this feature. Moreover these results cant be accessed by authorized personnel only at commissioned offices.. Cost of the System Ballot paper : High cost of paper printing in millions and low speed of the whole process. EVM : About 12000 INR (300$) for one EVM. Power Supply Ballot paper : No power supply required. EVM : 6V alkaline batteries or electricity. Capacity Ballot paper : As much a ballot box can hold. EVM : 3840 Votes . Existing System But this electronic voting machine has its disadvantages too. These areas of deficiency are not much of a concern to a layman, but for an intelligent voter this must be eliminated for a secure election. The few technical disadvantages are given as: • Microprocessor based design, which requires a no. of supporting components like memory, peripheral interface, etc. • No security against illegal viewing of results, as presiding officer can view the results without any difficulty. • Less user friendly due to two seven segment displays • Existing system costs high. Proposed System All these faults motivated us to make this new enhanced EVM. The faults which are eliminated are summarized as follows: • Microcontroller replaced microprocessor, which made the EVM closer to real time operation making it faster, more reliable and unique. • More user friendly and interactive LCD display • Proposed system costs less. [54]
  • • As soon as the button is pressed, the LED indicator lights off and a whistle sound comes from the machine. This signifies that your vote has been casted rightly. Now you can come out. • In case of LED not not being turned off, press the button firmly again. If finding it difficult, consult the Presiding Officer. • Your vote is complete safe and secret and there is no room for error as well. You can rest assured that your vote is not going to be invalid in any case. • The Voting Machine is attached to the 'Control Unit'. When the user presses the button, his vote is registered in the control unit and the number of votes for the respective candidates is calculated automatically. Booth Capture A remarkable advantage is that rigging is not possible with the EVMs. In the ballot paper system, the intruders can mark hundreds of ballots and put them into the ballot box in a matter of a few minutes. This is not possible in voting machines as the machine is designed to cast only one vote and for the next vote to be casted the presiding officer should make it ready by pressing the related button. Thus the presiding officer can have a complete control of voting and avoid any kind of malpractices The EVMs have following advantages: • the saving of considerable printing stationery and transport of large volumes of electoral material, • easy transportation, storage, and maintenance, • no invalid votes, • reduction in 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 • eco friendly. [55]
  • 2. MICROCONTROLLERS 2.1 Introduction Circumstances that we find ourselves in today in the field of microcontrollers had their beginnings in the development of technology of integrated circuits. This development has made it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for production of microprocessors, and the first computers were made by adding external peripherals such as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted in creation of integrated circuits. These integrated circuits contained both processor and peripherals. That is how the first chip containing a microcomputer, or what would later be known as a microcontroller came about. 2.2 History It was year 1969, and a team of Japanese engineers from the BUSICOM Company arrived to United States with a request that a few integrated circuits for calculators be made using their projects. The proposition was set to INTEL, and Marcian Hoff was responsible for the project. Since he was the one who has had experience in working with a computer (PC) PDP8, it occurred to him to suggest a fundamentally different solution instead of the suggested construction. This solution presumed that the function of the integrated circuit is determined by a program stored in it. That meant that configuration would be simpler, but that it would require far more memory than the project that was proposed by Japanese engineers would require. After a while, though Japanese engineers tried finding an easier solution, Marcian's idea won, and the first microprocessor was born. In transforming an idea into a ready made product, Frederico Faggin was a major help to INTEL. He transferred to INTEL, and in only 9 months had succeeded in making a product from its first conception. INTEL obtained the rights to sell this integral block in 1971. First, they bought the license from the BUSICOM Company who had no idea what treasure they had. During that year, there appeared on the market a microprocessor called 4004. That was the first 4-bit microprocessor with the speed of 6 000 operations per second. Not long after that, American company CTC requested from INTEL and Texas Instruments to make an 8-bit microprocessor for use in terminals. Even though CTC gave up this idea in the end, Intel and Texas Instruments kept working on the microprocessor and in April of 1972, first 8-bit microprocessor appeared on the market under a name 8008. [56]
  • 2.3 Definition of a Microcontroller Microcontroller, as the name suggests, are small controllers. They are like single chip computers that are often embedded into other systems to function as processing/controlling unit. For example, the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toys ... etc, where automation is needed. The key features of microcontrollers include: • High Integration of Functionality • Microcontrollers sometimes are called single-chip computers because they have on-chip memory and I/O circuitry and other circuitries that enable them to function as small standalone computers without other supporting circuitry. • Field Programmability, Flexibility • Microcontrollers often use EEPROM or EPROM as their storage device to allow field programmability so they are flexible to use. Once the program is tested to be correct then large quantities of microcontrollers can be programmed to be used in embedded systems. • Easy to Use [57]
  • 2.4 Microcontrollers versus Microprocessors Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short that means that microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices. 2.5 Memory unit Memory is part of the microcontroller whose function is to store data. The easiest way to explain it is to describe it as one big closet with lots of drawers. If we suppose that we marked the drawers in such a way that they cannot be confused, any of their contents will then be easily accessible. It is enough to know the designation of the drawer and so its contents will be known to us for sure. Typically, the amount of ROM type memory will vary between around 512 bytes and 4096 bytes, although some 16 bit microcontrollers such as the Hitachi H8/3048 can have as much as 128 Kbytes of ROM type memory. ROM type memory, as has already been mentioned, is used to store the program code. ROM memory can be ROM (as in One Time Programmable memory), EPROM, or EEPROM. The amount of RAM memory is usually somewhat smaller, typically ranging between 25 bytes to 4 Kbytes. management tasks. RAM is used for data storage and stack It is also used for register stacks (as in the microchip PIC range of microcontrollers). [58]
  • 2.6 Central Processing Unit Let add 3 more memory locations to a specific block that will have a built in capability to multiply, divide, subtract, and move its contents from one memory location onto another. The part we just added in is called "central processing unit" (CPU). Its memory locations are called registers. 2.7 Bus That "way" is called "bus". Physically, it represents a group of 8, 16, or more wires. There are two types of buses: address and data bus. The first one consists of as many lines as the amount of memory we wish to address and the other one is as wide as data, in our case 8 bits or the connection line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside the microcontroller. Figure2.4: Showing connection between memory and central unit using buses 2.8 Input-output unit Those locations we've just added are called "ports". There are several types of ports: input, output or bidirectional ports. When working with ports, first of all it is necessary to choose which port we need to work with, and then to send data to, or take it from the port. 2.9 Serial communication [59]
  • Beside stated above we've added to the already existing unit the possibility of communication with an outside world. However, this way of communicating has its drawbacks. One of the basic drawbacks is the number of lines which need to be used in order to transfer data. What if it is being transferred to a distance of several kilometers? The number of lines times’ number of kilometers doesn't promise the economy of the project. It leaves us having to reduce the number of lines in such a way that we don't lessen its functionality. Suppose we are working with three lines only, and that one line is used for sending data, other for receiving, and the third one is used as a reference line for both the input and the output side. In order for this to work, we need to set the rules of exchange of data. These rules are called protocol. Protocol is therefore defined in advance so there wouldn't be any misunderstanding between the sides that are communicating with each other. For example, if one man is speaking in French, and the other in English, it is highly unlikely that they will quickly and effectively understand each other. Let's suppose we have the following protocol. The logical unit "1" is set up on the transmitting line until transfer begins. Figure2.6: Serial unit sending data through three lines only 2.10 Timer unit Since we have the serial communication explained, we can receive, send and process data. However, in order to utilize it in industry we need a few additionally blocks. One of those is the timer block which is significant to us because it can give us information about time, duration, protocol etc. The basic unit of the timer is a free-run counter which is in fact a register whose numeric value increments by one in even intervals, so that by taking its value during periods T1 and T2 and on the basis of their difference we can determine how much time has elapsed. This is a very important part of the microcontroller whose understanding requires most of ourtime. 2.12 Analog to Digital Converter [60]
  • As the peripheral signals usually are substantially different from the ones that microcontroller can understand (zero and one), they have to be converted into a pattern which can be comprehended by a microcontroller. This task is performed by a block for analog to digital conversion or by an ADC. This block is responsible for converting an information about some analog value to a binary number and for follow it through to a CPU block so that CPU block can further process it. Figure2.9: Block for converting an analog input to digital output Finally, the microcontroller is now completed, and all we need to do now is to assemble it into an electronic component where it will access inner blocks through the outside pins. The picture below shows what a microcontroller looks like inside. Figure2.10: Physical configuration of the interior of a microcontroller Thin lines which lead from the center towards the sides of the microcontroller represent wires connecting inner blocks with the pins on the housing of the microcontroller so called bonding lines. Chart on the following page represents the center section of a microcontroller. [61]
  • Figure2.11: Microcontroller outline with basic elements and internal connections 2.13 AT89S52 microcontroller: The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. [62]
  • 3. INTRODUCTION TO 16X2 LCD DISPLAY LCD stands for Liquid Crystal Display. The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters. 3.1 Pin Description Most LCDs with two controllers has 16 Pins. Pin description is shown in the table below. Pin No. Name Description Pin no. 1 D7 Data bus line 7 (MSB) Pin no. 2 D6 Data bus line 6 Pin no. 3 D5 Data bus line 5 Pin no. 4 D4 Data bus line 4 Pin no. 5 D3 Data bus line 3 Pin no. 6 D2 Data bus line 2 Pin no. 7 D1 Data bus line 1 Pin no. 8 D0 Data bus line 0 (LSB) Pin no. 9 EN1 Enable signal for row 0 and 1 (1stcontroller) Pin no. 12 VEE Contrast adjust Pin no. 13 VSS Power supply (GND) Pin no. 14 VCC Power supply (+5V) Pin no. 15 EN2 Enable signal for row 2 and 3 (2ndcontroller) Pin no. 16 NC Not Connected Table No.3.1: Pin description of the LCD [63]
  • 3.2 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. 3.3 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. 3.4 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. 3.5 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. 3.6 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 send enable signal [64]
  • PROJECT DESCRIPTION:BLOCK DIAGRAM GENERAL WORKING:1. Initially when the switch is closed, allows the evm to take the vote. the vote is taken only when push button is pressed and led D1 is switched ON. [65]
  • 2. A push button is assigned to each party. When the push button of the desired party is pressed, the led is switched off which indicates that the vote is cast and the buzzer gives a beep. Again the push button is pressed so that the evm is ready to take the next vote which isindicated through the led D1.The same process is repeated until all the voters cast theirvotes. 3. To view the results of each respective party, the switch must be opened [66]
  • 4. To know the result of the party, the push button of the respective party must be pressed so that the number of votes cast for the party is displayed on the lcd screen. P RW in no. 10 / This process is repeated to know the results of each party. R P 1 in no. 11 S = Data input [67]
  • 4.3 C LANGUAGE CODING: #include<reg51.h> sfr input=0x90; sfr ldata=0xa0; sbit rs=P0^7; sbit rw=P0^6; sbit en=P0^5; sbit m=P3^0; sbit n=P3^1; sbit buzz=P3^2; sbit on=P3^3; void delay(int ); void lcdcmd(char ); void lcddata1(char *); void lcddata(char); void lcd(); int i1,i11,i12,i2,i21,i22,i3,i31,i32,i4,i41,i42,i5,i51,i52=0; void main() { on=0; P1=0;P3=0; while(1) { lcdcmd(0x38); delay(10); lcdcmd(0x0e) ; delay(10); lcdcmd(0x01); lcdcmd(0x06) ; delay(20) ; lcddata1("Vote"); if(n==1) on=1; if(m==1&on==1) { if (input==0x01) { buzz=1; while (input == 0x01); i1=i1 + 1; if(i1>=10) i11=i1/10; i12=i1%10; on=0; buzz=0; //ready=0; } [68]
  • if (input==0x02) {buzz=1; while (input == 0x02); { i2=i2 + 1; if(i2>=10) i21=i2/10; i22=i2%10; on=0; buzz=0; } } if (input==0x04) { buzz=1; while (input ==0x04); { i3=i3 + 1; if(i3>=10) i31=i3/10; i32=i3%10; on=0; buzz=0; } } if (input==0x08) { buzz=1; while (input == 0x08); { i4=i4 + 1; if(i4>=10) i41=i4/10; i42=i4%10; on=0; buzz=0; } } if (input==0x10) { buzz=1; while (input == 0x10); { i5=i5 + 1; if(i5>=10) i51=i5/10; [69]
  • i52=i5%10; on=0; buzz=0; } }} if(m==0)//else { if (input==0x01) { lcddata1(" CONGRESS="); lcddata(i11+0x30); lcddata(i12+0x30); delay(100); } if (input==0x02) { lcdcmd(0x01); lcddata1(" BJP="); lcddata(i21+0x30); lcddata(i22+0x30); delay(100); } if (input==0x04) { lcdcmd(0x01); lcddata1(" CPM&CPI="); lcddata(i31+0x30); lcddata(i32+0x30); delay(100); } if (input==0x08) { lcdcmd(0x01); lcddata1(" TDP="); lcddata(i41+0x30); lcddata(i42+0x30); delay(100); } if(input==0x10) { lcdcmd(0x01); lcddata1(" PRP="); lcddata(i51+0x30); lcddata(i52+0x30); delay(100); } [70]
  • else{ //lcdcmd(0x01); lcddata1("result"); delay(100) ; }} }} void delay(int time) { int i,j; for(i=0;i<time;i++) for(j=0;j<900;j++); } void lcdcmd(char value) { ldata=value; rs=0; rw=0; en=1; delay(2); en=0; } void lcddata1(char *value) { int i; for(i=0;value[i]!='0';i++) { ldata=value[i]; rs=1; rw=0; en=1; delay(1); en=0; } } void lcddata(char value) { ldata=value; rs=1; rw=0; en=1; delay(1); en=0; [71]
  • 5. PROJECT METHODOLOGY 5.1 Components: Component Name Quantity Microcontroller IC (AT89S52) Transistor (L78O5CV) Resistor Diodes Port Connectors LED Resistors LCD (16X2 characters) Buzzer contrast controller push switches crystal oscillator 1 1 7 4 4 3 7 1 1 1 10 1 5.2 Software's used: 1. Keil uVision3. 2. Eclipse 5.3 Equipments used: 1. Soldering iron, solder, flux. 2. Personal computer. 3. DB25 connector. 6. RESULT AND CONCLUSION The EVM consists of a microcontroller AT89S52 16×2 LCD display, LED ,push buttons, relay and a buzzer. [72]
  • • In • The EVM is ready for voting only after ready to vote button is pressed and the led is voting mode, the voting mode switch is in on condition. on. The led turns off after a vote is casted along with a buzzer. Counting the votes for individual candidate (5 in number) is done simultaneously along with the voting and total number of votes cast to that individual can be checked at anytime. • In • In result mode, the UNIT displays the votes of individual candidate, whenever the result mode, the voting mode switch is in off position. “Result Button” of the corresponding individual is pressed. 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. 7. APPLICATIONS Fast track voting which could be used in small scale elections, like resident welfare association, “panchayat” level election and other society level elections. It could also be used to conduct opinion polls during annual share holders meeting. It could also be used to conduct general assembly elections where number of candidates are less than or equal to eight in the current situation. 8. FUTURE SCOPE Number of candidates could be increased by using other microcontroller or an 8255 IC. It could be interfaced with printer to get the hard copy of the result almost instantly from the machine itself. It could also be interfaced with the personal computer and result could be stored in the central server and its backup could be taken on the other backend servers. Again, once the result is on the server it could be relayed on the network to various offices of the election conducting authority. Thus our project could make the result available any corner of the world in a matter of seconds 9. REFRENCES AND BIBLOGRAPHY [73]
  • Muhammad Ali Mazidi , Janice Gillispie Mazidi, Rolin D. Mckinlay. Second edition, “THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEM” K. J. Ayala. Third edition, “The 8051 MICROCONTROLLER” General information about electronic voting machine www.eci.gov.in www.eci.gov.in/faq/evm.asp ww.eci.gov.in/Audio_VideoClips/presentation/EVM.ppt www.rajasthan.net/election/guide/evm.htm www.indian-elections.com/electoralsystem/electricvotingmachine.html Tutorial on microcontroller: www.8051projects.net/microcontroller_tutorials/ Tutorial on LCD: www.8051projects.net/lcd-interfacing/ [74]