Communication scheme between ARM and X86 platforms based on UDP protocol

0 Preface

With the application of artificial intelligence, ARM products have been spread across various fields: industrial control, wireless communications, 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 also used in 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. The 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 can 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 portion. 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 the datagram, 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 needs to be recalculated after being passed to the receiver.

If a datagram is falsified by a third party during transmission or is damaged due to line noise, etc., the checksum calculation values ​​of the sender and the receiver will not match, and the UDP protocol can detect whether an error has occurred. 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.

Wireless communication

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.

We are into offering high performing range of Solar Home Systems, which is developed to provide power for daytime loads. These systems are highly demanded at rural as well as urban areas. Our Solar Home Systems are integrated with latest technology that ensures superior performance. We are counted as one of the leading Manufacturers, Suppliers and Exporter of Solar, Home Systems. The direct output of solar energy is generally 12VDC, 24VDC, 48VDC. To provide electricity to the 220VAC appliances, the direct current generated by the home solar power generation can be converted to AC power, so the dc-ac inverter is required.

3KW Solar Home Power

3Kw Solar Home Power,Home Power,Solar Home Power

Yangzhou Bright Solar Solutions Co., Ltd. , https://www.solarlights.pl