From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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 do i use activex in lab windows to connect with DATAQ (DI-158U)?

how do i use activex in lab windows to connect with  DATAQ (DI-158U)? i can get the datasdk controller on my panel but then don't know what to do next. Can anyone help?

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

Hey s123dip,

 

I did some research into the DATAQ ActiveX controls, and found this resource that I think might be helpful: http://www.dataq.com/develop/index.html   It contains some information about how to use those ActiveX controls and some of the common problems you might run into with them. I also might recommend looking at the DATAQ forums for more specific knowledge on those products.

 

We have a KnowledgeBase article on our site showing what parts of ActiveX are supported in CVI; you can find that here: http://digital.ni.com/public.nsf/allkb/610540BB3EA4EBDD862568960055E498?OpenDocument  and it looks to me like what you're trying to do should be supported. Are you seeing an error when you try to use the DATAQ ActiveX control, or does it just not do anything?

 

I would also check and make sure that the DATAQ ActiveX control is registered. Here's a KnowledgeBase article on how to do that: http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/4f811a9b23f1d46e862566f700615b7a?O...

 

I hope these resources help, and please let us know if you need any more assistance!

 

 

0 Kudos
Message 2 of 7
(3,579 Views)

HI, I now got to the point where all the Dataqsdk function lists appears. I am not sure how to use these functions though.

 

I have worked  with Traditonal NI- DAQ board and the first thing i had to do was intialize it like the below:

// initialize DAQ board
Init_DA_Brds (1, &boardCode);
SetCtrlVal (panelHandle, PANEL_BCODE, boardCode);
DIG_Line_Config (1, 0, 7, 1); //bit 7 is output
DIG_Line_Config (1, 0, 6, 1); //bit 6 is output
DIG_Line_Config (1, 0, 5, 0); //bit 5 is input
AO_Configure (1, 0, 0, 0, 10.0, 0); // init D2A CH0 to bipolar.0
AO_VWrite (1, 0, 0);

 

But with DI-158U i am not sure how i would do that.   The examples in the Dataq website for dataqsdk seems to be object oriented and not familiar with that at all. I am having hard time understanding  what goes in the function panel of these dataqsdk functions. Does that make any sense?

 

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

s123dip,

 

I'm afraid I don't have a lot of experience with the DATAQ hardware or SDK (DATAQ might be more able to help with that) but if you have an example and need some assistance understanding how it works, I'd be happy to take a look at it with you and try to help figure it out. I did open up the Help file for the SDK, and found the "DataqSdk Flowchart" which seems to show the order of operations required to perform an operation with the device. I'd suggest taking a look at that and see if it helps clear anything up.

 

If you do have an example and need help understanding it, please let me know and I'd be happy to look at it!

0 Kudos
Message 4 of 7
(3,548 Views)

okay so i can get the device id and driver in the program now. Now i am just trying to read a square wave from a oscilliscope. I have the dataqsdk and dqchart function lists. For some reason the program below isn't plotting anything in the chart. In the properties of sdk controll i changed the event points to 20 everything else i left as default. i don't know how the program knows when the 20 data points are collected?

int CVICALLBACK Start (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
VARIANT data;
HRESULT hr;
int i;

switch (event)
{
case EVENT_COMMIT:

hr=DATAQSDKLib__DDataqSdkStart (deviceHandle, NULL);


for (i=1; i<=100; i++)
{

hr=DATAQSDKLib__DDataqSdkGetData (deviceHandle, NULL, &data);

hr=DQCHARTLib__DDQChartChart (chartHandle, NULL, data);
}


break;
}
return 0;
}

int CVICALLBACK stop (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:

DATAQSDKLib__DDataqSdkStop (deviceHandle, NULL);


break;
}
return 0;
}

Any suggestions as to what i should do?

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

Well I don't know anything of DataQ, but being in you I'd look at error checking for the functions; that 'hr' variable of type HRESULT looks promising: search in the documentation the expected return values from the functions, instruments normally return useful informations on their status that can help you in debug this situation.,



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 7
(3,518 Views)

How'd your project turn out?  Can you share this or parts of this project with the community?  I'd like to do a CVI frontend for DATAQ hardware too.

 

Thanks!

0 Kudos
Message 7 of 7
(2,670 Views)