NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to access CVI UUT Dialog from LabVIEW Module

Solved!
Go to solution

Object: I want to update custom controls on the parallel UUT Dialog from a LabVIEW module.

Overview: I have a simple TestStand sequence using the Parallel Process Model, and modified the UUT Information Dialog in CVI to graph the values of the UUT during the test. I have successfully added custom controls and can even modify the values of the custom control calling my custom function in the modelsupport2.dll with the C/C++ module.
CustomUUTDialog.PNG
I have validated that the same values are being passed to my LabVIEW VI and my call to the modelsupport2.dll. I am assuming that it has to do something with TestStand loading the modelsupport2.dll into memory and therefore it works calling the dll from TestStand but not LabVIEW.

The custom function currently takes only 2 parameters (int panelId, int testSocketIndex), and I am calling the same dll and function.


Question: How to I call the modelsupport2.dll within LabVIEW to update the the UUT Information Dialog?

Thanks in advance
Matthew

0 Kudos
Message 1 of 8
(2,860 Views)

Hey Matthew,

 

It seems like you should be able to follow the instructions found here, Calling a Dynamic Link Library (DLL) from LabVIEW

 

If you have tried this method and are running into other issues, are there specific errors associated with those issues?

 

Sam J.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(2,833 Views)

I should have provided a little more information.

I am familiar with calling DLLs from LabVIEW; however, when I try to call the modelsupport2.dll within LV I get a -4 error/response from the dll(The dll does not return a LV error, this is the response from the dll). I am assuming that is error is because I do not Initialize or call the setup of the dll from LV; therefore the dll is not loaded into memory nor configured correctly for LabVIEW to call it?

So what do I have to do to call the dll from LabVIEW?

0 Kudos
Message 3 of 8
(2,819 Views)

Hey Matthew, 

 

Can you show the block diagram portion of how you're calling modelsupport2 or share that part of your code?

 

Thanks,

Roxy

0 Kudos
Message 4 of 8
(2,817 Views)

Sure thing,

LabVIEW code calling DLLLabVIEW code calling DLLLabVIEW Code called from TestStandLabVIEW Code called from TestStandC DLL calling from TestStand (this is working)C DLL calling from TestStand (this is working)

The DLL currently creates and plots a random number

0 Kudos
Message 5 of 8
(2,809 Views)

If you call an empty function in modelsupport2 dll from LabVIEW, does that work? 

If that does, could you share your function prototype that is causing this error? 

 

Thanks,

Roxy

0 Kudos
Message 6 of 8
(2,791 Views)

Calling an empty function is no issue.

The error -4 is thrown from the GetPanelAttribute()

int DLLEXPORT _stdcall PUUT_PlotStripChartPoint(int panelId, int testSocketIndex)
{
	int 		error = 0, childPanel, randomNum;
	PUUT_PanelData	*panelData = NULL;
	
	errChk( GetPanelAttribute (panelId, ATTR_CALLBACK_DATA, &panelData));
	childPanel = PUUT_CalcChildPanel(panelId, testSocketIndex);
	errChk( GetPanelAttribute (panelId, ATTR_FIRST_CHILD, &childPanel));

	if(panelData){
		randomNum = rand()*100.0/(double)RAND_MAX;
		errChk(PlotStripChartPoint (childPanel, panelData->testSocketDataArray[testSocketIndex].ctrls[kTSCtrl_Stripchart], randomNum));
	}
Error:

	return error;
}


I did double check that the values passed into the function from LV and TestStand are the same.
panelId = 1
testSocketIndex = 0

Thanks,
Matthew

0 Kudos
Message 7 of 8
(2,752 Views)
Solution
Accepted by topic author Matthew.L

Thought I would close the post.

I never resolved the issue and just had LV read data, pass it to TestStand, and TestStand call the dll rather than have my LabVIEW module do the work. While it was messy and not the desired design it worked and I was on a time crunch.

0 Kudos
Message 8 of 8
(2,591 Views)