Current location - Education and Training Encyclopedia - Graduation thesis - Intelligent sensor paper
Intelligent sensor paper
This paper introduces the architecture of embedded WEB sensor, puts forward several implementation methods of TCP/IP protocol stack in network interface, and focuses on the implementation of network interface based on TCP/IP protocol stack chip W3 100A. Finally, the realization of WEB function of embedded WEB sensor is analyzed.

Keywords: embedded network sensor network interface

Embedded WEB sensor is a new type of sensor with internet function developed on the basis of intelligent sensor. Its essence is to realize TCP/IP network communication protocol interface on the basis of traditional sensors, and use sensors as network nodes to communicate directly with computer networks. It is mainly composed of sensitive unit, intelligent processing unit and TCP/IP communication protocol interface.

Figure 1 shows the architecture of embedded WEB sensor. Traditional sensors only account for a part of embedded WEB sensors. The core part is the embedded intelligent unit for signal processing, data exchange and control and the TCP/IP network interface for data transmission. The working mechanism of the whole sensor is as follows: the sensor converts the measured physical quantity into an electrical signal, which is converted into a digital signal through A/D, and the data is processed (filtered and calibrated) by the microprocessor and then the result is transmitted to the network; The network interface module based on TCP/IP protocol completes data exchange with the network. The memory of embedded WEB sensor stores the physical characteristics of the sensor, such as offset, sensitivity, calibration parameters, etc. Microprocessor realizes data processing and compensation and output calibration; TCP/IP protocol realizes the direct network connection of sensors. Compared with the traditional sensor, the embedded WEB sensor based on the Internet has higher reliability, lower cost and stronger expansibility. It can directly process and process the original data internally and exchange data with the outside world through the Internet. Therefore, it has miniaturization, networking and intelligence. The network interface of the sensor realizes the interconnection with the Internet or Ethernet, and realizes information release and resource sharing. Its implementation is the focus of embedded WEB sensor research.

The key to the realization of network interface lies in the realization of TCP/IP communication protocol. The realization methods of TCP/IP communication protocol mainly include: porting TCP/IP protocol stack to embedded system, and then calling related API functions to realize network communication; Instead of transplanting, refer to the standard TCP/IP protocol, simplify the corresponding protocol layer, write relevant API functions, and complete simple TCP/IP communication; This method uses a protocol chip, such as W3 100A chip, to realize TCP/IP protocol directly through hardware, and directly set the register of the chip to realize data transmission to the network. This paper focuses on the realization of embedded WEB sensor network interface using W3 100A chip.

Implementation of 1 network interface

1. 1W3 100a chip and its processor access implementation.

W3 100A is a TCP/IP protocol stack chip, including various protocol layers: data link DLC of TCP, IP, UDP, ICMP and Ethernet protocol, and MAC protocol. It works in a similar way to the Socket API of Windows. The internal structure of the chip is shown in Figure 2.

The chip optionally supports Intel/Motorola MCU interface, and also provides I2C interface for the upper application layer and MII interface for the lower physical layer. The chip supports full duplex mode and has a dual-port SRAM data buffer inside. It is available in a 64-lead LQFP package.

The chip provides registers for MCU to access. The specific registers are classified as follows: control registers (command, status and interrupt); System registration (gateway address, subnet mask, IP address, etc.). ); A pointer register for receiving and sending data; Channel register for channel operation.

Several important registers are shown in table 1.

Table 1 register function and address map

Register name address type function

C0 _ Cr ~ C3 _ Cr 0x00 ~ 0x03 control registers complete initialization, connection, closing and data transceiver of corresponding channel sockets.

Results of C0 _ ISR ~ C3 _ ISR 0x04 ~ 0x07 control register socket command

IR 0X08 controls the socket and data reception interrupt of each channel in the register.

The IMR 00X09 control register controls the mask enable of each interrupt.

Gar0x80 ~ 0x83 system registers are used to set the default gateway address.

SIPR 0x8e ~ 0x9 1 system control register, used for IP address setting.

RW_PR has 3 bytes per register. See W3 100A for the specific address. The pointer register in the data manual receives the tail pointer of the data, and the tail pointer is automatically adjusted according to the data size.

RR_PR pointer register receives the first pointer of data.

TW_PR pointer register transfers the tail pointer of data.

The TR_PR pointer register transfers the current data pointer of the data.

The TA_PR pointer register indicates the first pointer to send data.

SSR C0:0xa 0; C 1:0XB8

C2:0xd 0; Socket status of corresponding channel in C3: 0XEB channel register

SOPR C0:0xa 1; C 1:0XB9

C2:0xd 1; Protocol selection of corresponding channel in C3: 0XE9 channel register

The control register C0 _ Cr (the command register of channel 0) is used for initialization, connection, closing and data transceiving of the socket of channel 0, and its settings are as follows:

Sys_init is used to set the gateway, subnet mask and IP address, 1 ~ 6 bits are used for initialization, connection, disconnection, monitoring and data transceiver of channel 0 socket, and the corresponding bits are automatically cleared after the command is executed. Set the corresponding protocol value through the socket protocol selection register C0 _ s0pr to determine whether TCP or UDP is selected in the socket.

The chip must be initialized when it works normally. Initialization is mainly to set necessary registers, including: gateway address register GAR, subnet mask register SMR, hardware address register SHAR and IP address register SIPR. After setting the above registers, the chip is activated by executing the 0-bit Sys_init of the control register CR.

1.2 hardware interface and its data transmission

Fig. 3 schematic diagram of I2C interface

The chip provides parallel port and serial port to realize communication with single chip microcomputer. Figure 3 shows the I2C-based serial port connection mode. Among them, MCU is used as the processor in the sensor, and RTL820 1 chip is used as the Ethernet physical layer device. W3 100A provides MII interface connection RTL820 1, in which pins RX _ CLK, RXDV, RXD[0:3] and COL are used for receiving data, and TX _ CLK, TXE and TXD[0:3] are used for sending data. MCU provides analog I2C interface and communicates with W3 100A. I2C is a serial communication bus mode, and communication is completed by data line SDA and clock line SCL.

The specific process of establishing TCP connection is shown in Figure 4. Firstly, the TCP/IP initialization of the chip is completed, and the protocol selection register C0 _ SOPR of corresponding channels such as channel 0 is set to 0x001; Select TCP protocol, execute Socket_Init in channel 0 command register C0 _ Cr, and set C0 _ TW _ PR, C0 _ TR _ PR and C0 _ TA _ PR to the same value; Then the connection of C0 _ Cr and the listening command bit are executed, and the TCP connection is established.

Realization of embedded WEB sensor WEB function and its application in measurement and control system

The work of the WEB is based on the client/server model, which consists of a WEB browser and a WEB server (that is, a sensor), and they communicate with each other by using the HTTP protocol. Therefore, the upper layer protocol of sensor should adopt HTTP protocol. At the same time, in order to realize the interaction between the browser and the embedded WEB sensor, in addition to solving the above TCP/IP communication protocol interface, an EEPROM should be provided in the sensor to store the corresponding web files. When interacting, HTTP determines what resources the sensor should provide for the browser through the Uniform Resource Locator URL. In order to save space, flexible Hush algorithm is adopted. Each file in EEPROM has a different Hush value corresponding to it, and the address of the file can be quickly calculated when accessing it. In addition, it can also realize dynamic web pages according to special symbols embedded in web pages. That is, the data collected in real time is displayed and controlled.

The following is a simple dynamic webpage program stored in the temperature sensor, in which the "@" character is used to insert the temperature mark in the webpage, and the webpage file is stored in the EEPROM of the sensor. When a user sends a page request, the program on the processor embeds the temperature value into the "@" character in the webpage during TCP encapsulation, and then adds the corresponding HTTP header to the webpage file and returns it to the requesting user. In this way, the user will see the actual temperature display value on the browser.

< HTML >

< HEAD >

< title > real-time temperature monitoring

< center > current temperature is: < font size =+2 color = # ff99ff > @

< BR >

As shown in Figure 5, the embedded WEB sensor and the Ethernet measurement and control gateway will be connected to Ethernet at the same time to realize the access of the upper network terminal client. The upper monitoring level uses B/S mode to access the embedded WEB sensor, and the monitoring level accesses the embedded WEB sensor through the browser.

The network interface scheme proposed in this paper is to realize TCP/IP protocol stack by hardware chip, which can solve the problem that a large number of 8-bit single-chip computers realize TCP/IP communication protocol in current application. The application of networked interface to embedded WEB sensor can well realize the access of field-level equipment to external network, realize the sharing and publishing of information, and expand the control radius. The networked interface is easy to realize, universal and widely used.

Recommended:

Paper through train:/

There are many free papers in it. This is what I found when I searched the sensor: /search.asp? Word= sensor &; m= 1。 ChannelID = 0 & amppage= 1

I hope it helps you.