Programming of a single network node in WinCE system

Publisher:TranquilMindLatest update time:2014-02-16 Source: 21IC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Single network node system

A node is simply a computer or other device that has the function of sending and receiving data. A good node requires both good hardware support and suitable software control [1]. This paper selects the S3C6410 Arm11 chip as the node CPU and WindowsCE 6.0 as the embedded operating system running on ARM. The corresponding data communication function is completed through the network port, serial port, and SD card. The hardware structure block diagram of the node studied in this paper is shown in Figure 1.

2. Network port data transmission program design under WinCE

2.1 Network port server programming

In actual applications of network communication using sockets, the server/client approach is generally used.[2]

In the design of this paper, we have studied the mode of using PC as the server and ARM as the client, and also studied the mode of using ARM as the server and PC as the client. The basic process of server design in this paper is:

Use the function socket() to create a socket, then use the function bind() to bind the socket to the local (PC) IP address and port number, then use the function listen() to put the socket in a listening state, and then when waiting for the client's connection signal, use the function accept() to connect to the client, and finally use the functions send() and recv() to communicate. When the communication is over, use the function closesocket() to close the socket.

2.2 The server-side programming idea of ​​this article

The server-side programming idea of ​​this article is shown in Figure 2.

3. AD data acquisition program design under WinCE
3.1 ARM board AD collector driver design
The stream interface driver is a function that loads the hardware by calling the dynamic link library. It is called directly by the device manager. The stream interface driver written under the WinCE system has a fixed interface entry point, which is a series of function sets similar to the XXX_Open() structure. These function sets call the system's file API functions and corresponding components. This article designs the stream interface driver for the AD collector. The interface entry point (i.e., function set) and its purpose are described as follows:
(1) Function ADC_Init(): This function is used to initialize the AD collector device and is called by the system's device manager.
(2) Function ADC_Denit(): This function is used to uninstall the AD collector device and is called by the system's device manager.
(3) Function ADC_Open(), which is used to open the AD collector device and is called by the system's file API function CreateFile().
(4) Function ADC_Close(), which is used to close the AD collector device and is called by the system file API function CloseHandle().
(5) Function ADC_Read(), which is used to read data from the AD collector and is called by the system's file API function ReadFile().
(6) Function ADC_Write(), which is used to write data to the AD collector and is called by the system's file API function WriteFile().
(7) Function ADC_IOControl(): This function is used to perform I/O operations on the AD collector and is called by the system file API function DeviceIOControl().
It should be pointed out that the AD collector studied in this paper does not involve power management and device pointer operations.
The stream interface device driver that needs to use these two operations also needs to add functions XXX_Seek(), XXX_PowerDown() and XXX_PowerUp(), which are used to move the data pointer, sleep and restore power of the XXX device respectively.
3.2 Design of Four-channel AD Acquisition Application Program under WinCE
The ARM used in this study provides four external AD channels, which can be used to realize the four-way analog data acquisition function. The application software is written through EVC++ to call the AD stream interface driver to realize the acquisition of analog signals, and the collected data is sent to the PC through the network port. The design adopts a multi-threaded approach to modularize AD acquisition, data processing, and network port communication, and adopts a double buff collection and transmission interactive method to ensure that data is not lost. The network port communication module directly uses the previously designed network port communication process. The data processing module mainly transmits the collected digital signal data from the sub-thread to the external buff, which is convenient for the use of the communication module. The AD acquisition module calls the driver in the thread to realize the data reading function of the AD collector.
3.3 Implementation and debugging of four-channel AD data acquisition experiment
Using the above design ideas, this paper implements the system design of AD data acquisition under WinCE system. The debugging process and experimental results are as follows:
First, load the written driver into the kernel of the Win-CE6.0 system, recompile the system, and start the newly compiled WinCE system. You can see the dynamic link library generated by the loaded driver in the Windows folder.
Then start the network program that processes the waveform of the collected data on the PC, download the four-channel acquisition program to the ARM board and start it, set the sampling rate and sampling channel, select 0 as the input channel, and set the sampling frequency to 400000hz (the maximum sampling frequency of the AD collector is 500khz). Adjust the signal source, select the sine wave, set the signal voltage amplitude to 1.5v, the minimum voltage to 0v, the signal frequency to 3000hz, connect the output signal line to the AD channel 0 interface of the ARM board, start the signal input, and get the debugging screenshot shown in Figure 3 on the ARM side.
 
 
This is the AD acquisition application designed in this paper that runs on the ARM board. You can start AD acquisition, pause AD acquisition, and turn off the AD collector function by clicking the start, stop, and close buttons. You can also select the sampling channel by entering the channel number and the sampling frequency by entering the sampling rate. The upper control shows the number of bytes collected at one time, which is 2048 bytes here, which is consistent with the actual design of the program. The correct operation of the AD collector not only illustrates the correctness of the application design, but also reflects the correctness of the AD collector driver design.
 
4. Conclusion
This paper systematically provides the general programming method of data communication under WinCE embedded system by studying the network port communication, serial port communication, SD card data access and AD data acquisition program design under WinCE. This paper realizes the interaction of internal data of a single node in the underwater communication network, which mainly includes the following contents: the program design of the ARM board communicating with the DSP through the network port has been completed; the program design of the ARM board communicating with the PC and the attitude and azimuth instrument through the serial port has been completed; the operation of the ARM board on the SD card has been completed, and the data transmitted from the DSP through the network port can be automatically stored in the SD card, and the data in the SD card can be read; the design of the ARM11 stream interface AD ​​driver and the design of the AD acquisition application have been completed.
Reference address:Programming of a single network node in WinCE system

Previous article:Improvement of the usage of MM74HC4046 in induction heating power supply
Next article:Design of DSP asynchronous serial communication based on VK3366

Latest Power Management Articles
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号