1. Overall composition
The signal sampling of this measuring instrument can accept eight standard TTL levels after shaping through the eight input lines of the P0 port, so it can measure the pulse type level sampling signals from different sensors, as long as the original signal is shaped, each pulse is captured by the P0 port and the pulse count can be increased by one through software programming, and the count and timing reading can be converted into the corresponding level. The eight-digit digital tube display drive can be completed by connecting the three lines P3.3~P3.5 with the serial display driver Max7219 and programming the software, and the four lines P1.3~P1.6 are used to connect four buttons to complete the button operation, and the P2 port is used as an eight-way output control to drive eight-way solid-state relays.
2. Hardware circuit design
2.1 Resource Allocation
The AT89C52 chip is a highly integrated 8-bit microcontroller based on the MCS-51 structure. Its main features are an enhanced serial port for multi-processor communication and an up/down timer counter, which is specially suitable for control applications. Another important reason for choosing 89C52 is that 256 bytes of RAM are implemented on the chip. The address of the high-end 128 bytes is the same as the address of the special function register (SFR), but can be distinguished by different addressing methods. Therefore, the RAM space used for software programming of the measuring instrument is solved, and there is no need to expand the random access memory separately, saving hardware resources.
2.2 Serial Display Design
When multiple LEDs are displayed, the segment selection lines of all the digits are often connected in parallel and controlled by an 8-bit I/O port. A parallel expansion port can also be used to form a display circuit. Usually, more device pins are required for expansion, and the price is higher. In this measuring instrument, in order to save I/O port resources, a serial display method composed of the Max7219 chip is used. Max7219 is a serial input and output common cathode display driver circuit. It can be directly interfaced with the three I/O lines of the microcontroller. It is particularly suitable for systems with few I/O port lines, and the brightness of the digital tube can be controlled by program. In this design, the three lines P3.3~P3.4 are connected to Max7219 after being latched by 74LS273. After being latched, P3.3 and P3.4 are used as the 7219 serial data input signal DIN and clock signal CLK respectively, and the P3.5 output port is latched as the LOAD signal.
2.3 Design of Software Counter
In the level measuring instrument, when the signal sent by the sensor is a pulse quantity, it is usually necessary to complete the pulse counting through a special counter chip such as 8254. The CPU processes the changing counting signal to make the number of pulses sent by the sensor correspond to the level signal. In this design, the P0 port resources of 89C52 are cleverly used, and the pulse quantity is directly sent to the 8 data lines of the P0 port after shaping. At this time, the P0 port is used as a data input port. Through software design, each channel opens a storage unit (using the on-chip RAM). When the P0 port has a level jump, the corresponding counting unit counts plus 1. The timer is set by software. When the timing time is up, the storage unit value is read and cleared. In this way, the function of the software counter is completed, saving hardware resources and reducing hardware costs.
3. Software Design
3.1 128 Bytes Memory Allocation
Another major feature of the design of this measuring instrument is that it makes full use of the 128-byte on-chip RAM, without external expansion memory chips. The internal address of the CPU is counted from 15H to 0C5H, all of which are used as flags or storage units. The specific allocation is: 15H~1CH is the sampling time of each channel, 09H~0FH is various flags, 42H~5BH is the counting storage processing unit related to each channel count, 5CH~63H is the counting storage unit corresponding to the level alarm domain value, 64H~6FH and 3cH~3FH are storage units such as alarm categories. Through reasonable allocation, although there is only 128 bytes of RAM, it can meet the data processing requirements of 8-channel level measurement.
3.2 Serial Display Subroutine
The display part program driven by Max7219 is placed in the DISP display subroutine. When the program starts, the initialization of Max7219 is completed, and the data to be displayed each time is placed in the display buffer address starting from 20H~27H. When each channel needs to be displayed, the display subroutine can be directly called.
4. Conclusion
The innovation of this design is that it makes full use of the hardware resources of AT89C52 and realizes the software counter. It can display the level signal reflected by the pulse signal through the digital tube. The display part uses the Max7219 display driver, combined with software programming, which greatly saves hardware resources, reduces the general single-chip expansion chip, and reduces the cost. After the instrument is put into production, the cost of direct hardware cost per unit is about 300 yuan compared with the system composed of other methods. After production, it will generate an annual economic benefit of about 600,000 yuan (based on a profit of 8,000 yuan per set of instruments).
Previous article:LED display screen control system based on 51 single chip microcomputer IAP technology
Next article:Design of high-precision water level monitoring instrument based on single-chip microcomputer
Recommended ReadingLatest update time:2024-11-16 15:49
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
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
- TouchGFX design——by supermiao123
- EEWORLD University Hall----Overview of THS6222 Broadband PLC Line Driver
- Optimization and Implementation Method of Task Scheduling in μC/OS
- Does anyone know what model this monster is?
- MSP430 MCU Development Record (6)
- Using ESP's rtc memory in mpy
- Linux serial communication 1——96-N-8-1 format
- [STM32WB55 Review] Summary
- I need help with the simplest program to control 12864 with keys
- TUSB9261 -- USB3.0 to SATA interface bridge chip programming guide