Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

trying to convert cvi to vi adn create a dll

We are trying to interface an ortec 974 counter/timer with labview 6. We converted the cvi driver to labview but we still need to convert our cvis to vis. Our ortec vis have broken run buttons and when they are run and error " Call librry function node : function not found in library" it tells me to right click on the call lib func node select configure and choose the correct function name. It does not regognize the name of my vi .What do I do? P.S. I do not have labview professional and I do not have the application builder
0 Kudos
Message 1 of 2
(3,379 Views)
Katharine;

You don't have to have Labview Professional to execute that task. As long as you compile the CVI code as a public access DLL, you can make a Call Library Function call from Labview.

Complete the following steps to create the DLL in CVI:


- Open CVI and create a new project (.prj) and a new source (.c) file.

- Edit the source file and add the following header lines:


/* Include files needed to compile DLL */#include #include /* needed if linking DLL in external compiler; harmless otherwise */#include BOOL __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){ return TRUE;}


- Add a simple function or any code you wa
nt to the DLL. Mark the functions you want to export as DLLEXPORT. The following example code multiplies a number by two.


void DLLEXPORT twise (double *my){ *my *=2; }


- Select Build » Target in CVI and change the target to Dynamic Link Library.


- Select Build » Create Dynamic Link Library. Make sure the Export What field is set to Symbols Marked to Export, as shown in the example linked below.

- Complete the following steps to use the DLL in LabVIEW:


- Open a new VI and place a Call Library Function Node on the block diagram.


- Right-click the node and select Configure from the shortcut menu.


- Navigate to the DLL you created.


- In the Function window, enter the name of the function you want to call, such as twise.


- Set the correct parameters and data types, as shown in the example linked below.


- Wire the appropriate inputs and output to and from the Call Library Function Node and set the input values. All input terminals must have
something wired to them.


- Save the VI.


- Run the VI. If all parameters are defined correctly, the VI should run successfully.

Hope this helps.
Filipe A.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,379 Views)