Single chip microcomputer and PC telephone remote communication system
[Copy link]
1. Introduction With the continuous development of communication technology, computer network system communication is an important direction of current technological development. However, using the existing telephone network as a communication channel in the network system is the most economical, convenient and reliable method. The current modern telephone communication network has entered the era of program-controlled switching, with relatively advanced technology, fast speed and large capacity. Therefore, using the telephone communication network to establish a data communication system does have its unique advantages. Using a single-chip microcomputer system to collect water levels and water flows in irrigation areas and realize unattended and scientific management of water resources has practical significance, especially in areas with little rainfall and water shortage. 2. System hardware design This system uses MODEM to transmit the data collected by the front-end single-chip computer to the central station PC through the telephone network, and realize one-to-many communication (the number of sites and communication distance are not limited). The back-end PC receives data from each site through dial-up and stores, records, queries and prints data in real time. The system block diagram is shown in Figure 1. Figure 1 System Block Diagram | 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. The MODEM at the central station modulates the digital signals into digital signals and sends them to the PC. The MODEM in the system uses an external Hayes 144 model. Users use Hayes standard AT commands to call and answer to achieve communication with the remote system. The key to the hardware design of the above-mentioned single-chip microcomputer system lies in: (1) The interface between the single-chip microcomputer 89C51 and the asynchronous transceiver 8250. The 8250 has the ability to interface with the MODEM and control serial communication. The input and output of the 8250 are both TTL levels. According to the EIA (International Electronic Industry Cooperation Association) RS232 standard, the serial transceiver driver chip ICL232 or MAX232 is used for level conversion and driving. (2) The selection and connection of SRAM. The static RAM stores the data with time stamps. The DS1216D produced by DALLAS is selected. It has a battery and a real-time calendar clock function. The built-in RAM is 628128 and the capacity is 128K. The chip automatically saves data and clock operation when the power is off. (3) The connection of the MODEM uses a 9-pin interface socket to complete the connection of each signal. The specific circuit principle is shown in Figure 2. | Figure 2 Schematic diagram of single-chip microcomputer system | 3. System software design The foreground computer software of this system is designed by MCS51 assembler program, and the background computer software is designed by VB5.0 program (briefly described). The main program flowchart of the foreground microcontroller system communication software is shown in Figure 3. | Figure 3 MCU system program flow chart | 3.1 AT commands in MODEM communication The AT commands used by MODEM can be divided into three stages: initialization, calling and answering, and disconnecting the link and hanging up. MODEM initialization mainly includes: setting the number of ring times, setting the return result code format 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 programmed into the non-volatile RAM of the MODEM using the WINDOWS 95 HyperTerminal, or it can be placed together with ATZ in the 8250 initialization program. MODEM has the function of automatic calling and answering. In the telephone exchange network, MODEMs communicate with each other like ordinary telephones. As long as the caller issues a dialing command: ATDT6688787 (the numbers represent the telephone number), a communication link can be formed. This command is used in the programming of PC communication software. After the communication is completed, the MODEMs of both parties need to disconnect the link and hang up. The following AT commands are used in the programming of the PC communication software to complete the hang up: + + + 'Escape sequence Delay 1 second 1s silence ATH0 'Hang Up 3.2 8250 Initialization The initialization of 8250 mainly includes four items: (1) Setting the baud rate, setting the values in the two registers with addresses 3F8H and 3F9H. This system uses 2400bps; (2) Setting the character code transmission format parameters for the line control register, namely: data bit, parity bit, and stop bit; (3) Initializing the MODEM control register, namely controlling the signal sent to the other party and managing interrupts; (4) Initializing the interrupt enable register, which is used to decide whether to send an interrupt when the received data is ready, when the send holding register is empty, when the received character is wrong, or when the MODEM status changes. 3.3 Data Communication When one of the microcontrollers receives the call ring, 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 ensure accurate data transmission, the XMODEM protocol is used to package the data. The flow chart of the microcontroller data communication program is shown in Figure 4. | Data sending flow chart | | Flowchart | Figure 4 MCU data communication program flow chart | 4 Conclusion
This paper introduces the software and hardware design ideas in detail for the telephone remote communication between multi-point single-chip microcomputer and PC. Since the system uses the ordinary telephone network as the communication channel, it can achieve multiple uses with one network, which is very economical. In addition, the communication and data management system software developed by the background PC using VB5.0 is convenient, visual, easy to operate and reliable.
|