Communication scheme between ARM and X86 platform based on UDP protocol

With the application of artificial intelligence, ARM products have been distributed in various fields: industrial control, wireless communication, consumer electronics, imaging and security products, including most of today's popular digital cameras and printers using ARM technology, in mobile phones The 32-bit SIM smart card also uses ARM technology. In addition, ARM microprocessors and technologies are applied to many different fields and will be more widely used in the future. Therefore, communication between ARM and other platforms is particularly important.

1. The nature of the UDP protocol

The UDP protocol is the abbreviation of the English User Datagram Protocol, the User Datagram Protocol, which is mainly used to support network applications that need to transfer data between computers. Many client/server mode network applications, including network video conferencing systems, require the use of the UDP protocol. The UDP protocol has been in use for many years since its inception. Although its initial brilliance has been overshadowed by some similar protocols, even today, UDP is still a very practical and feasible network transport layer protocol.

The UDP protocol uses its port number to reserve its own data transmission channel for different applications. UDP and TCP protocols use this mechanism to support the simultaneous transmission and reception of data by multiple applications at the same time. The data sender (which may be the client or server) sends the UDP datagram through the source port, while the data receiver receives the data through the destination port. Some network applications can only use static ports reserved or registered for them; others can use unregistered dynamic ports. Because the UDP header uses two bytes to store the port number, the valid range for the port number is from 0 to 65535. In general, port numbers greater than 49151 represent dynamic ports.

The length of the datagram refers to the total number of bytes including the header and data parts. Because the length of the header is fixed, this field is primarily used to calculate the variable length portion of the data (also known as the data payload). The maximum length of a datagram varies depending on the work environment. In theory, the maximum length of a datagram containing a header is 65535 bytes. However, some practical applications tend to limit the size of datagrams, sometimes to 8192 bytes.

The UDP protocol uses the checksum in the header to ensure data security. The check value is first calculated by the data sender through a special algorithm, and after being passed to the receiver, it needs to be recalculated.

If a datagram is falsified by a third party during transmission or damaged due to line noise, etc., the calculated values ​​of the sender and the receiver will not match, and the UDP protocol can detect an error. In fact, the verification function in the UDP protocol is optional, and if it is turned off, the performance of the system can be improved. This is different from the TCP protocol, which requires a check value.

2. Implementation case

The implementation case is as follows: drawing on the touch screen to display on the LCD screen, simultaneously transmitting data through the network, causing it to be displayed on the computer screen, and the computer controls to clear the graphic on the liquid crystal screen.

Proceed as follows:

(1) New construction

(2) Edit the initialization network function in the main.c file. void InitNetWork()//Initialize the network{

U32 ipaddr32, ipmaskaddr32, ipgateaddr32;

U8 *Mac;

Ipaddr32=Get_ipaddr(); //Get the IP address

Ipmaskaddr32=Get_maskaddr();//Get the subnet mask

Ipgateaddr32=Get_gwaddr(); //Get the gateway

Mac=Get_mac(); //Get the network card address NetPortChoose(0);

/ / Select the network port, must be done before configuring the network

initOSNet(ipaddr32, ipmaskaddr32,

Ipgateaddr32, Mac); / / configure the network

OSTImeDly (1000); / / task hangs for 1 second

Printk("init Ethernet and UDP is

Ok! ");

}

(3) Define computer-side sockets, global variables (4) Write Main_Task tasks and message loops are mainly responsible for responding to touch screen messages, drawing on the screen, and then transferring the data to the computer.

The processing of the touch screen message is similar to the keyboard message. The message type pMsg->Message is OSM_TOUCH_SCREEN, and the message parameter pMsg->LParam contains the action information of the touch screen, which is defined as follows:

#define TCHSCR_ACTION_NULL

0

#define TCHSCR_ACTION_CLICK 1 //Touch

Screen click

#define TCHSCR_ACTION_DBCLICK 2 //Touch

Touch screen double click

#define TCHSCR_ACTION_DOWN 3 //Touch

Screen press

#define TCHSCR_ACTION_UP 4 //Touch

Screen lift

#define TCHSCR_ACTION_MOVE 5 //Touch

Screen movement

The message parameter pMsg->WParam contains the touch

The coordinate information of the point, the lower 16 bits are the X coordinate values, and the upper 16 bits are the Y coordinate values. Here, when the touch screen generates a "press" action, the MoveTo() function is used to set the coordinates of the drawing start point, and when the "move" action is generated, the line segment is drawn using the LineTo() function.

Cement resistance: is the resistance wire wound on the alkali heat-resistant porcelain, coupled with heat resistant, resistant to wet outside fixed protection and corrosion resistance of the materials and the winding resistance into the square porcelain box body, using special incombustible cement packing seal.The outside of cement resistance is mainly made of ceramic materials (generally divided into high alumina porcelain and feldspar porcelain).

Cement Resistor

Cement Resistor,Thermal Cement Resistor,Thin Film Cement Resistor,Winding Cement Resistor,Fusing Cement Resistor

YANGZHOU POSITIONING TECH CO., LTD , https://www.yzpstcc.com