At present, the hardware cost in the field of industrial control is on the high side, the professional level of operators is demanding, and collaborative management is difficult. In this paper, the Ethernet interface is added to the motion controller to simplify the input of the control program, reduce the cost of hardware, and realize the remote display of control information, so as to reduce the maintenance cost.
With the rapid development of automation control technology, industrial control bus based on Ethernet has been widely used, which has brought great benefits to industrial production. However, the mainstream field control bus has higher cost and higher requirements for maintenance and user technology, which makes some small and medium-sized factories unable to enjoy the technological progress zone. The dividend of W5500, an integrated Ethernet chip based on embedded system, came into being at the historic moment.
With the development of related technology industry, the motion control system based on Ethernet has become diversified and has broad application prospects and potential economic value. Based on this, it is very meaningful to study the embedded Ethernet interface which is convenient, adaptable, stable signal transmission and low cost. Embedded Ethernet interface used to adopt soft protocol stack, which would occupy a large amount of CPU resources, resulting in higher transmission delay, fewer client connections and easy to drop off. In this case, a hardware protocol stack-based Ethernet communication interface is needed to meet the stable and high-speed transmission of control signals. W5500 is an embedded Ethernet controller based on all hardware TCP/IP protocol stack.
It can make the embedded system connect to the network easily through SPI (serial peripheral interface). By using W5500, users can realize the application of Ethernet by using a simple socket program instead of dealing with a complex one.
Taiwanese controller. The main control chip uses STM32F103VCT6 processor based on ARM-CortexM3 core of Italian Semiconductor Company as the core of the system. The peripheral devices include SPI2332 and W5500 with a TFT LCD screen with capacitive touch input. The communication interface of this controller adopts W5500 scheme, which integrates hardware TCP/IP protocol stack, MAC layer and PHY layer into a chip, greatly simplifies hardware design, communicates with MCU through SPI communication protocol, and has low requirement for CPU performance and saves I/O resources of embedded processor (Figure 1). Since the TCP/IP stack has been implemented in W5500, the MCU only needs to configure and read the register data. The program block diagram is shown in Figure 2. The server is developed on Vc 6.0 platform. It uses MFC and socket socket programming. The version of Socket is 2.
0. The communication protocol used is TCP/IP protocol. In order to meet the requirements of multi-client connection, the server adopts a multi-threaded programming scheme, that is, it can simultaneously respond to multi-client link request events and data reading events [1].
Start the server, initialize it first, set the listening port (the port number of the listening is 6000) and bind the computer, and open a thread to wait for the client to connect after it is correct. When a client connection is successful, the server immediately opens a new thread to wait for the next client connection. When the client disconnects, the corresponding thread will end.
This allows the server to respond to multiple client connections. It is not only the PC side that uploads data to the server, but also the client that uploads data to the server to run the device. How to distinguish and store these data is obviously a top problem. The method used here is to give the data a “ID number” ID, and the data sent by each device has a unique ID, so that the data can be recognized on any device. Specific practices are described later. After receiving the data, the server uses the left () function to extract the first two places for “identification” and then stores them in the corresponding array, thus completing the differential storage of the data. Data forwarding is the most important function of the server. The server receives the data from the PC and forwards it to the lower computer. The server receives the receipt from the lower computer and then forwards it to the lower PC.
Receive (): Used to receive data [2]. The PC terminal is the control terminal of the server. The development platform and technical support are the same as those of the above servers, which are not introduced here. The function of PC is to transfer control data to the downstream computer by connecting the server. There are five areas in the operation interface. There are three operation areas, one and two are instruction and data input areas, a total of 10 groups. Each group of instructions is the same, a total of six, respectively: displacement, time, speed, input, output, scan and jump; each instruction corresponds to a unique ID, see Table 1, default to empty. Each data is four bits, and a data block is formed with the instruction ID in front, and the instruction ID is in front and the data is in the back. At the time of transmission, thermostatic element each data block is connected in sequence to form a data link. The number of data blocks is placed at the beginning of the data link, together with the frame head and end which can be recognized by other devices, to form a data packet. A: frame tail. The third operation area is the control area, which implements the connection of servers and related operations.
There are two other areas: the left area shows the running status of the software, and the right area shows the running data of the client equipment returned by the server. The “Connect” and “Upload” buttons on the operation interface perform the functions of connecting the server and uploading data to the server respectively. Cloud server adopts Ali cloud scheme and Windows Server operating system. Enter the Aliyun homepage, select the cloud server ECS in the flexible computing, click on the purchase immediately and select the server configuration. Because the controller does not need to do large-scale operations, so choose the cheapest simplified t1, and choose the server address as the cheapest Qingdao area. Because the simplified T1 server has only 1 strong E5 CPU and 1GB. Memory, so choose 32-bit Windows Server 2008 Standard Version SP2 32-bit Chinese version in the operating system options, and the system will be installed automatically after purchase. After the installation of the server system is completed, click on the connection management terminal in the details of the example. After entering the password, the cloud server can be operated. Firstly, in order to operate conveniently in the future, common shortcuts such as computers and user files are added to the desktop in personalization. Then, in order that the program can not run because of the small memory, right-click on the computing shortcut, click on the advanced system settings, select the performance-advanced-virtual memory, and use the C disk as the managed system, and then, for convenience. Transfer the debugging program to the server system, download and install Baidu cloud in the server system, so far, the server system is basically built. The motion controller with W5500 as the Ethernet interface is connected to the cloud server stably, the data transmission delay is low, and the data transmission of the PC client is smooth, so the working condition of the motion controller can be observed in time.