Highlight a variable between C and Labview?

What is the best way to allow C code to regularly receive the instantaneous value of an integer generated from a separate Labview program?

I have a time-critical C code that controls a scientific experiment and records data every 20 ms. I also have some labview code that controls another tool and prints an integer value in 100 ms. I want my C code to be able to write a value from labview. What is the best way to do this?

One idea is for Labview to write an integer to a file in a loop and have C code that reads the value of the file in a loop. (If necessary, I could add a second thread to my C code.) Labview can also reference the C dll. Therefore, I could write a DLL in C, which somehow facilitates the sharing of the two programs. Is it appropriate? How should I do it?

+3
source share
3 answers

I followed one of @stijn's ideals:

there is a C application, and the other dll is shared memory. LV will load this DLL and call the method on it to write the value to the shared memory, then application C will be able to read it after polling the flag (which needs a lock!).

I wrote the InterProcess library available here: http://github.com/samuellab/InterProcess

InterProcess - , Windows CreateFileMapping() MapViewOfFile(). (int, char, your struct.. whatever) . Mutex, , . Windows XP. Windows.

C- Labview DLL-, InterProcess , C- labview. , .

, - .

+2

TCP- TCP_NO_DELAY ( Nagle, ). 100 , . , ( , , :]). ? , , LV , C x mSec?

dll , , , . acces . :

  • C dll ( , ), LV . , LV dll Start(), LV , dll NewSampleValue (0) . , , -.
  • C DLL . LV DLL , C ( !).
  • , , C LV dll/activeX/? , .

: - , , . C , LV , .

, push pull (TCP ), , .. Push = LV C , pull = C LV .

+3

National Instruments, , API , LabWindows/CVI, National Instruments C. API Network Variable API LabVIEW (http://zone.ni.com/devzone/CDA///ID/4679). , - - ...

API Network Variable , LabVIEW, , Network/Shared (, ).

API, LabWindows/CVI, LabWindows/CVI. C:\Program Files\National Instruments\CVI2010\include\cvinetv.h, .lib, C:\Program Files\National Instruments\CVI2010\extlib\msvc\cvinetv.lib C, .

+2

Source: https://habr.com/ru/post/1783455/


All Articles