Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

acquisition for displaying on screen

Hi,

I am wondering what is a good method for acquisition (analog voltage input) when I am just displaying the result on the screen without saving the data.    Currently I am in a loop that is getting 50 samples at a frequency of 500Hz then I average those 50 samples to display the average in textbox (or label).  I am wondering if that is efficient or if there is a better way.

I set this up using VB6 with measurement Studio and when I the acquireddata event would occur I would display the result.  I am now programming VB6 with NI-DAQmx thru the API functions and basically doing the same comparable operation.

thanks for any help, David Smiley Happy
0 Kudos
Message 1 of 5
(7,350 Views)

Hi Davie=d

It sounds like you may have been using Traditional DAQ at one point and using the acquireddata event to know when to handle and process the 50 sample batch that had been read.  The DAQmx Read function in VB6 would be configured to pull 50 samples at a time during a continuous acquisition, and when that function returns those samples you could average them at that time.  The time that it takes to process the returned data should not interfere with the acquisition since you have such a low sampling rate. I always like to point my customer to other resources in your case this example would be very useful. Please make sure that you have look at the VB6 examples located in this path “C:\Program Files\National Instruments\NI-DAQ\Examples\VBasic”.

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 2 of 5
(7,332 Views)
thanks for your reply,

I am not sure if I explained my self properly.

My question was not related to using MS or DAQmx api.

FYI, I was able to do the same thing in daqmx with an event callback and the DAQmxRegisterEveryNSamplesEvent function.

I basically want to know if there is a standard method of acquiring data that is not being save but just being displayed on the screen.  I want to make sure I am not making to many scans of the hardware to display on the screen and it is not efficient.  I though someone might say something like...'update your screen every 100th of second by taking 10 samples at 1000hz' blah blah blah.

thanks, David
0 Kudos
Message 3 of 5
(7,332 Views)

Hi David,

Thanks for replying back David, the efficiency of what you are doing will depends on what you want to accomplish and how fast your signal is changing. For example if you have a sine wave of 1KHz you need to sample faster than if your signal changes at 1Hz In your case you are getting 50 samples at a rate of 500 Hz that means that it will take you 0.1 seconds to get the 50 samples. As a rule of thumb we want to set the buffer size (N samples to read) to 10% of the sampling rate; for example buffer size of 100 “samples” for a sampling rate of 1000Hz. Also make sure that your algorithm is running fast enough that is not slowing down your reads.  This will work the same for saving or for displaying the data on the screen.  We do not have a standard method for how much data to read to get the best display, what I would suggest is tryng to get the best display; according to what you need, with the minimum amount of reads to the card. I hope that I was able to understand your question and help you.

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 4 of 5
(7,268 Views)
thanks for the info, it was very helpful.
0 Kudos
Message 5 of 5
(7,253 Views)