In-depth exploration of LabVIEW--Using DDE to realize data exchange between processes

Publisher:明理厚德Latest update time:2015-08-25 Source: eefocusKeywords:labview  DDE Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
LabVIEW is multi-threaded. There are many ways to exchange data between two threads. Process (PROCESS) and thread (THREAD) are two different concepts. When we start an executable file, we actually start a process. The process manager of WINDOWS can observe the currently active processes. The exchange of data between processes can be simply understood as the exchange of data between multiple executable files.

There are several ways to exchange data between processes: clipboard (CLIPBOARD), dynamic data exchange (DDE), memory mapped file (MAP FILE) and general files. Of course, TCP/IP, SHARE VARIABLE, DATASOCKET can also be used, but these are all network data exchange and are not suitable for local process communication.

In a previous article, we have introduced how to use the clipboard for communication. Today, we will introduce dynamic data exchange (DDE).

DDE (Dynamic Data Exchange), that is, dynamic data exchange, is a complete communication protocol on the Windows platform, which enables applications to exchange data and send instructions to each other. The DDE process is a dialogue process between two programs, one party asks a question to the other party and then waits for an answer. The party that asks the question, that is, the application that requests to be informed of the information, is called the client, and the party that answers, that is, the application that provides the information, is called the server. An application can be both a client and a server at the same time: when it requests data from other programs, it acts as a client; when other programs need it to provide data, it becomes a server. But at a certain moment, an application can only act as a client or a server.

The content of the DDE conversation is agreed upon through three identifiers: ① Server Name (Service Name): Each application of the DDE source has a unique server name, usually an executable file without a suffix; ② Topic (Topic): Some data units that are meaningful to the source program, that is, the topic of the conversation. Many applications use the document name as the topic of the DDE conversation; ③ Item (Item): The data actually transferred between two applications in the DDE conversation. Before establishing DDE, the client program must fill in the three identifiers of the service program.

There are three types of DDE links: ① Hot link: The server sends data in the project specifically set for DDE dialogue. When the data changes, the link will act in real time and automatically update the data; ② Cold link: When the data changes, the client must explicitly request an update before the data will be updated; ③ Warm link: When the data changes, the server notifies the client, and the client decides whether to update the data based on its own requirements.

DDE is essentially implemented by sending messages. In VC and CVI, event callback functions can be registered to achieve automatic data exchange, but unfortunately LABVIEW does not provide an event-driven method for DDE. Just like its serial port operation, it is all done through polling (POLLING), so it involves the problem of DDE speed coordination between two processes.

DDE is an important way of inter-process communication in the early days of WINDOWS. It is not used much now, but many applications, such as OFFICE, MATLAB, etc., including various popular configuration software, still provide support for DDE, so it is necessary to understand it.

After 7.1, LABVIEW cannot find the DDE library in the template and needs to be manually added to USER LIB.

C:Program FilesNational InstrumentsLabVIEW 8.5vi.libPlatformdde.llb

is mainly divided into two parts: client and server, client and server VI.


DDE data exchange must first start the server, otherwise the client cannot connect.

The server operation process is:
register server---》register ITEM----》set ITEM value-----》cancel ITEM registration---》cancel server registration




Corresponding client reading data block diagram




Note that the server cycle is updated every 500MS, and the client is updated every 500MS. The server and client are basically synchronized. If the client speed is higher than the server, it will cause the same data on the server to be read multiple times. Similarly, if the server runs fast and the client runs slowly, data will be lost. This is the disadvantage of no event response. It is difficult to ensure the synchronization of sending and receiving. Therefore, the above program is only suitable for situations where data exchange requirements are not high, such as monitoring.

DDE is a hierarchical structure, SERVER--》TOPIC---》ITEM.
A SEVER can include multiple TOPICs (similar to a group), and each TOPIC can include multiple ITEMs (projects). We can register multiple TOPICs and multiple ITEMs in a loop to achieve batch data exchange.




In the above figure, 10 ITEMs are registered for TOPIC1 at the same time through a loop, namely ITEM0----》ITEM9, and data is written to ITEM0--》ITEM9 in the main loop.





Similarly, we can classify the data we have to communicate into multiple SERVERs and multiple TOPICs in detail to exchange a large amount of data.

The advanced synchronization technology of DDE will be further introduced in subsequent articles.
Keywords:labview  DDE Reference address:In-depth exploration of LabVIEW--Using DDE to realize data exchange between processes

Previous article:In-depth exploration of LabVIEW - using DDE to achieve data exchange between processes Part 2
Next article:In-depth exploration of labview--the basic concepts of OPC series

Recommended ReadingLatest update time:2024-11-16 13:50

LabVIEW in-depth exploration of how to make multiple event branches execute the same function
  In actual applications, we often encounter the problem of multiple different event sources that need to trigger the same event. The most common problem is the program's menu items and toolbar buttons. Usually, a toolbar button corresponds to an item in the menu bar, and the two have the same function. In C language
[Test Measurement]
LabVIEW in-depth exploration of how to make multiple event branches execute the same function
Broken rotor bar detection of asynchronous motor based on LabVIEW
The broken rotor bar fault of cage asynchronous motor will lead to the deterioration of motor running performance and cause certain losses to production development. The probability of broken rotor bar fault is as high as 10%. Therefore, it is necessary to detect and warn in time at the early stage of fault developm
[Test Measurement]
Broken rotor bar detection of asynchronous motor based on LabVIEW
Realize quantitative testing and time-frequency analysis based on LabVIEW software and computer sound card
In the field of electronic measurement, signal generators and oscilloscopes are one of the most basic and widely used electronic measurement equipment. Their functions are to provide electrical signal sources that meet certain technical requirements for electronic measurement and to graphically display electrical sign
[Test Measurement]
Realize quantitative testing and time-frequency analysis based on LabVIEW software and computer sound card
Analysis of the design principles of wireless monitoring remote medical system
   This paper introduces a wireless remote medical monitoring system based on GPRS technology. With SPCE061A as the main control chip, the data acquisition module and the GPRS communication module are combined to connect to the Internet wirelessly. The monitoring center receives the data and saves it in the database
[Medical Electronics]
Analysis of the design principles of wireless monitoring remote medical system
Design of periodic signal and random signal amplitude eigenvalue obtaining system based on LabVIEW
introduction LabVIEW has two basic windows, the front panel window and the flowchart window. The front panel window is used to set control objects and display objects, which is equivalent to the display screen or pointer of a conventional instrument; the flowchart window is used to write and display the graphic
[Test Measurement]
Design of periodic signal and random signal amplitude eigenvalue obtaining system based on LabVIEW
Stepper Motor Control Based on LabVIEW
A stepper motor is an electromechanical element that converts an electrical pulse signal into an angular displacement or a linear displacement. It is widely used in industrial automation control, CNC machine tools, robots and other fields. In remote experimental systems, it is often necessary to use stepper motors to
[Test Measurement]
Stepper Motor Control Based on LabVIEW
Communication simulation based on LabVIEW (Figure)
Introduction ---LabVIEW, launched by NI, is an excellent object-oriented graphical programming language. It uses icons instead of text codes to create applications and has a large number of VI libraries for communicating with other applications. As one of the most widely used data acquisition and control development e
[Test Measurement]
Communication simulation based on LabVIEW (Figure)
Developing a novel portable smart greenhouse using graphical system design
  A greenhouse in Mexico is about to use a portable smart greenhouse system   author:   Pedro Ponce - Monterrey Institute of Technology   industry:   Life Sciences, Consumer Products, Scientific Research   product:   cRIO-9014, NI 9265, NI 9215, USB-6211, LabVIEW   challenge:   Create a smart system
[Test Measurement]
Developing a novel portable smart greenhouse using graphical system design
Latest Test Measurement 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号