AVR microcontroller based Remote Control System
With the increasing popularity of the Internet, all kinds of appliances, instrumentation, and industrial production data acquisition and control equipment into the network step by step in order to achieve the distributed remote monitoring, information exchange and sharing. At present, widely used in Ethernet and TCP / IP protocol has become the most commonly used Web standards, and its high-speed, reliable, hierarchical, and scalability of their applications in various fields, more and more flexible use of many cases Ethernet and TCP / IP, to simplify the structure and reduce costs.
At present the majority of intelligent devices and instrumentation are used in RS232/485 or USB communication, and do not have a remote control and data transmission capacity. Industrial systems using Ethernet remote control, via the Internet to share information on small embedded devices, control of industrial trends. The system uses high-speed single-chip Ethernet controller ATmega64 and RTL8019AS with embedded TCP / IP protocol can be achieved, such as TCP and UDP networking service further HTTP protocol, Web Sever and the realization of the functions of Internet access.
1 System hardware design
System block diagram as shown in Figure 1, ATmega64 is based on the AVR RISC structure enhanced low-power 8-bit CMOS microcontroller. Inside with 64KB of Flash, 2KB of E2PROM, 4KB of SRAM. Because of its advanced instruction set, as well as a single clock cycle instruction execution time, ATmega64 data throughput of up to 1MIPS/MHz, in order to meet the system power consumption and processing speed requirements.
RTL8019AS is a highly integrated Ethernet controller 10MB, and NE2000 compatible support for 8-bit, 16-bit data bus; built-in 16KB SRAM cache; can coax and twisted pair connections, and automatic detection of the connected media. Ethernet isolation filter selection 20F00IN.
RTL8019AS interface with the host processor There are three ways: the way jumper, PNP (Plug and Play) mode and jumper-free mode. RTL8019AS the first 65 feet JP decided to work card, the design of JP feet high then (VCC), which means the use of jumpers, at this time can be saved to external E2PROM 93C46 chip. Single-chip through the I / O mode access to the Ethernet controller. RTL8019AS to work in 8-bit mode, IOCS16B by its resistance grounding pin. Circuit diagram shown in Figure 2.
RTL8019AS itself with the address decoding function, all the control functions or data transmission are offset by visiting the address for the register 00H ~ 1FH completed, so only five address lines (SA4 ~ SA0). RTL8019AS in jumper mode of I / O addresses from the pin IOS3 ~ IOS0 decided to pin IOS3 ~ IOS0 corresponding to all low-level access, then RTL8019AS the I / O base address is 300H, therefore can be used SA8 and SA9 access to election-chip microcontroller PC7. When the PC7 pin high when selected home RTL8019AS, home when the PC7 pin low when selected external RAM, while the chip select signal AEN will be grounded, this chip can be saved in a reverse manner browser. AUI in the AUI interface used to detect the use of external MAU. When the unused pin should be grounded.
Choice of media and PL1 pin PL0 decision, RTL8019AS also has automatic test medium to connect the function of the success. Unshielded twisted pair (UTP) cable is the most widely used types of telecommunications media. In order to more easily access to embedded Ethernet LAN module, the design uses RTL8019AS with twisted-pair interface circuit connected to the upcoming PL0, PL1 grounding.
2 Ethernet controller process
Ethernet controller with 256 bytes of RAM for the page is stored by the page structure, 16-bit RAM address, also known as page 8 high. Ethernet controller from 16KB RAM address 0x4000 ~ 0x7FFF, that is, from 0x40 to the page page 0x7F, a total of 64 used to receive and transmit packets. This RAM is a piece of 64 dual-port RAM. The so-called dual-port that is to say, there are two sets of bus connected to the RAM, Bus A for ethernet controller read / write on-chip RAM, bus B for single-chip read / write of RAM Ethernet controller . A bus also known as Local DMA, bus B is also called the Remote DMA.
2.1 the process of sending packets
(1) encapsulated data packets: data packets sent before their single-chip microcomputer as shown in Figure 3 by the Ethernet frame format package well, co-exist on the external SRAM.
(2) through remote DMA write data packets to send RLT8019AS data buffer, the purpose of the data buffer address and the first number of bytes from the internal register RSCR0, 1 set.
(3) RTL8019AS local DMA data sent into the FIFO buffer.
2.2 to receive the course packet
(1) local DMA will need to receive data packets into the receive buffer ring.
(2) from the remote DMA ring buffer will receive packets of write to the external SRAM.
If the Ethernet controller to run normally, receive automatically activated when the packet data into the local DMA receive buffer ring, that is the first step is completed automatically by the RTL8019AS. However, the scope of the receiving ring buffer need to set up, PSTART, PSTOP were set to receive buffer ring for the start page and send pages, set up after the reception buffer ring, received a packet by placing the location of the current page register CURR decision.
3, server-side process
Figure 4 shows the system TCP / IP protocol on each floor, link layer protocol to achieve RTL8019AS by SCM, and other agreements by the single-chip realization of internal procedures.
Server receives data, the Ethernet driver is responsible for receiving data from the Ethernet controller interrupt wake-up data reception processing tasks, from data receiving task will receive the data frame to the network interface layer, network interface layer header removed to determine the type of receive data, if the ARP packet, it will ARP packet to the ARP protocol processing module; If it is IP data packets will be handed over to IP packet processing module IP protocol, IP protocol module out IP information first , and then according to the type of packet, the packet to the corresponding protocol module (UDP module, TCP or ICMP module module) to address, UDP or TCP module module packet received after the first out processing, and user data delivery to the application.
Server to send data to user data to the UDP protocol module or modules to deal with TCP protocol, UDP protocol or TCP protocol module to the first module and the data package into a UDP packet or TCP packet, and then the packet will be a good package module to the IP protocol, IP module in the upper packet to add the first IP, and packaging into IP packets, and then search for the IP packet routing, If you can not find the appropriate routing, sent to the ICMP protocol error message from ICMP protocol processing module, in finding a suitable route, if the way is the Ethernet, the packet will be sent to the network interface layer, the purpose of the use of ARP protocol to find the physical address of the corresponding IP, and then Packaging into Ethernet frames by the NIC driver Ethernet frame will be sent.
4 using HTTP protocol to send Web to receive and control data
Single-chip microcomputer system in the HTTP protocol to achieve the functions of client services, we can provide other hypertext client information, client only need to use a unified browser can exchange information with the server.
Hypertext Transfer Protocol (HTTP) is the exchange of information through the Internet the most important way. HTTP communication in the Internet, often occurred in the TCP / IP connections on. The default port is TCP port 80 agreements, of course, other ports can be used. HTTP protocol is based on the request / response (request / response) model of the. First of all, by the client and server to establish a TCP link, and send a request to the server, the request contains the request method, URI, Protocol Version and the related MIME (Multipurpose Internet mail Extensions) message style. Server in response to a status line, contains the protocol version information, a code of success or failure and the associated MIME type of information (including the server information, resources entities and possible resources of information content).
In addition to single-chip server, including HTML documents, as well as the presence of a HTTP procedures for the control in response to the request of client computers. HTML document prepared by the network interface, you can access through a browser and use the corresponding button to send HTTP request to the server, this request was sent from the IP address of the designated URL. The presence of the procedures to receive the request after conducting the necessary operations to send the requested documents. In this process, on the network to send and receive data has been divided into one or more data packets (packet), each packet include: the data to be sent; control information that tells how to deal with network packets. TCP / IP determines the format of each packet.
Figure 5 through the Web browser to see the network control interface, the necessary client and server computer system installed in the IP address of a paragraph. If the system is set to the server IP address 192.168.0.10, the client IP address set to 192.168.0.11, default gateway of 255.255.255.0.
(1) to send control data process: ① through the browser to the server system (single chip) send HTTP requests; ② server system through the HTTP server program to view the page program in the form of changes in input variables; ③ Remove the variable values, call the string I process the data sent.
(2) to receive the data collection process: ① HTTP protocol process system call http_serve serial procedures to receive serial data, and use this data to replace its internal web pages of the form "NO DATA" tag; ② server to send Web pages browser user interface.
AVR to use low-cost single-chip Ethernet controller and with the appropriate network protocol, achieved through the network interface devices on the RS232 data acquisition and system control. Such as changes in its proper and expansion, it can be used for other instrumentation interface and applied in wider areas. As the system controller using a single chip is limited to its internal resources, so the page file can not be too large.
 Qin Su Ho. TMS320C2000 family of dsp theory and practical technology [M]. Beijing: Electronic Industry Press, 2003.
,. The use of single-chip Ethernet card to control data transmission research. Network and bus, 2003, (6): 41.
 Yan Baozhong,macro,. Based on the AVR microcontroller High-speed Web sever research. Applied Science and Technology, 2006,33 (3): 25.
 J. Magid. Web server technology guide. LI Qian translation. Beijing: Mechanical Industry Press, 1996.
 Network Working Group: RFC 2616 - Hypertext Transfer Protocol--HTTP/1.1.
Micro Controller Unit Articles
- P89C51RD2 customizable interface design, human-computer interaction
- QST108 touch sensor interface design with PIC microcontroller
- Based on single chip car super capacitor test system design and implementation
- A simple microcontroller suitable for classroom teaching experiment DEVELOPER
- MCU for electric bicycles to provide an effective drive (Figure)
- Real-time kernel μC / OS-II under the Network Monitoring System
- Based on AT89C52 Microcontroller Design SD card reader
- Based on low-power MCU Intelligent Integrated Instrument Design
- A small, highly integrated intelligent design and realization of test device
- Freescale Flexis JM family of flexible controller to start the development of USB connections
- Intelligent design dumbbell
- Automotive Burglar Alarm Monitoring System
- A STC12C2052AD improved single-chip voltage regulator control circuit
- Embedded design using C8051F020 Tester
- Based on single-chip low-power active RFID tag design
- Based on OSEK / VDX the electric power system design
- Flexible framework for the realization of MCU products easily upgrade
- Wireless Remote Control LED Clock Screen Design
- ISP-based image processing system of the PLD hardware design
- A single-chip multi-machine communication system design
Can't Find What You're Looking For?
Rating: Not yet rated