Only the flowmeter hardware system consists of AT89S52 core system, turbine flow sensor, flow sensor, signal processing circuit, quantitative control circuit, alarm circuit, RS485 communication circuit, data storage circuit, key circuit, liquid crystal display circuit and power supply circuit of the ten modules.
AT89S52 core system, single chip microcomputer is the core control unit of intelligent flowmeter, which has an important influence on the performance of the control system and the overall design layout.
Analysis of demand can be aware that the main function of the system is traffic measurement and RS485 communication. The system uses a turbine flowmeter for three wire pulse output, and therefore requires a single-chip microcomputer to facilitate the measurement of pulse signals, and RS485 communication interface is required to have a microcontroller serial communication interface. Comprehensive consideration of the intelligent flow meter using AT89S52 microcontroller as the core of the system control. AT89S52 has the following features: compatible with MCS-51 microcontroller 8K bytes programmable Flash memory, fully static operation 0HZ-33MHZ, 32 programmable I/O lines three 16 bit timer / counters, 8 interrupt sources, full duplex serial port UART.
Taking into account the stability of the system, AT89S52 includes 8 4 bit programmable parallel I/O port lines, because the system does not use external bus expansion, P0 and P2 as the general I/O port use. As the PO port open drain output, as the normal I/O port can not be normal output high, so you need to pull the resistance, here to choose the typical value of 10K. System I/O resource allocation is as follows:
PO port for the keyboard of the scanning signal line: P1 port as the liquid crystal data fracture; P2.0.P2.1.P2.2 as a liquid crystal control signal line RW, E, RS; P2.3.P2.4 as SDA EEPROM, SCI. The control signal line: P2.5 control signals for the quantitative control of electromagnetic valve; P2.6, P2.7 as the alarm lights and alarm bell control port; P3.0 and P3.1 to make its second functions as a serial port transceiver port, P3.2 for general IO port, as RS485 transceiver, enable the control terminal; P3.3 uses second functions. As an external interrupt, the pulse signal receiving turbine flowmeter.