10-17-2009 09:14 AM
I wanna acquire continuous datas using the USB-6008 in VB , but I can't find how to use "EveryNCallback" in VB!
there is any way to acquire datas continuing for real time computing in VB?
Thinks!
10-19-2009 06:51 AM - edited 10-19-2009 06:52 AM
Sorry,I had mistook. Today I have read the "Cont Acq-Int Clk" for ANSI C, and found it was not realized the function that I want.
Actually,I want the DAQ device to return the data to heel the every single step sampling but not after a amount of sampling.
My English is poor. Ask me if anywhere unclear!
10-19-2009 10:41 PM
Hi there,
I'd like to know what is your hardware settings and what is your requirements(like sample rate etc.)
So, we have two approachs,
1. if your sample rate is very very slow, below around 300Hz, I think you can perform one sample at one time using software timed acquire, that's ok
2. if your sample rate is around 1KHz and above, I think you should refer to hardware timed acquire, which is what your programme has done,
And I think you should learn some more thing about DAQ yourself to perform your task
10-20-2009 02:03 AM
Thanks for your reply,NIhuyu!
At present,I require one channel to sample and I hope the sample rate as fast as possible.(NI USB-6008 Maximum AI Sample Rate is 10kHz)
What's the meaning of "hardware settings"? Is it "Channel Parameters" or "Physical Channel" or "input voltage level of the measured signal range"? Maybe those are irrespective.
Or is it driving at my PC hardware?
I have found some examples for VB on the www.ni.com the other day.One of them names "NI-DAQmx: Continuous Analog Acquisition with NI-DAQmx Events in Visual Basic 6.0".
It is able to make it by setting the "Samples/Channel/Read:" & "Samples to display" to "1".
But new question! After pressing "Start" it does work,but a moment later it show a msgbox saying "In task done event handler" with only one CommandButton "OK".What's the meaning of that?
10-20-2009 02:33 AM
so there is only one USB-6008, you just get one channel working, and you'd like to set your sample rate as high as possible.
Base on these requirements, I think you should do a hardware timed acquisition, that is with a buffer on board. For the PC can not run as fast as your
sample rate, we must have a buffer to store samples, the device can acquire sample one by one at a short cycle time, and PC can get a set of samples
at a longer time, this is how we implement fast data acquisition on PC.
So, in your situation, you can not view the sample one by one, but group by group, you can adjust the parameter in the program to achieve this.
Your another question, because VB is rarely used in our application, I don't have any idear about that error, I think it is related to the event engine of windows,
if you set "sample to display" as 1, the event should always take place, you can try your first example on hand, set the parameters like this:
sample rate: 10K
samples to read: 3K
and see if it can work well,
10-20-2009 04:45 AM - edited 10-20-2009 04:51 AM
The device can return a set of samples after a amount of sampling(at least 1000 times, that's enough), namely at a longer time.
Maybe there is RAM in the device which I didn't find on the user guide & specifications.
Well.Now I have known the bottleneck is the slow reaction of PC.\(^o^)/
The examples of VB still doesn't work. its parameters settings show in the picture.
If I set the Sample Rate above 300Hz it show that msgbox after seconds ,if below 300Hz, it can work longer, .
And if I set like this:
it can work well,even the Sample Rate up to 10kHz.
Wait for anyone who can settle this.
Thanks for your patient help,NIhuyu!
Yutong Sun
02-03-2010 06:35 PM
Hello,
I am using VB with NI-DAQmx and am having a problem that my VB environment crashes when I close the sample listed above. "NI-DAQmx: Continuous Analog Acquisition with NI-DAQmx Events in Visual Basic 6.0".
I have my own app that crashes also. I was hoping the example would work but it does the same thing as my code.
I was wondering if you have had the same problem and if you were able to fix it.
Thanks, David