07-05-2010 02:58 PM
hi -- I've written some C# code that interaces to an embedded controller using a USB link. I can turn this around into a dll so that i can use the dll to encapsulate the driver to the embedded board. i'm looking for some best practices to show me how to do this so that i can cleanly interface this to a LV application.
thanks,
Jim
Solved! Go to Solution.
07-06-2010 02:41 AM
Use ' Constructor ' to load that C# DLL which is found in Fuctions >> Connectivity >> .Net palette in the LabVIEW. Afterwards you can use the Propery and Invoke nodes to call the properties and methods present in the C# DLL.
AshwiN,
07-06-2010 04:18 AM
A Snippet...
AshwiN,
07-07-2010 10:38 AM
ok -- thanks. but now i need to conditionalize the call to the method (ie the invoke node). there doesnt' appear to be any easy way to do that. any suggestons?
Jim
07-08-2010 04:56 PM
Jim:
Probably my lack of text-based background speaking here, but I don't quite follow.
Are we trying to use a specific condition/output from the .NET constructor to change the method we invoke?
07-08-2010 07:17 PM
no -- my presentation of the problem has made it overly complicated. in C#, if i have a method, for example int SDO_Write(some arguments) that returns an int, i can write a couple lines of code that look like this:
int testValue = 0;
if (condition)
{
testValue = SDO_Write(arg 1, arg2, etc);
}
so that, if the condition is true, the method is called. now, if the method is one that is exposed in the dll, can i conditionalize my calling it from within my labview application? the issue is that the calls are to a driver that i want to control how much loading occurs.
07-12-2010 06:53 AM - edited 07-12-2010 06:54 AM
Jim:
We cancertainly use something simple like a case structure to conditionalize what method or arguments we call. If we know what method we'll be writing, we can wire our condition to the conditional terminal of the case structure and put our method inside. If we know we'll be writing anyway, but we need to switch commands, we can simply put our write constant inside the case structure and pass it to the method.