Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Continous measurement - Triggering with internal clock

I want to continously (until I press the stop button) measure signals with two DAQ-6024E cards and these measurements should be done with low CPU usage. The programming has to be done with VB6 and no measurement studio is available (and won't be in future).
 
I want to use the internal clock of one of the cards for triggering the measurement (usual frequency will be 0.1 to 1 Hz), however as I am quite new to programming NI cards I have some problems with the help files and the examples. I think some of the ANSI C examples of DAQmx would work, however I don't know how to transfer the functions like "EveryNCallback" to VB. And the exaples of the traditional DAQ are basically what I want to do, but these are running with high CPU usage as they use a while..wend loop instead of an interrupt. Using a timer in VB was quite easy, but these are not really accurate.
 
I found out that it is possible to create interrupts with GeneralDAQEvent and I have a working code with the "Every n scans"-property (using double buffered reading). This only reads one channel at the moment, however I hope this will also work with "Scan_Start" instead of "DAQ_Start". Basically, this is what I want. As soon as I get the interrupt, I have the values of one card in the buffer and could read the values of the second card.
 
However I'm not really lucky with this code, as I only want to read data when I need it. I saw that the GeneralDAQEvent can use a counter signal as interrupt. If I could set up a counter using the internal clock, it was possible to use this to create the interrupt and the I'd just have to read all channels from both cards using the "AI_Read_Scan" Function. In my opinion, this was the best way to do it.
 
Anyone got ideas how I could achieve this? Or any other solution? I doesn't really matter wheter I use Traditional DAQ or DAQmx, the only limitation is that I have to use VB6 and no measurement studio is available.
 
Thanks in advance, Jogyb
0 Kudos
Message 1 of 4
(7,199 Views)
Hi JogyB,

take a look at the NI Developer Zone there you will find the example
NI-DAQmx: MIO Continuous Analog Acquisition with NI-DAQmx and VB6
This example demonstrates how to acquire multiple readings from multiple analog input channels with internal clock.

Best regards,

Benjamin
0 Kudos
Message 2 of 4
(7,193 Views)

Hi Benjamin,

the problem with this example is that it uses the Visual Basic Timer for creating an interrupt. Therefore there still is the problem of the inaccuracies of this timer, so I won't get a reliable time scale - deviations of 1% are quite normal when using this one. This is why I wanted to use the internal clock for creating the interrupt, as this should be much more accurate.

At the moment, I use an implementation of the Multimedia Timer API, which seems to work quite well (as long a I have a continuous time scale running and correct the timer interval at each interrupt). However, a clock which doesn't rely on the computer (and therefore might be inaccurate when CPU load is high) would give me some more security.

Best regards, Jogy

0 Kudos
Message 3 of 4
(7,191 Views)
Hi JogyB,

take a look at the NI Developer Zoneuse the search engine with the seach term "DAQmx Visual Basic" you will find examples for your request
NI-DAQmx: Continuous Analog Acquisition with NI-DAQmx Events in Visual Basic 6.0

Best regards

Benjamin
0 Kudos
Message 4 of 4
(7,158 Views)