Practical eight-channel level measuring instrument based on 89C52 single chip microcomputer

Publisher:咖啡小熊Latest update time:2011-12-24 Keywords:89C52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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).

Keywords:89C52 Reference address:Practical eight-channel level measuring instrument based on 89C52 single chip microcomputer

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

Interface and programming of 89C52 and HD7279A
HD7279A is controlled by 89C52 microcontroller, which completes the display of 7-digit numbers, the driving of 6 light-emitting diodes and the encoding of 12 key actions. The CS, CLK, DATE and KEY pins of HD7279A chip are connected to the PO_O, PO_1, P0_2 and P3_3 pins of the microcontroller respectively. The digital
[Microcontroller]
Interface and programming of 89C52 and HD7279A
Design and application research of power carrier module based on 89C52/C51 series microcontroller
PowerLine CarrierWave (PLCW) communication is a communication method that uses power lines to transmit information. Power carrier communication is widely used in the automatic collection and transmission of remote three-meter (water meter, electricity meter, gas meter) information, and is favored in the construction o
[Microcontroller]
Design and application research of power carrier module based on 89C52/C51 series microcontroller
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号