Jump to content

Labview and C++


Recommended Posts

Hi I'm completely new to labview and only have a bit of experience using C++ (about 1 high school course worth).

I'm learning to use a lab setup that has a C program that works with a data acquistion card and a labview VI that works with a GPIB card. Currently they run seperately which requires some manual control of the the programs. I was wondering if there is anyway that the C++ program can communicate with the labview VI. Specifically, when a certain temperature the C++ program acquires through the data aq. card is met, I need a boolean switch to be flipped on in the labview VI.

I was thinking of making the C program write to a text file, and the Labview program reading the text file. Will this work? Does anyone know of a simple solution to my problem? It doesn't have to be pretty.

Link to comment
I was thinking of making the C program write to a text file, and the Labview program reading the text file.  Will this work?  Does anyone know of a simple solution to my problem?  It doesn't have to be pretty.

2609[/snapback]

It sounds like you found a solution. Another way is to create the file in the c program and then have lv check for the presence of the file. When LV toggles the boolean then have lv delete the file. Repeat this process. This way you can have the c program verify that LV saw the file and toggled the boolean. As you say, NOT pretty but works. Why not get LV to do the DAQ card directly?
Link to comment
It sounds like you found a solution. Another way is to create the file in the c program and then have lv check for the presence of the file. When LV toggles the boolean then have lv delete the file. Repeat this process. This way you can have the c program verify that LV saw the file and toggled the boolean. As you say, NOT pretty but works. Why not get LV to do the DAQ card directly?

2614[/snapback]

Hello

I think that the right solution for your problem is DDE (Dynamic Data Exchange). With it you can communicate with multiple applications on the same computer.

It's quite easy to implement DDE in C and LV.

You can find DDE libraries in : "c:\....\National Instruments\LabView X.X\vi.ib\platform\dde.llb".

Please look at http://www.stoff.pl/ . There is satellite tracking system for radio amateur and obsering purposes (Orbitron). In this programme was included DDE Server which allows you receive tracking data in your application. In download section you can find example (in Delphi) "My DDE Client".

I sent:

- LV routine (dde_client);

- pdf (briefly describe the Dynamic Data Exchange in LV).

If you want to use Orbitron and LV, please remember to do one modification in configuration file "c:\...\Orbitron\Config\Drivers.dat" - just add one line at the end, for example LabView. Now you can enable DDE Server in Orbitron (rotor section).

Smiles

Download File:post-923-1100171820.vi

Download File:post-923-1100172166.pdf

Link to comment
Hello

I think that the right solution for your problem is DDE (Dynamic Data Exchange). With it you can communicate with multiple applications on the same computer.

... SNIP ...

2620[/snapback]

If you have the source code to the C++ side, so as to make modifications...

Four other ways would be:

1. Communicate using TCP/IP, simple enough on the LabVIEW end, (YMMV on the C end).

2. Compile the LabVIEW side into a DLL and have the C program call the LabVIEW routine as a DLL.

3. Compile the C/C++ end as a DLL and have LabVIEW call that.

4. Post Windows Messages to the LabVIEW Window Message Queue. If you search on the LAVA and OpenG.net websites you will find Windows Message Queue LabVIEW VIs so you can have LabVIEW listen for Windows messages, notifying it that the boolean needs to be set.

Cheers

Link to comment
  • 9 years later...

Hello Modo,

 

Thank you for this interesting Vi. It worked perfectly. Now what i need is the reverse!

Currently i wrote an SGP4 Propitagator for Satelittes in Low earth orbit and i need to send azimut, elevation, up and downlonk frequency to a program called HDSDR using a Fun Cube pro+ SDR-Stick.

HDSDR can obtain DDE-data from Orbitron via the myDDE.exe (the orbitron dde driver), so what i intend to do is sending the labview data via myDDE.exe.

How could i do this using the DDE.lbb from labview?

 

Cheers

Sacha J. Tholl

Link to comment

Where is the zombie smiley?

LoL,

 

I know  that  this topic is a realy old one - but there is no other one on the net about DDE, LabVIEW and orbital propagation....

So realy need to find a way to test my LabVIEW propagator "in real!",

could some LabVIEW engineers or some of the other survivng Zombies help me with this?  :-)

 

 

A reportage about my previous project:

http://future.arte.tv/de/gesichter-der-zukunft#article-anchor-11256

Edited by sacha tholl
Link to comment

Hi Dudes and Co-Zombies,

 

So i have found the solution. Departing from Modo's example about reading DDE-Data from Orbitron, i used the formatstrings. After the tutorial at: http://www.ni.com/white-paper/4531/en/   i was able to get it work and revert the process:

 

 

 

 

DDE Server orbitron

 

LV Propagator

 
 
HDSDR accepts DDE-data for the Downlink frequency from Orbitron. 
So i maide LabVIEW pretending it were the Orbitron DDE - Server
(same Source, object and item-link).

 

Edited by sacha tholl
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.