Jump to content

Communicating with USB DSO without NI-VISA using Driver DLL


ashwin

Recommended Posts

Hi,

I am trying to use an ADTEK ASB-3000 Digital Stotage Oscilloscope with LabVIEW. I am trying to use Driver DLL given by vendor. They have given API for DLL exported functions. I have the following functions:

ASB3000create

ASB3000setmode

ASB3000StartSampling

ASB3000getstatus

ASB3000getdata

ASB3000stopesampling

using LabVIEW, I am able to create connection with device using ASB3000create function with CALL LIBRARY FUNCTION method. I am also able to SET MODE with settings information sent from LabVIEW. I am also able to use AB3000StartSampling.

The problem is that I want to poll the device for receiving its status and data ( using ASB3000GetData and getstatus functions).

I tried listening to the device using Queue but its not able to listen to DATAREADY message i.e. 1125 ( Decimal) please convert to equivalent HEX. Until I receive DATAREADY message, I can't start start reading data using ASB3000GetData function. In a VB sample program, they are constantly polling for DATAREADY and then running getstatus and getdata functions, if they have DATAREADY msg received from device.

Also, I don't want to use NI-VISA RAW method and use vendor driver DLL.

Any help on polling the device to receive message for DATAREADY? any example VI for similar device will be a great help.

Thanks

Ashwin

Product Test Automation Group(LabVIEW)

QuEST

Link to comment

Anybody coming up on this please?

I think we can use messaging queues for this along with dynamic events? want a more focused example?

Thanks a ton in advance

Ashwin

PTAG (Product Test Automation Group)

QuEST

QUOTE(ashwin @ Jan 26 2008, 07:53 PM)

Hi,

I am trying to use an ADTEK ASB-3000 Digital Stotage Oscilloscope with LabVIEW. I am trying to use Driver DLL given by vendor. They have given API for DLL exported functions. I have the following functions:

ASB3000create

ASB3000setmode

ASB3000StartSampling

ASB3000getstatus

ASB3000getdata

ASB3000stopesampling

using LabVIEW, I am able to create connection with device using ASB3000create function with CALL LIBRARY FUNCTION method. I am also able to SET MODE with settings information sent from LabVIEW. I am also able to use AB3000StartSampling.

The problem is that I want to poll the device for receiving its status and data ( using ASB3000GetData and getstatus functions).

I tried listening to the device using Queue but its not able to listen to DATAREADY message i.e. 1125 ( Decimal) please convert to equivalent HEX. Until I receive DATAREADY message, I can't start start reading data using ASB3000GetData function. In a VB sample program, they are constantly polling for DATAREADY and then running getstatus and getdata functions, if they have DATAREADY msg received from device.

Also, I don't want to use NI-VISA RAW method and use vendor driver DLL.

Any help on polling the device to receive message for DATAREADY? any example VI for similar device will be a great help.

Thanks

Ashwin

Product Test Automation Group(LabVIEW)

QuEST

Link to comment

QUOTE(ashwin @ Jan 27 2008, 04:56 AM)

Anybody coming up on this please?

I think we can use messaging queues for this along with dynamic events? want a more focused example?

Forget the queues for a moment. You want to call those DLL functions in a loop or something and test it's return value or it's returned parameter until it gives you the value to tell you it is ready. Then you call the function to retrieve the data or do whatever else you want to do.

There is no way to use LabVIEW queues or such directly with the DLL. Once you have the DLL calls working properly you can of course develop a VI library that could give you a queue based interface. But I do not think that would have real advantages over a more direct VI library approach directly.

Rolf Kalbermatter

Link to comment
  • 2 weeks later...

QUOTE(ashwin @ Jan 27 2008, 10:56 AM)

Hi,

I am very new in Labview and I am trying to use an USB-device in labview. The manufacturer supplied me with a dll, sys and inf file for this analog devices AD7746 evaluation board that is connected to the computer by USB.

I understood from numerous forums that I had to use the call library function to import the dll file in labview and that I could use NI Visa to have the USB device recognized by NI Measurement and automation.

But how can i do this? Could somebody please give me some directions or supply me with an example of a labview file where a dll file is called for the USB device?

Thanks so much.

Regards,

david.

Link to comment
Download File:post-10588-1202299207.zipThanks Rolf,For guiding me in the right direction.I have actually accomplished enough except a few things. I am able to acquire signal. I called various DLL functions but I could not get DATA READY status. There is no function in the given DLL for checking if data is ready, so I actually got the Data and then checked for its correctness cuz a GETDATA function in DLL gives me the data and I am checking 10000 Samples. As soon as I get 10,000 Samples, I get out of the WHILE loop, of course after doing some more processing.Also I could not implement the STOPSAMPLING and CLOSEASB functions of the DLL, very well using CALL LIBRARY FUNCTION node so I used a workaround calling them from VB and writing ActiveX DLL. If you try to use the STOPSAMPLING function from DLL in LabVIEW, it always gives an error, depite of giving correct DataTypes in arguments....I just want you to verify my acquisition process and any ideas to find when data is ready in the device.If you got some Idea on improvement of my code please let me know...i am uploading the code.. its one hell of a messed up coding though, cuz I had to finish this before a set timeline......but it works...ThanksAshwinQUOTE(rolfk @ Jan 28 2008, 03:27 PM)
Forget the queues for a moment. You want to call those DLL functions in a loop or something and test it's return value or it's returned parameter until it gives you the value to tell you it is ready. Then you call the function to retrieve the data or do whatever else you want to do.There is no way to use LabVIEW queues or such directly with the DLL. Once you have the DLL calls working properly you can of course develop a VI library that could give you a queue based interface. But I do not think that would have real advantages over a more direct VI library approach directly.Rolf Kalbermatter
David,I think the code I uploaded for Rolf to review can solve your problems...Its huge so just find the CALL LIBRARY FUNCTION part....Also I have called the functions from my DLL, so please use API provided by your Device manufacturer for info on your DLL functions, I have used mine...ThanksAshwin
Link to comment

QUOTE(ashwin @ Feb 6 2008, 07:09 AM)

http://lavag.org/old_files/post-10588-1202299207.zip'>Download File:post-10588-1202299207.zipThanks Rolf,For guiding me in the right direction.I have actually accomplished enough except a few things. I am able to acquire signal. I called various DLL functions but I could not get DATA READY status. There is no function in the given DLL for checking if data is ready, so I actually got the Data and then checked for its correctness cuz a GETDATA function in DLL gives me the data and I am checking 10000 Samples. As soon as I get 10,000 Samples, I get out of the WHILE loop, of course after doing some more processing.Also I could not implement the STOPSAMPLING and CLOSEASB functions of the DLL, very well using CALL LIBRARY FUNCTION node so I used a workaround calling them from VB and writing ActiveX DLL. If you try to use the STOPSAMPLING function from DLL in LabVIEW, it always gives an error, depite of giving correct DataTypes in arguments....I just want you to verify my acquisition process and any ideas to find when data is ready in the device.If you got some Idea on improvement of my code please let me know...i am uploading the code.. its one hell of a messed up coding though, cuz I had to finish this before a set timeline......but it works...ThanksAshwinDavid,I think the code I uploaded for Rolf to review can solve your problems...Its huge so just find the CALL LIBRARY FUNCTION part....Also I have called the functions from my DLL, so please use API provided by your Device manufacturer for info on your DLL functions, I have used mine...ThanksAshwin

Sorry, I can't do much with that library. I have no idea why stopsampling would not work, but do think that you got something wrong with the parameter types despite you claiming otherwise. That or you are not initializing a parameter called by reference properly.

The library is one big mess and 300% to complex I think. It could be done with just about 6 or so VIs and some helpers maybe. ActiveX is most probably unnecessary. Your use of queues seems not right and makes everything to complicated.

But I can't see how to do it better, since I do not see anywhere the API prototypes of the DLL, nor can I see the VB code of the ActiveX DLL, nor do I understand the involved architecture of this seemingly simple driver.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.