“In a tap water production enterprise, some of the water drawn comes from the group of water wells far away from the factory area, and the water intake points are often unattended. In order to realize the monitoring and control of the operation of the water well motor by the on-duty personnel in the central control room, this set was developed for a water supply plant in Jining. Remote monitoring system. The motor of the well group is controlled by Panasonic FPlPLC, and the on-site operation data is collected by the voltage and current transmitter, and the modem is interconnected with the local telephone network. On the computer in the central control room, the duty personnel in the central control room of the water plant can see the running state and voltage and current operating parameters of the water well motor, and can directly control the start and stop of the water well motor.
Author: Liu Jixiu
In a tap water production enterprise, some of the water drawn comes from the group of water wells far away from the factory area, and the water intake points are often unattended. In order to realize the monitoring and control of the operation of the water well motor by the on-duty personnel in the central control room, this set was developed for a water supply plant in Jining. Remote monitoring system. The motor of the well group is controlled by Panasonic FPlPLC, and the on-site operation data is collected by the voltage and current transmitter, and the modem is interconnected with the local telephone network. On the computer in the central control room, the duty personnel in the central control room of the water plant can see the running state and voltage and current operating parameters of the water well motor, and can directly control the start and stop of the water well motor.
2 System hardware configuration and its functions
2.1 Smart Modem
To realize the long-distance communication between PC microcomputer and PLC, each place adopts an intelligent Modem, which is connected through the public telephone network. Fig. 1 shows the structural block diagram of the intelligent Modem.The main difference between an intelligent Modem and an ordinary Modem is its internal configuration.
The CPU is installed, which makes the smart Modem have the following new functions in addition to the modulation and demodulation function:
(1) Automatic dialing and automatic answering function.
(2) Error detection and control functions.
(3) Flow control function.
(4) Speed transformation and coordination function.
(5) Remote control function.
(6) Data compression function, etc.
2.2 System hardware connection and communication principle
Connect each device correctly before communication. Figure 2 shows a schematic diagram of the connection. The picture shows the FPl model with 2 serial ports (the suffix of this model is C). In addition to an RS422 EI that can be used for programming, it also has an RS232, which is a direct communication method through RS232 without an adapter. For other FPl models, must be equipped with a RS422/RS232 converter (ie adapter).
With the support of the communication software, the computer can make the intelligent Modem (1) dial automatically and call the other party, and the other party’s intelligent Modem (2) receives the call signal and can automatically answer/off-hook, thus establishing a connection between the PC and the PLC through the telephone exchange. establish a communication channel. Specifically, the sender PC has the following responsibilities:
①Use AT commands to set the dialing status and dialing mode of the sender’s Modem.
② Under the condition of DTR 2 1 (that is, the sender’s PC is ready), send the phone number to be dialed to the sender Modemo
③ Notify the sender Modem to start automatic dialing.
The sender’s Smart Modem has the following responsibilities:
①Press the telephone number sent by the PC to generate dial pulses and send them to the switch of the telephone network.
②Press the preset waiting time and wait for the other party to answer.
③ When receiving the off-hook response signal of the other party, a CD signal (carrier detection) is generated to inform the sender PC that the response from the other party has been received, indicating that the communication channel is established and communication is possible.
The recipient smart Modem has the following responsibilities:
①When receiving the ringing signal from the switch on the telephone network, set RI=1, indicating that there is a call, and immediately notify the receiver PLC.
② Under the condition of DTR=1 (that is, the receiver PLC is ready), the Modem sends an off-hook response signal (carrier signal) to the telephone network to connect the Modem with the telephone network.
3 Communication parameter settings
3.1 PI. C’s settings
Before communication, it is necessary to set the transmission baud rate and transmission format of PLC. The setting of PLC includes two aspects: soft setting and hard setting. Soft setting is to use handheld programmer or programming tool software FPSOFT to FPl system register No. 412 to 416 are implemented by writing the control word. According to the requirements of the data transmission format of Panasonic PLC products, when the PLC communicates with the computer remotely through the Modem, it should be set as follows: select the RS232 port to communicate with the computer; 1 stop bit odd parity transmission digits are 7 bits With end code, CR, no start bit; transmission rate 9 600b/so If a handheld programmer is used, the following control words are set in the system registers: No, 412, K1; No. 413, K2; No. 4
14, K1. No. 415 is the station number setting register, the maximum is 32, if it is set to K1, it means that the PLC is the first station. If the programming tool software FPSOFT is used, in the system register setting window “No, 412 RS232CSelection” select “Computer Link”, “No. “416RS232CModemConnection” should be marked with “√” before “Enable”, that is, it is selected as Modem enable. After the setting is completed, it must be passed to the FP1 with a program, and the setting can only take effect when the FP1 is powered off.
Hard setting means that there is a baud rate setting switch (in the programming port) on the PLC host, which is divided into two gears. It must be placed at “9600” when communicating with the computer.
3.2 Modem settings
The operating parameters of the Modem are stored in the S register. The functions configured by the intelligent Modem can be preset by the PC with the AT command to the S register. The two modems used for long-distance communication play different roles in the communication process, so their command settings are also different, and they must be set separately before they can communicate.
The modem connected to the computer (ie, Modem (1) in Figure 2) has no special requirements in communication, as long as it is set to the factory default value according to the general settings. Check the Modem manual for this setting, and it is the “ATLJ” command.
The setting of the modem connected to the PLC (ie Modem (2) in Figure 2) is more complicated, and can be set in the following three steps:
(1) First of all, it should be set to “open the automatic response function”, that is, use the AT command to give the register S0 a non-zero value nn, which can be any integer between 1-255, but cannot be 0. ” value also indicates the number of rings detected before the modem goes off-hook to automatically answer a call.
(2) Set n=0 in the DTR (Data Terminal Ready) signal detection control command symbol “AT&Dn”, that is, no detection is performed. The so-called DTR command means that as long as one party issues a command, it can respond, and it is not necessary to detect that both parties have a signal and then respond. In this communication mode, this function must be selected, because the PLC side can only passively accept commands sent by the computer, but cannot actively send signals to the computer, that is, as long as the computer sends a command, Modem (2) will immediately enter the automatic mode. Response status, or issue control commands to PLC, or read data from PLC.
(3) In order to judge whether the dial-up connection is successful, it is also necessary to use the command ATX0 to set the modem to provide the basic call process result code, use the command ATE0 to set the modem to turn off character echo, use ATV0 to set the digital result code to answer, and AT&W to save the settings.
If the setting is successful, the modem should return the result code OK, indicating that the command has been executed. After the two modems are set up respectively, connect them to the computer and the PLC respectively.
4 Panasonic’s proprietary communication protocol
In the communication between FPlPLC and computer, what is adopted is the special communication protocol of Matsushita Electric Co., Ltd., namely “MEWTOCOL-COM” standard protocol. In the communication network with the computer as the master station and the PLC as the slave station, the communication is initiated by the master station, the command frame is sent to the slave station, and the slave station responds with a response frame. MEWTOCOL-COM protocol has made strict regulations on the format of command frame and response frame. Among them: % is the command frame start mark of MEWTOCOL-COM; H, L are the high and low bits of the station address; # is the station number feature code; Send text: composed of command code and data; BCC is the block check code; CR is the return car terminator.
(2) Response frame format
There are two types of response frames: if the command frame of the master station is correct, use “correct”
5 PC communication program development
Generally speaking, it is not difficult to realize the remote communication between PC++ microcomputer and PLC, as long as the PC is equipped with this kind of PLC-specific communication card and communication software and the asynchronous communication software matched with Modem, the communication card is initialized as required, And compile the user program, or buy the configuration software of the professional company for simple development. The only problem with this method is the price. When the PC microcomputer is equipped with the special communication module and special communication software produced by the PLC manufacturer, the price of the PC microcomputer is often increased several times or even dozens of times. Using the computer’s software and hardware resources to develop a personalized monitoring interface, the user program can be written in assembly language or high-level languages such as VB, VC, C/C++ and so on. We use the C language to call the communication function on the level of direct drive hardware, compile the communication program, and directly access the communication hardware, which is the fastest. The communication program adopts a module structure, including an initialization module, a Modem driver module, a check code generation module, a framing module, a sending module, a receiving module and a frame processing module. Some of the modules are connected in sequence, some are connected by the identification of status bits, and some are connected by the identification of special characters (terminators, etc.). Among them, the initialization module consists of the initialization of the computer serial port and the initialization of the Modem control register; when writing the Modem driver, no BCC verification is required, and the command codes sent and received are the AT command codes dedicated to the Modem. Because the whole program is long, it is omitted here.
Using the existing public data network such as the telephone network, appropriate configuration of intelligent Modem in the two places can realize the long-distance communication between the personal computer and the remote PLC (network), but because the speed of the telephone network is too slow, it is not suitable for real-time control requirements. In higher occasions, it is often used in remote fault monitoring system and remote operation of unattended small substation switching operation.
The Links: MCO500-16IO1 SKKT200/18E