Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

stream to disc with VB and USB-6343?

Hello All:

 

I bought a couple of USB-6343's under the mistaken impression that there was example VB code available for streaming multiplexed channel data (at 500kHz) to disk with the ability to read it out afterward.  Does anyone know if this is a difficult operation and/or can point me to a code/command reference to try to figure out how to do this?

 

Thank You Very Much In Advance,

PattiMichelle

0 Kudos
Message 1 of 12
(7,188 Views)

Patti,

 

Could you please clarify--what are the signals you are trying to acquire?  Are they analog, digital, or are you trying to set up some sort of counter task with them?  Also, are you using VB6 or VB.NET code?

 

VB.NET examples are installed with the driver under 

...National Instruments\NI-DAQ\Examples\DotNET3.5

 

For VB6 examples, please see the following KnowledgeBase Article:

NI-DAQmx Examples for Visual Basic 6.0

http://digital.ni.com/public.nsf/allkb/735848148B5B4964862571F5004692C7

 

By default, when you specify multiple channels, the DAQ hardware will multiplex through the channels without you having to explicitly write a command to do so.  As for streaming applications, I assume you either mean something that is acquiring continuously, or something that is streaming directly to disk.  Examples for "Continuous Acquisition" would show the former, Examples for "TDMS Streaming" would show the latter.  Could you clarify what you mean?

 

Regards,

Andrew

National Instruments
0 Kudos
Message 2 of 12
(7,178 Views)

Thank you very much for the reply.  I am trying to acquire analog signals at full speed, one per channel, change to next channel, acquire, change to next channel, acquire, etc.  I would like it triggered by a transition voltage (1 V square pulse).  And stopped when a keystroke is hit?  Is that doable?  I called NI before buying these and was told they would do so, though I think there was a miscommunication - I don't use LabView and the NI sales rep may have assumed I do.

 

Happy Holidays!!!!!!!!!!!!!

 

PattiMichelleSmiley Happy

 

EDIT:  Not sure I was clear - I want to collect 6 - 8 multiplexed channels, one sample per channel, streamed to disk at ~500kHz.  WIth the Continuous Acquisition, it can only acquire until memory is full then must stop acquiring and write to disk.  I need to stream directly to disk so I can acquire based only on available disk space (not memory size).  I will take a look at the app you mentioned, but I thought that was for LabView...

0 Kudos
Message 3 of 12
(7,165 Views)

Thank you again - I looked through the locations listed in the Knowledge Base Article - but did not find an VB 6 example for direct-to-disk streaming of multiplexed AI.  Can you give the specific name of this example?

0 Kudos
Message 4 of 12
(7,119 Views)

Hi Patti,

 

You're right, a lot of the literature points to using the TDMS direct-to-disk streaming functionality through LabVIEW.  However, since the NI-DAQmx driver is more general across plaftorms, it also contains this functionality for C using the DAQmxConfigureLogging function (I attached a screenshot).

 

The DAQmxConfigureLogging function is the equivalent of the LabVIEW VI called "TDMS Logging".  This function allows you to bypass loading the data programmatically handling it, and as per this DevZone, achievable speeds are upwards of 1.2GB/s.  I attached a screenshot of the function reference from the DAQmx C Help.  In my ANSI C examples folder, any of the TDMS examples under \Analog In\Measure Voltage show use of that function.  In order to specify multiple channels, you simply write each channel into the string you pass into the DAQmx function which creates the Task, and it will automatically multiplex through the channels you specify.  For instance:

 

One channel: "Dev1/ai0"

Multiple channels: "Dev1/ai0,Dev1/ai1,Dev1ai2..."

 

As for trying to multiplex 6-8 channels at 500kS/s, your 6343 card should be able to handle that, but as an aggregate.  Either a certain channel can be sampled at 500kS/s, or you can switch between channels for a total of roughly 500kS/s aggregate.  You can see the 6343 Specifications for confirmation, or look at this 

 

Also, searching for TDMS logging on ni.com provides some useful information for interfacing with TDMS, since TDMS was fashioned by NI.  I found this KnowledgeBase which you may find useful if trying to interface with TDMS files through other programming environments.

 

I hope this helps,

Andrew

National Instruments
0 Kudos
Message 5 of 12
(7,115 Views)

Thanks - my problem is I'm not a C programmer and was led to believe by NI that I could accomplish aggregate multiplexed streaming using VB.  Maybe that can only be done with in-line C code or a VB -> WinAPI call?  I understand most of the hardware - I'm just not getting the software correct.  I purchased a NI support contract so I could get help getting this going.

 

Patti

0 Kudos
Message 6 of 12
(7,096 Views)

Hi Patti,

 

I'm confident you can accomplish multiplexing 6-8 analog input channels by modifying the Visual Basic examples.  NI sells tools (LabVIEW, TestStand, DAQ cards, etc.) to help users create a solution to suit their specific application.  It is not often that an example program accomplishes 100% of the desired result, but often example programs may be tweaked or combined to accomplish the desired result.  Example programs are designed as a starting point and as a guide for best practices.

 

If you have an SSP contract, you can call in and create a service request for specific questions.  The number is 1-866-ASK-MYNI (275-6964).  We do provide support for development in our software packages such as LabVIEW, DIAdem, CVI, etc. (in fact, CVI is a text-based language built off of the C language.)  However, when using our products with an external language such as Visual Basic or C, there is a knowledge of the programming language required by the user to program and call our DAQmx driver to access the device.  As I mentioned before, we have an assortment of shipping examples for both VB and C that accomplish common DAQmx Tasks, and you can tweak the channel string to account for multiple channels in the examples we looked at.  However, regularly coding in VB or C for the rest of your program is not something that we support.  You might want to look at this external resource if you want to learn more about VB.

 

If you're looking for more resources to how to work with our products, you have some options.  There are online resources for self-guided learning DAQmx with text-based (see also some of the links above).  If you're looking for more instructor-led courses in your area, there are regional courses that you can arrange for your needs (I'd recommend speaking with your Field Engineer or calling your account manager at NI).  Speaking with someone from NI can help you decide which courses or material is most relevant to the application you're designing for.

 

I'm not sure how to answer your specific question about using an in-line C code or VB --> WinAPI call, but I'll try to answer it.  Yes--the DAQmx functions are in-line C code which you call and pass configuration parameters to (for example, because your application involves multiple channels, you would write each channel into the String parameter in the Create DAQmx Task function--again, a single channel would look like this: "Dev1/ai0" and multiple channels would look more like "Dev1/ai0,Dev1/ai1,Dev1/ai2," and so on out to the 6th or 8th channel, or you could abbreviate using "Dev1/ai0:7")

 

I hope this helps steer you in the right direction.  Please let me know if I can be further assistance.  Again, remember an SSP contract enables you to call in for support, so you could talk to an Applications Engineer directly.

 

Regards,

Andrew

National Instruments
0 Kudos
Message 7 of 12
(7,079 Views)

>  I'm confident you can accomplish multiplexing 6-8 analog input channels by modifying the Visual Basic examples.

 

Yes, I can do that and have done it before - what I am looking for is high speed streaming multiplexed data direct to disk (not into memory).  Do you know of a VB example for that?  That's basically what I have been looking for for the last several weeks and have been unable to find it in the online example library or the examples that NI-DAQ installed to my hard drive.

 

Patti

0 Kudos
Message 8 of 12
(7,076 Views)

Hello Patti,

 

I have searched our website as well, and unfortunately there are no VB6 examples written to implement the TDM/TDMS data format.  As Andrew mentioned in his previous posts, we provide the tools for you to do this.  Take a look at the links that Andrew has provided for reference in developing your VB6 application.  You might also find this Microsoft article useful.

How To Write C DLLs and Call Them from Visual Basic


Rod T.
0 Kudos
Message 9 of 12
(7,049 Views)

Do you know if there might be a DLL already existing?   I was told by the engineer before buying two of these units that they supported stream to disk via VB6.

0 Kudos
Message 10 of 12
(7,038 Views)