Application of Single Chip Computer TCP/IP Technology in Intelligent Community System

Publisher:哈哈哈33Latest update time:2018-04-11 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    1 Introduction

    The concept of intelligent residential area (or "smart community") was introduced into China in the 1990s. It is centered on home intelligence, including remote meter reading, home anti-theft alarm, medical assistance, home appliance control and other functions. It adopts system integration methods to establish a comprehensive information interaction system between residents in the community, between residents and the community comprehensive service center, and between residents and the outside society, so as to create a safe, comfortable, convenient and efficient living environment for residents. Most of the current smart community systems are networked with buses such as RS485, CAN bus, LONWORKS, etc., with complex wiring, many conflicts, unstable systems, and fire safety and cost considerations. Ethernet realizes networking, simple wiring, and is cheaper than CAN, LONWOKS, etc., and is more conducive to the compatibility and unification of community intelligent products. In today's situation where computer technology and information technology are constantly developing, as well as people's needs and changes in concepts for home life, the three networks of telephone, television and computer have a trend of integration. In the future, the development of smart communities will definitely be dominated by Ethernet. Therefore, in view of the current development situation and trends of the industry, the research on IP-based Ethernet home smart terminals conforms to the trend of the times and has certain practical significance.

    2. Smart Community System Structure

    The community intelligent system proposed in this paper consists of three main parts: community computer management system, network switching equipment, and home intelligent terminal (CDT). The network structure is shown in Figure 1:

47.jpg
Figure 1 System network structure diagram 

User terminal structure diagram
Figure 2 User terminal structure diagram

    The community management system refers to a computer system installed in the community management center to complete the data collection and processing of user data terminals in the entire community. For systems with a large number of users, a client/server (C/S) structure can be used. The community management system is divided into two parts: a monitoring microcomputer (Client) and a server (Server). The client is only used for data collection, and data processing is performed on the server. The functions of the community management system include: displaying the Internet status of user terminals, receiving and displaying household alarms, reading water, electricity and gas meter data and generating reports, alarm log processing, system management, etc. User data terminal: The user terminal is used to communicate with the management system, complete the collection of various metering signals and alarm signals, answer calls from the host, answer Internet status, and provide an operation panel to welcome user inquiries.

    3. User terminal hardware structure and RTL8019 configuration

    3.1 User terminal structure The hardware structure diagram is shown in Figure 2:

    The system consists of two single-chip microcomputers, one is responsible for collecting the readings of five meters, remote control and security signals, and the other is responsible for driving RTL8019 communication, responding to the keyboard and driving the LCD display. The two MCUs communicate through the serial port.

    3.2 Configuration of RTL8019

    RTL8019 is a highly integrated Ethernet control chip, it has two operation modes: one is jumper mode, the other is jumperless mode, the latter also supports Plug and Play. The jumper mode option is generally used in the microcontroller. The base address of the I/O port is determined by the connection between the microcontroller and 8019, P2.6 = 8019CS, low level is valid, then IO_BASE_ADDRESS = 0xBF00. In addition, 8019 also has 8 IRQ interfaces, IRQ is not used in this system, and the query method is adopted.

    The 8019 has a total of 32 input and output addresses, and the address offset is 00H--1FH (corresponding to BF00H--BF1FH).

    There are 16 addresses from 00H to 0FH, which are register addresses. The registers are divided into 4 pages PAGE0--PAGE3. There are only 3 pages (Page0-Page2) of registers compatible with NE2000. In order to ensure that the driver is valid for all Ne2000 network cards, do not operate the registers on the fourth page.
    There are 8 addresses from 10H to 17H, which are DMA addresses.
    There are 8 addresses from 18H to 1FH, which are soft reset ports. The hardware reset of 8019 is very simple. You only need to output a high level to RSTDRV when powering on. The reset process of 8019 will perform some operations, such as reading 93c46 and initializing internal registers, which takes at least 2 milliseconds. It is recommended to wait for a longer time before operating the network card, such as 100 milliseconds before operating it, to ensure a complete reset.

    When ICS16B=LOW, the 8-bit DMA operation mode is adopted. Only 18 of the above addresses are useful: 00H-0FH, a total of 16 register addresses. 10H DMA address (the 8 addresses from 10H to 17H are the same and can all be used as DMA ports. Just use one of them). 1FH reset address (the 8 addresses from 18H to 1FH are all reset addresses. The function of each address is the same. Just use one of them. But in fact, only the reset ports 18H, 1AH, 1CH, and 1EH are valid. Do not use the others. Some compatible cards do not support reset of odd addresses such as 19H, 1BH, and 1DH).


    4. Simplification of network card driver and TCP/IP protocol stack

    From the programmer's perspective, the operation of 8019 is relatively simple. The driver only needs to write the data to be sent into the chip in a certain format and start the sending command. 8019 will automatically convert the data packet into a physical frame format for transmission on the physical channel. Conversely, after receiving the physical signal, 8019 restores it to data and stores it in the chip RAM in a specified format for the host program to use. In short, 8019 completes the mutual conversion between data packets and electrical signals: data packets <===> electrical signals. The Ethernet protocol is automatically completed by the chip hardware and is transparent to the programmer. The driver has three functions: chip initialization, packet receiving, and packet sending.

 

    4.1 Sending subroutine
bit Transmit(void)
{
CardCopyDown();
XBYTE[IO_BASE_ADDRESS + NIC _COMMAND] = CR_NO_ DMA |CR_STOP|CR_PAGE0; //Stop 8019
XBYTE[IO_BASE_ADDRESS + NIC_INTR_STATUS] = 0xFF; //Mask interrupt
XBYTE[IO_BASE_ADDRESS + NIC_XMIT_START] = XMIT_START; //Set the start address of sending
XBYTE[IO_BASE_ADDRESS + NIC_XMIT_CONFIG] = TCR_NO_LOOPBACK; //Set to general mode
XBYTE[IO_BASE_ADDRESS+NIC_DATA_CONFIG]= DCR_FIFO_8_BYTE|DCR_NORMAL|DCR_BYTE_WIDE; //Set 8-bit DMA mode
XBYTE[IO_BASE_ADDRESS + NIC_XMIT_COUNT_LSB] = 100; //Set the send word length
XBYTE[IO_BASE_ADDRESS + NIC_XMIT_COUNT_MSB] = 0;
XBYTE[IO_BASE_ADDRESS + NIC_COMMAND] = CR_START|CR_XMIT|CR_PAGE0; //Start 8019
return (TRUE);
}

    4.2 Receive subroutine
void Receive(void)
{
XBYTE[IO_BASE_ADDRESS + NIC_COMMAND] = CR_NO_DMA|CR_STOP|CR_PAGE0; //Stop 8019
Wait_xus();
XBYTE[IO_BASE_ADDRESS + NIC_INTR_STATUS] = 0xFF; //Mask interrupt
XBYTE[IO_BASE_ADDRESS+NIC_DATA_CONFIG]= DCR_FIFO_8_BYTE|DCR_NORMAL|DCR_BYTE_WIDE; //Set 8-bit DMA mode
XBYTE[IO_BASE_ADDRESS + NIC_RMT_ADDR_LSB] = 0x00; //Set destination address and length
XBYTE[IO_BASE_ADDRESS + NIC_RMT_ADDR_MSB] = PAGE_START;
XBYTE [IO_BASE_ADDRESS + NIC_RMT_ADDR_MSB] = PAGE_START; + NIC_RMT_COUNT_LSB] = 56; 
XBYTE[IO_BASE_ADDRESS + NIC_RMT_COUNT_MSB] = 0x00;
XBYTE[IO_BASE_ADDRESS + NIC_PAGE_START] = PAGE_START; //Set the receive start address
XBYTE[IO_BASE_ADDRESS + NIC_PAGE_STOP] = PAGE_STOP; //Set the receive buffer length
XBYTE[IO_BASE_ADDRESS + NIC_BOUNDARY] = BOUNDARY; //Set the receive boundary
Wait_xus();
XBYTE[IO_BASE_ADDRESS + NIC_RCV_CONFIG] = RCR_BROADCAST; //Set the receive configuration
}

    4.3 Protocol Streamlining

    The implementation of TCP/IP in a microcontroller is different from that in a PC. A relatively complete TCP/IP protocol can be supported in a PC, but this cannot be done in a microcontroller because the microcontroller does not have enough code space to support these protocols. Generally, the parts related to the needs are implemented in the microcontroller, and the unused protocols are not supported at all. For example, the file sharing SMB protocol is supported in UNIX and Windows , but it is not necessary on the microcontroller. Generally, only protocols such as ARP, IP, ICMP, and TCP/UDP can be implemented in the microcontroller, while higher-level protocols such as HTTP, SMTP, and FTP generally do not need to be supported. Although some microcontrollers, such as the AVR Internet access solution, have implemented these protocols, they are not very practical. Because the TCP/IP protocol used by the microcontroller is mostly for data collection and data transmission, rather than web browsing and file transfer. In addition, due to the limited resources of the microcontroller, it is also possible to simplify a certain protocol. The protocols implemented in this system are only ARP, IP, ICMP, and UDP.

    a. ARP: The MCU only responds to the ARP request from the host, but does not actively send ARP requests.

    b. ICMP: Only one type of ICMP message is implemented, namely the ICMP response message.

    c. IP: The maximum size of an IP packet is 65k. The microcontroller cannot store such a large data packet, so it generally does not support segmentation. It avoids segmentation by sending small data.

    5. Conclusion

    Smart community is the advanced form and mainstream of well-off housing development in the 21st century. Its emergence is the product of the combination of real estate industry and computer, network, communication and control technologies. Ethernet technology based on TCP/IP is the key to promoting the standardization and digitization of smart communities. This paper takes the research of smart community home intelligent terminal system based on TCP/IP technology as an example, describes in detail the driving method of RTL8019 network card chip, and gives a simplified solution of TCP/IP protocol in single chip microcomputer. This system has been successfully used in many communities, and its feasibility, reliability and flexibility have been confirmed. In addition, the low cost and simple wiring of Ethernet-based smart community system make Ethernet technology based on TCP/IP an important means to replace traditional field bus technology.

    References:
1. Yu Yongquan. Embedded systems, smart home appliances and home networks. Microcontrollers and embedded system applications, 2001 (1)
2. Lao Gu. Microcontrollers and TCP/IP networks. Lao Gu Forum, 2002
3. REAL TEK SEMI -CONDUCTOR CO., LTD. RTL8019 data sheet, 2000, 8


Keywords:MCU Reference address:Application of Single Chip Computer TCP/IP Technology in Intelligent Community System

Previous article:The SPWM waveform generation principle and software design points of 80C196MC waveform generator
Next article:Design of portable on-site law enforcement recorder based on SPCA1527A

Recommended ReadingLatest update time:2024-11-16 01:48

STC89C52 MCU - Serial port sending program 2
Fixed the bug in 1 where the string cannot be sent continuously! ! /*-------------------------------------------------   Name: Serial communication fix program 1 can not call string sending continuously BUG   Written by: LZM kaly.liu@163.com /a Date: 2015.05.24   Modification: None   Content: Connect the serial por
[Microcontroller]
What is AVR microcontroller?
What is an AVR microcontroller? What does AVR microcontroller mean?     A single-chip microcomputer is also called a single-chip microcontroller. It integrates a computer system into one chip. In general, one chip becomes a computer. Single-chip microcomputer technology is a branch of computer technology and is the
[Microcontroller]
Explanation of the download method of the microcontroller
For single-chip microcomputer projects, after programming, the hex file must be downloaded to the single-chip microcomputer so that the program can be executed and the corresponding functions can be realized. There are many ways to download single-chip microcomputer programs. Here are some common download methods: ISP
[Microcontroller]
Explanation of the download method of the microcontroller
Key debounce based on single chip microcomputer
Key circuit: Commonly used non-encoded keyboards, each key is a normally open switch circuit. Key debounce : The switch used for the common keys is a mechanical elastic switch. When the mechanical contact is opened or closed, the voltage signal is small as shown in the figure below. Due to the elastic effect
[Microcontroller]
Key debounce based on single chip microcomputer
TaiSilicon Micro releases ultra-low-cost high-voltage MCU chip TCHV4018L
Market Background Intelligence and electrification are the two major directions of the development of the automotive market. The requirements of intelligence have brought new challenges to the entire automotive electronic and electrical architecture. Some isolated control units in the original archi
[Microcontroller]
TaiSilicon Micro releases ultra-low-cost high-voltage MCU chip TCHV4018L
Infrared learning remote control based on stc89c52 microcontroller
  On smart TVs and Internet set-top boxes (TV boxes), the common mainstream remote controls are nothing more than "infrared" and "Bluetooth" remote control methods. "Bluetooth" remote controls have received more and more attention from manufacturers and favored by consumers in recent years due to their characteristics
[Microcontroller]
Features and pin diagram of STC15F104W microcontroller
STC15F104W microcontroller is a single clock/machine cycle (1T) microcontroller produced by STC. It is a new generation of 8051 microcontroller with high speed/high reliability/low power consumption/super anti-interference. It adopts STC's eighth generation encryption technology, super encryption, and instruction code
[Microcontroller]
Features and pin diagram of STC15F104W microcontroller
A collection of microcontroller design experience and skills (VI)
2: Why does C51 need nested assembly?   A significant advantage of the 51 single-chip microcomputer is that the instruction execution time is fixed, so it can adapt to occasions with strict timing requirements. For example, the reading and writing of CPU cards that comply with the ISO7816 protocol have strict timing r
[Analog Electronics]
A collection of microcontroller design experience and skills (VI)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号