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.
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.
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)
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)
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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- LIS2HH12 MEMS Digital Output Motion Sensor Datasheet
- The problem of not being able to sample the AD value using the official ADC routine based on the BlueNRG-LP chip
- [RVB2601 Creative Application Development] Environmental Monitoring Terminal 06-Synchronize Data to Alibaba Cloud
- One question per week, relax and broaden your mind
- Crowdfunding 3,000 yuan to buy batteries for needle penetration tests, BYD VS CATL technology game
- [Evaluation of EC-01F-Kit, the NB-IoT development board of Anxinke] + Alibaba Cloud connection to upload light illumination data
- Operate the lmx2582 registers through stm32, the project file is in the attachment
- 【ESP32-S2-Kaluga-1 Review】2. Update the firmware
- Speed sensor
- How to use Labview to perform secondary development on Ginkgo 2