“With the continuous development of communication technology, computer network system communication is an important direction of today’s technology development. However, using the existing telephone network as a communication channel in a network system is the most economical, convenient and reliable method. At present, the modern telephone communication network has entered the era of program-controlled switching. The technology is relatively advanced, the speed is fast, and the capacity is large. Therefore, the use of the telephone communication network to establish a data communication system does have its unique advantages.
“
Authors: Jiang Bing, Zhang Xuewu
1 Introduction
With the continuous development of communication technology, computer network system communication is an important direction of today’s technology development. However, using the existing telephone network as a communication channel in a network system is the most economical, convenient and reliable method. At present, the modern telephone communication network has entered the era of program-controlled switching. The technology is relatively advanced, the speed is fast, and the capacity is large. Therefore, the use of the telephone communication network to establish a data communication system does have its unique advantages.
It is of practical significance to use the single chip microcomputer system to collect the water level and water flow in the irrigation area, and to achieve unattended and scientific management of water resources, especially in areas with little rain and water shortages.
2. System hardware design
The system adopts MODEM to remotely transmit the data collected by the front-end single-chip microcomputer to the central station PC through the telephone network, and realizes one-to-multipoint communication (the number of sites and communication distance are not limited). Receive data and store records, query and print in real time. The system block diagram is shown in Figure 1.
The single-chip microcomputer system directly collects digital signals from sensors (including digital encoders), and sends them to the local MODEM through the RS232 interface. The MODEM modulates the digital signals into audio analog signals and transmits them on the telephone line, and then modulates them into digital signals through the central station MODEM and sends them to the MODEM. PC machine. The MODEM in the system adopts the external Hayes144 type, and the user uses Hayes standard AT commands to call and answer to realize the communication with the remote system.
The hardware design key of the above-mentioned one-chip computer system lies in: (1) the interface of one-chip computer 89C51 and asynchronous transceiver 8250, 8250 has the ability to interface with MODEM and control serial communication. 8250 input and output are TTL level, according to EIA (International Electronics Industry Association) RS232 standard, using serial transceiver driver chip ICL232 or MAX232 for level conversion and driving. (2) SRAM selection and connection, static RAM saves time-marked data, choose DS1216D produced by Dallas company, with battery and real-time calendar clock function, built-in RAM is 628128, capacity is 128K, the chip is automatically saved when power off data and clock running. (3) For the connection of MODEM, the 9-core interface socket is used to complete the connection of each signal. The specific Circuit principle is shown in Figure 2.
3. System software design
The front-end computer software of the system is designed by MCS51 assembler, the back-end computer software is designed by VB5.0 program (briefly), and the main program block diagram of the communication software of the front-end single-chip microcomputer system is shown in Figure 3.
3.1 AT commands in MODEM communication
MODEM using AT command can be divided into three stages: initialization, call and answer, disconnect the chain and hang up.
MODEM initialization mainly includes: setting the number of rings, setting the return result code form and resetting the MODEM, for example:
ATS0=3V0′ 3 rings, the result code is numeric;
ATZ’ reset MODEM;
The first sentence of the above command can be solidified in the non-volatile RAM in the MODEM by using the WINDOWS 95 HyperTerminal programming, or it can be placed in the 8250 initialization program together with the ATZ.
MODEM has the function of automatic calling and answering. In the switched telephone network, MODEMs communicate with each other like ordinary telephones. As long as the calling party issues a dialing command: ATDT6688787 (numbers indicate telephone numbers), a communication link can be formed. This command is used in In the programming of PC communication software.
After the communication is completed, the two MODEMs need to disconnect the chain and hang up. In the programming of the PC communication software, the following AT commands are used to complete the hang up:
+ + + ‘ escape sequence
Delay 1 second’1s silence
ATH0 ‘ hang up
3.28250 initialization
The 8250 initialization mainly includes four items: (1) Setting the baud rate, setting the numbers to the two registers whose addresses are 3F8H and 3F9H, this system adopts 2400bps; (2) Setting the character code transmission format parameters for the line control register, namely: Data bits, parity bits, stop bits; (3) Initialize the MODEM control register, that is, control the sending of signals to the other party and manage interrupts; (4) The initialization of the interrupt enable register is used to determine the preparation of the received data When good, whether to send an interrupt when the sending holding register is empty, when the received character is wrong, and when the MODEM state changes.
3.3 Data Communication
When a party’s microcontroller receives the call ringing, the RI signal is valid, the INTRPT pin of 8250 is interrupted at a high level, and the system enters the data communication state. In order to make the data transmission accurate, the programming uses the XMODEM protocol to package the data. The flow chart of the communication program is shown in Figure 4.
Data sending flow chart
subject to flow chart
Figure 4 Flowchart of the data communication program of the single-chip microcomputer
4 Conclusion
This paper introduces the design ideas of software and hardware in detail on the telephone remote communication between multi-point single-chip microcomputer and PC. Because the system adopts the ordinary telephone network as the communication channel, one network can be used for multiple purposes, which is very economical. And the background PC uses VB5.0 to develop communication and data management system software which is convenient, visual, easy to operate and reliable.
The Links: DMF-50174NFL-SFW-11 LQ065Y5DG02