In 1985, a candy factory introduced a 116EM production line of metering feeders with microcomputers from SIMON Electronics of Germany for candy production. Due to the long time of introduction, incomplete drawings and materials, and inconvenient maintenance by the foreign party, production was affected by computer control failures from time to time. In order to increase the proportion of domestic equipment, save foreign exchange, facilitate maintenance, and ensure production, this paper, at the request of the factory, developed an embedded microcomputer automatic metering feeding system based on 8031 based on a thorough analysis of the equipment performance and electrical signal timing of the imported equipment. The system is fully matched with the imported equipment in terms of performance requirements, signal timing and appearance size, and successfully realized the localization of the imported equipment control system.
2 Weighing and metering feeding principle of metering feeder
After starting the preset metering feeding program, the metering system first weighs and stores the tare weight of the weighing pot, and then controls various ingredients such as milk, sugar, water, etc. to enter the weighing pot in turn. Dry materials are metered and fed by a vibrating plate, powder materials are metered and fed by a screw feeder, liquid materials are metered and fed by a hydraulic valve, and pastes are fed by a pump. Each ingredient uses two feeding methods, coarse material and fine material, to ensure that the weighing accuracy reaches 98% to 99%. The weight of the material is converted into an electrical signal by the three strain gauges installed on the support frame that suspends the weighing pot. After A/D conversion, it is read into the computer for weight calculation, and after removing the tare weight, it is compared with the set value. The result is used as the basis for controlling material switching or coarse and fine feeding conversion. The weighed mixture is discharged to a heatable storage tank through a valve, stirred, and then pumped into the dissolver to enter the dissolving sugar making process.
3 System Function Requirements
In order to ensure the performance of the original imported device, the metering feed automatic control system is required to have the following functions:
(1) Automatically weigh up to 5 kinds of raw materials in sequence, stir and discharge them at regular intervals;
(2) setting any weighing value within the range of total weight not exceeding 135 kg;
(3) The total amount of the five raw materials used in each shift;
(4) After each weighing cycle, the weighing system will be self-checked and can execute the check command at any time;
(5) Automatic weighing and filling can be paused at any time;
(6) If the filling system of a certain raw material fails, the filling of that raw material can be skipped;
(7) Fault alarm function:
There is no compressed air alarm and the system stops running;
Motor connection failure alarm, the system stops running;
If the contents of the weighing pot exceed 10 kg, the system will stop running;
When the liquid level in the storage tank exceeds the set value, the system stops running;
(8) Display: net weight, gross weight, self-test/inspection value, etc.;
(9) Indication: upper and lower weight limits, system failure, etc.;
(10) Automatic/manual switching;
(11) Printing: Automatic printing in fixed format and printing of single pot or single raw material data.
4 System Hardware Structure
According to the above system functional requirements, through the analysis of the electrical signals of the original device sensors and actuators, and taking into account the installation conditions, the hardware design is based on low cost and localization, and adopts the design scheme of using MCS-51 series single-chip microcomputer 8031 as CPU, connecting A/D, keyboard/display, dial, printer and other interface circuits to form the system.
The whole system consists of a CPU board, A/D conversion board, switch I/O board, display/keyboard, printer interface board, dial input board and power board as shown in Figure 4-1. The six boards are installed in two drawer-type chassis in the form of plug-ins, embedded in the controller part of the original device, and realize electrical connection with the original device
.
The 8031 minimum system consists of an 8031 single-chip microcomputer extended by a 2764EPROM and a 6264RAM through a bus driver. The A/D conversion uses a dual-integral 12-bit A/D conversion chip ICL7109 and corresponding auxiliary chips. ICL7109 has the advantages of high precision, low drift, and strong anti-interference ability. 8279 is used as the keyboard/display interface, and the CPU processes key applications in an interrupt manner. Five groups of four-digit BCD dials are decoded at two levels, and their control end and 8421 digital end are connected to the CPU via 8255. The switch quantity I/O and printer interface are also implemented by 8255. The system embodies the principles of economic effectiveness and domestic base while ensuring functionality.
5 System software design
The system application software adopts the mixed programming, modular and structured design methods of assembly language and BASIC language under the joint development system of DVCC-52 and PC. The whole program consists of system diagnosis module, automatic batching module, A/D and data processing module, over-limit alarm module, button, display, printing module, etc. Each module is relatively independent and complementary to each other, so that sampling, calculation, control, display, parameter setting, etc. are orderly and run in an orderly manner. The requirements of automatic metering feeding are met in terms of weighing accuracy, button response speed, fault alarm capability, etc. The main program block diagram is shown in Figure 5-1.
Among them, the diagnostic subroutines include CPU instruction system diagnosis, RAM diagnosis, EPROM diagnosis, A/D, I/O template diagnosis and sensor signal detection for achieving system fault alarm function.
The main block diagram of the automatic batching subroutine is shown in Figure 5-2. Considering the vibration and inertia of the feeding device, the program compares the weight increment Δg within the time interval Δt between two samplings with the difference e between the set value and the weighing value, and switches between coarse materials, fine materials and materials according to the comparison result to improve the weighing accuracy. And use one unit to count the batching sequence, so that the five kinds of batching can share the same program to achieve the purpose of optimizing the program structure and saving program memory space.
The CPU processes the key request in interrupt mode. In the keyboard interrupt service subroutine, the key is identified and the corresponding bit flag variable is set. Other functional modules control the program direction according to the flag variable status.
6 System reliability design
This system is located in a complex industrial site with much interference. Therefore, in addition to adopting hard measures such as photoelectric isolation, power filtering, shielding grounding and ground wire processing, and using the average value plus median value composite filtering method to overcome the periodic interference and spike interference in signal acquisition, the design also adopts hardware self-diagnosis technology and software anti-interference technology to ensure the weighing control accuracy and reliability of the system.
6.1 Hardware Fault Self-Diagnosis Technology
This system uses a self-diagnosis method that combines power-on self-diagnosis, timed self-diagnosis, and key-controlled self-diagnosis for key hardware devices to detect system failures in a timely manner and ensure accuracy to avoid system operation with problems. Specific diagnostic items include:
(1) CPU instruction system diagnosis The correct execution of the 8031 instruction system is a prerequisite for the normal operation of the system. For this purpose, a test program involving various instructions is designed to determine whether the operation results are correct in order to eliminate the possibility of CPU failure.
(2) RAM diagnosis is to perform write and read operations on the key RAM area in sequence, and compare whether the read and written contents are the same to determine the quality of the internal and external RAM chips. Destructive testing is used when power is on (without protecting the original contents), and non-destructive testing is used for reset and key diagnosis (protecting the original contents).
(3) EPROM diagnosis: When the EPROM of the solidified target program is used for a long time and the window is not well sealed, the information of individual sporadic cells may change, and active inspection is required. This article adopts the "XOR sum" verification method. Before the program is solidified, the development device is used to calculate the XOR sum of all instructions and write the result into the last empty cell. During diagnosis, all instructions, including the XOR sum of the "result", are calculated again. If the sum is zero, it can be considered that the content in the EPROM is correct.
(4) Hardware redundant joint diagnosis technology is used to diagnose A/D, I/O templates, and important parameter sensors.
6.2 Software Anti-interference Technology
When the CPU itself is disturbed and the program counter PC changes its content due to the disturbance, the CPU will not be able to execute the program in a normal state, thus causing confusion and producing the so-called "runaway" phenomenon of the program. For this reason, instruction redundancy, software traps, and pure software watchdog technology are adopted in software to control the flow of the program.
(1) Instruction redundancy When the CPU is disturbed, it will treat the operand as the instruction code and cause confusion. Analysis of the MCS-51 instruction system shows that most of them are single-byte instructions, and the longest one does not exceed 3 bytes. When the program jumps to double-byte and 3-byte instructions, the chance of continued errors is greater, while when it jumps to single-byte instructions, the program will automatically be put on track. Therefore, three empty operation instructions (such as transfer, subroutine call and instructions that are critical to the system working status) are inserted before the instructions that determine the program flow in the program, and the jump instruction is redundant once to ensure that it is executed correctly. Instruction redundancy technology can reduce the number of jumps and quickly put the program on track.
(2) Software trap When the program bounces to a non-program area (EPROM unused area, data area, etc.), redundant instructions will be powerless. For this purpose, a software trap is designed, that is, inserting three instructions NOP NOP LJMP at the program breakpoint (after the unconditional jump instruction and return instruction) and at the end of the data area. Fill the blank area with LJMP instructions and force the captured program to the entry of the error handling program. The main function of the error handling program is to achieve system recovery. Since the operation code of the LJMP instruction is 02H, if the entry of the error handling program is arranged at 0202H, the Debug function in the development system can be used to easily solidify a large area of the program blank area into 020202..., so that a large number of traps are processed.
(3) Pure software watchdog If the instruction is bounced in the program area, but an infinite loop is formed before encountering redundant instructions, the instruction redundancy and software trap will be invalid. For this reason, this system uses the idle timer T2 to design a program operation monitoring system (Watchdog); T2 is set to a high priority, and the timing constant of T2 and the count value of the counter are determined according to the main control program cycle. Each interruption adds 1 to the counter, and if the count value is greater than the set value, it will jump to the error handling program entry. At the same time, the counter is cleared in the main program. In this way, it is guaranteed that the program can be released from the infinite loop in time.
7 Conclusion
In this paper, combined with the actual situation of the factory, an automatic metering feed control system was designed using the economical 8031 and peripheral chips, replacing the control device of the original imported equipment. After several years of operation, it has been proved that the system has complete functions, stable and reliable operation, simple operation, and high performance-price ratio. This technology has extended the service life of the equipment and created good economic benefits. It is a useful attempt to localize imported equipment and automate traditional equipment, and has positive significance in promoting the localization and automation of the food and beverage industry.
Previous article:Design of CCD drive circuit based on high-speed ultra-micro C8051F300 single-chip microcomputer
Next article:Automatic gear shifting system for locomotive based on 8031 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
- R&D Management
- [Raspberry Pi Pico Review] Power-on initial test
- Free application: Qinheng RISC-V core BLE 5.3 wireless MCU CH582
- Electronic design from scratch
- Is this a filter circuit?
- Rohde & Schwarz JD flagship store is officially launched!
- Design of Universal Asynchronous Receiver and Transmitter Using VHDL
- [AT-START-F425 Review] Unboxing Review
- How difficult is it for Chang'e 5 to "skip in space" and re-enter the atmosphere?
- SHDSL Wired Analog Front-end Design