LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to Device in LabVIEW 2010

Hello there,

 

I am attempting to communicate with an STG 2008 Multichannel Stimulator using LabVIEW 2010. We have the code essentially finished but we have been unable to discover connectivity between the device and the computer running the software. I have attached a photo of the setup that we have been attempting to use to connect to the device. I reached out to the stimulator manufacturer for some guidance as to why we have been unable to establish a connection and the response he provided me with was this: 

 

"you need the CMcsUsbListNet class to get such an entry,
in C# it would be:

CMcsUsbListNet usblist = new CMcsUsbListNet();

usblist.Initialize(DeviceEnumNet.MCS_STG_DEVICE);

after this, a call to

usblist.GetUsbListEntry(0)

will provide an entry of the first STG device found"

 

From looking at our code I feel like we have done what he said we would need to do in order to communicate with the device but so far we have been unsuccessful despite a company representative's guidance. 


If anyone has any input that we could use to solve this problem I will appreciate it.

 

Thank you!

0 Kudos
Message 1 of 12
(4,180 Views)

Hi SCapouch,

 

I am not familiar with that device, but to translate that C# code you have to LabVIEW, it looks like this:

 

STG-2000.png

 

 

 

 

 

 

 

 

Basically it just looks like you're missing that "Initialize" method for the CMcsUsbListNet object.

 

-Jim B.

Applications Engineer, National Instruments

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 Kudos
Message 2 of 12
(4,138 Views)

Sir,

 

After fixing this error using your method, I am now receiving an error 1172 out of the Connect from CStg200xDownLoadNet Construct. Do you have any ideas as to how I can remedy this? I have attached an image of the error below. I apologize, my LabVIEW skills are not as good as I wish they were.

 

http://i.imgur.com/1fWZD3U.png

0 Kudos
Message 3 of 12
(4,125 Views)

1fWZD3U.png

Rajesh Raghavan Nair

Certified LabVIEW Architect
Certified Teststand Architect
0 Kudos
Message 4 of 12
(4,113 Views)

When you say to close the connection after finishing the operation, do you mean to move the closing operation to the other side of the sequence structure? I tried that and I am still being presented with the ERROR 1172. I'm not sure how to deal with this

0 Kudos
Message 5 of 12
(4,092 Views)

James,

 

Is the variable connected to McsUsbDevice in the picture you send me just a numeric ring constant that I name MCS_STG_DEVICE, or is that an input variable that I need to obtain from the manufacurer's DLL that I downloaded from their website? 

 

Thank you

0 Kudos
Message 6 of 12
(4,088 Views)
You obviously cannot just drag the close to the right side of the block diagram. You also do not show how you are getting the reference. Is that being created by a main VI?
0 Kudos
Message 7 of 12
(4,081 Views)

The reference is inputted to the subVI that I have been asking about from a NET library in the main VI of our code. I have attached a photo with an arrow pointing to the subVI where I have been experiencing problems 

 

http://i.imgur.com/bQEMQcX.png

0 Kudos
Message 8 of 12
(4,071 Views)

I used debugview to isolate what the error is specifically and this is what I found:

DNError: Error calling method Mcs.Usb.CStg200xDownloadNet.Connect (1172) System.ArgumentNullException: Key cannot be null

I have searched the web trying to gain some perspective but have had no success so far; any ideas? Thank you

0 Kudos
Message 9 of 12
(4,041 Views)

I got that ring constant by right clicking on the input terminal for McsUsbDevice and clicking "Create->Constant"

 

It sounds like that particular invoke node does not like the object being passed in to it.  I noticed that there are two different constructors for that object, so maybe try using the other one.

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 Kudos
Message 10 of 12
(4,012 Views)