Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Feb 24, 2009

Reference Examples for Sharing Data between LabVIEW and a DLL

1 ratings | 3.00 out of 5
Print

Overview

These reference examples show how to transfer data between LabVIEW and a DLL using NI-VISA or TCP/IP.  These methods work under Windows or LabVIEW Real-Time.

Downloads

Filename: shared_memory.zip
Requirements: View

These reference examples show how to transfer data between LabVIEW and a DLL using NI-VISA or TCP/IP.  These methods work under Windows or LabVIEW Real-Time.

VISA Method

The ZIP file contains two folders.  One folder contains the LabVIEW and LabWindows/CVI projects for the VISA-based shared memory.  This example shows how to pass data between LabVIEW and a second process running in a C DLL.  The DLL has its own internal loop, so once started it runs in parallel with the LabVIEW VI.  The LabVIEW VI generates a sine wave with 100 points, which is sent through shared memory using VISA to the second process running in  the DLL that takes the data and multiplies it by a gain value.  The amplified data is then sent back to LabVIEW.

The shared memory is created by mapping or allocating memory to the PXI::MEMACC “device” that can be called in LabVIEW for Windows and LabVIEW Real-Time.

All data communication is done through NI VISA. The Visa_SigAmplifier.c shows the C source code for the DLL.

TCP/IP Method

The second folder contains example files for data communication between LabVIEW and a DLL using more traditional TCP/IP client/server approach.   The data generation and processing are similar to the previous example, but the data transfer is accomplished using TCP/IP using localhost as the IP address.

The TCP_ClientSubVI.vi is the source code for the DLL and shows how it communicates using TCP/IP.

 

Requirements


Filename: shared_memory.zip

Software Requirements


Application Software: LabWindows/CVI Full Development System 9.0, LabVIEW Base Development System 8.6
Toolkits and Add-Ons: LabVIEW Real-Time Module 8.6
Language(s): C, LabVIEW

Hardware Requirements


Driver: NI-VISA 4.4

 
1 ratings | 3.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).