Application of MCS-51 Single Chip Microcomputer in Voting System

Publisher:legend9Latest update time:2011-03-13 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: This paper designs a professional electronic voting system for voting and election. The 80C31 single-chip microcomputer is used to form a master-slave "single-chip microcomputer network" system. The mature and reliable serial communication method is adopted to realize the electronic voting. The article describes the basic principle of the voting machine and gives the hardware and software design of the system.
Keywords: voting machine; 80C51; serial communication

0 Introduction
With the improvement of socialist democracy in China, voting machines are increasingly widely used as a fair, fast and accurate voting tool. Through voting machines, delegates can easily complete electronic voting from signing in to various proposals by simply pressing voting machine buttons according to the meeting agenda. In anonymous mode, the system's unique confidentiality function allows delegates to maximize their true intentions when pressing keys without worrying about being spied on or recorded. Voting results can be automatically generated and displayed and printed in the form of graphics or reports according to meeting requirements.

1 Design plan
The system includes a PC: used for editing, storing, printing and displaying voting results. A large screen monitor displays voting results and other files. Voting collection network: collects and processes the voting results of each representative. After analyzing the functional requirements of the system, it is believed that the single-chip microcomputer 80C51 is most suitable for a system with multiple points and relatively simple functions at each point. Thus, a master-slave "single-chip microcomputer network" is formed. The voting system is shown in Figure 1.

a.JPG

2 Hardware Design
The single-chip voting system is networked with a master 80C51 and several slave 80C51s, using serial communication. The master 80C51 reports the voting results to the PC.
2.1 Extension Hardware
As shown in Figure 2, the terminal (extension) is designed as a single-person stand-alone mode. The system is equipped with an extension for each voter, with an upper limit of 255. The extension uses 80C51 as the core, uses the microcontroller's own resources, and expands the external program memory through latch 373. According to the existing program volume, EPROM 27C64 is selected as the program memory. The built-in 128B RAM of 80C51 can meet the data processing requirements, eliminating the need for external expansion RAM and making the extension simple and reliable. The P0 and P2 ports of the extension 801251 are used for the address and data lines of the external expansion EPROM. The keyboard occupies P1.0, P1.1, P1,2, P1.3, and P1.4 of P1 port. There are five function buttons corresponding to "check in", "agree", "disagree", "abstain" and "speak". P3.2, P3.3, P3.4, P3.5, P3.6 of P3 port drive LED to light up and display the status of "check in", "agree", "disagree", "abstain" and "speak" respectively. So that voters can confirm. When the machine's request to speak is allowed, P3.7 is high and effective, and the microphone is connected.

b.JPG
Input and output part: P3.0 and P3.1 in the P3 port are the receiving (RXD) and sending (TXD) ends of the second function serial port, which are connected to the RS232 integrated circuits MC1488 and MC1489 for serial communication.
The whole network uses two ±10 V power supplies to meet the working requirements of RS232. The +5 V power supply of 80C51 and its auxiliary circuits is obtained by stabilizing +10 V through 7805 to reduce the variety of power supplies. The above scheme is a typical single-chip minimum system, which gives full play to the performance of the single-chip microcomputer.
2.2 Main single-chip microcomputer hardware
One of the tasks of the main single-chip microcomputer is to contact each extension and collect the voting results of the extension, summarize them, and send them to the PC through the serial port for display and printing. The second task is to query and arbitrate the speech requests of each extension. According to the priority of the speech, the "on" and "off" serial instructions are issued to solve the problem of speech competition. Similar to the extension, the hardware of the main single-chip microcomputer is relatively simple, and P3.0 and P3.1 are used as serial sending and receiving ports. Other extensions and PCs are slaves, forming a master-slave network.

3 Software Design
3.1 Extension Master Program and Interrupt Service Program (see Figure 3)

c.JPG
The extension main program initializes the serial port to mode 3, SM2=1, allows reception, and the baud rate is 1.2 kHz. Query the status of P1.0~P1.4 keys in a loop. When a key is pressed, delay 12ms to remove jitter and interference, then check the key, and enter the corresponding key processing program after confirmation. The characteristic value is recorded in the internal RAM, and then the corresponding LED is driven by the P3 port to light up for the operator to confirm. In order to prevent the total number of votes in the voting results from exceeding the number of people who have reported, the program stipulates: If the report key is not pressed, other key operations are invalid. That is, report before voting. The program sets that if the "speak" key is pressed (mechanical self-locking), the extension reports to the host. After the host queries that there is no extension in the "speaking" state, the extension is replied to allow speaking. After receiving the command, the extension sets P3.7 high to effectively connect the microphone.
Extension interrupt service program: When the host sends an address frame through the serial port, each extension enters the interrupt service program, first judging whether it is the local address, if not, it returns to the main program. If it is, it continues to receive command frames (data frames). The following responses are made to the commands: extension report, voting result characteristic value; whether there is a request to speak, turn the microphone on or off. Return to the main program. In addition, the subroutine also makes corresponding countermeasures for error signals to improve the anti-interference ability.
3.2 Host program (see Figure 4)

d.JPG
After the system is powered on and reset, the serial port initialization program is executed first, the extension is queried in the order of number, and the extension status word is received and stored in the memory. After the extension is accessed, the results are classified, counted, and converted into ASCII code. It is sent to the PC in the order of reporting, agreeing, opposing, abstaining, and not pressing a key, and the PC receives the data in an interrupt response mode.
The system speech control strategy: divided into two levels "host" and "member". If the "member" is speaking, the "host" can interrupt the "member" to speak. The person who requests to speak first in the same level has priority. In
order to prevent the extension from completing the reset after the system is powered on, the host will query first, causing communication failure. After the host is powered on and reset, the software program delays 20 ms to ensure that the extension enters the working state before the host accesses again.
3.3 Serial communication conventions
The SM2 (SCON5) position of all extensions is 1, so that they are placed in the state of receiving address frames; the host sends a frame of address information, including an 8-bit address, and the 9th position is 1 to indicate that the address is sent; the extension receives the address frame, each interrupts and responds, and compares whether the received address is the local machine. The addressed extension clears SM2 to receive subsequent commands from the host. The unaddressed extension still keeps SM2 = 1 until a new address frame is received. The host sends a command frame 0AAH (9th bit is 0) to the addressed extension. The extension receives the command frame and determines whether it is 0AAH. If it is, it sends the extension result and speech request status. If not, it calls the microphone control program. The extension address number can be from 0 to FEH, in this case 0 to 15H. There are 21 voters in total. The designated PC address is FFH.

4 Conclusion
This system adopts mature and reliable software and hardware technology solutions. Practical work shows that it is easy to operate and has strong anti-electromagnetic interference ability. The statistical results are accurate and reliable. Display and printing are fast and rapid. It is an essential tool for various state machines, social groups, enterprises and institutions to exercise democratic rights.

Reference address:Application of MCS-51 Single Chip Microcomputer in Voting System

Previous article:Design of portable physiological parameter monitor based on C8051F330
Next article:Design of intelligent pneumatic pump control system based on single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号