From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect to ScanWorks

I am trying to use TestStand using LabWindows/CVI to connect with Asset's ScanWorks. I have one station which uses two of Assets hardwares, USB-100 and RIC-1000. I want to be able to connect a certain hardware automatically, without manually doing it in ScanWorks. I looked through the ScanWorks API and it uses sw_connectWithController but I am not sure how to implement it into TestStand.

0 Kudos
Message 1 of 7
(3,792 Views)

Is this a TestStand question or CVI?

Can't you call Scanworks API DLL from TestStand driectly?

I remember there was more than one DLL files in ScanWorks installation. Maybe you are not choosing the right one. If I am not mistaken, there was a subset API called swproto. Can you check its DLL, whether that function is available in it or not?

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 7
(3,726 Views)

Yes there is swproto. How would I use this inside of TestStand to call all of its functions?

0 Kudos
Message 3 of 7
(3,717 Views)

You can add a C/C++ step and point to that DLL file as the code module.

TestStand should list the available functions in the DLL, you select one, enter the parameters and you are done.

You should add a separate step for each successive function call, or create a DLL of your own in CVI and code your functionality into suitable functions and call them similarly.

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 7
(3,703 Views)

I add the DLL and then try to call one of the functions sw_connectWithController but it has "This function does not have parameter information in the DLL or uses types not recognized by TestStand" so I try inputting parameters and still errors. The parameter is char *controllerString which the RIC-1000 would be the string

0 Kudos
Message 5 of 7
(3,685 Views)

This happens when TestStand cannot resolve the function prototype. In such cases, if you know the function prototypes you can add parameters manually in TestStand and call the function.

Alternatively, you can create a wrapper library project in CVI and create a CVI DLL with same function names, each of which does nothing but calls the same function in the target DLL.

You need the header file, swproto.h for this purpose.

Create a new DLL project, add swproto.h in it. While swproto.h is the active file tab go to Options>Generate DLL Import Source. Point to the original swproto.dll that you want to wrap.
A wrapper source file will be automatically generated. Add it to your project and build to create your new DLL.

Select this new DLL as your code module. The parameters should Show up this time.

Somehow TestStand works always OK with CVI generated DLLs.

Hope this helps,

S. Eren BALCI
IMESTEK
0 Kudos
Message 6 of 7
(3,672 Views)

How do I create a new DLL project and import swproto.h

I am only allowed to import .dll files? Can you show me how did you do it?

0 Kudos
Message 7 of 7
(3,664 Views)