Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

VB2005 & DAQmx, I want to read 2-AI and 2-CI (quadrature[X1]) in 2 tasks 1 timebase to Access table.

I am using VB 2005 on Vista and NI-DAQmx (8.5.20.22) with a PCI-6220 board.
 
I want 2 tasks to gather data using the same time base to gather data on 100 microsecond ticks.  Each tick needs to read 2 AI channels (differential) and 2 CI channels ( quadrature X1 decoding type). I will start the timer at 0 ticks and increment up until stopped or to a maximum of 50,000 ticks.
 
Each tick will be stored in an Access table with fields: ID, ticks, Analog voltage X, Analog voltage Y, Counter value X, Counter value Y.
 
The AI is currently working by starting with on to your examples.  I am currently having problems adding the counter.  The 'Learn 10 Functions' help file indicates that I should be able to do this.
 
I need to know how to set up a quadrature counter using 2 inputs. 
I need to read the counters on each tick that I use to read the analog inputs.
The analog and counter data needs to be saved in a Access table.
What is the best way to stop the tasks before the maximum is reached?
 
Next read and write of digital inputs and outputs will be added.
 
The Visual Studio has an 'Object Browser'.  Is a document available that explains each of the DAQmx Classes and the related Properties, Methods, and Events?
0 Kudos
Message 1 of 2
(2,975 Views)

Hi UTvol,

To get the counter to work, search the .NET help (Start » All Programs » National Instruments » NI-DAQ » .NET Framework 2.0 Help) for “create angular” (make sure you’re looking at “local support”) and you’ll be able to find the right CI channel method.

To get the counter to read at the same time as the analog input, you’ll want to share the analog input sample clock. The syntax for the sample clock is “/devx/ai/sampleclock”, where ‘x’ is the number of your device in Measurement & Automation Explorer (MAX).

The signals A and B from your encoder need to be connected to the correct pins for your device. The pinout is found in the user manual or in MAX by right-clicking the device and selecting “Device Pinout”.


I have no experience using VB .NET with Access, but I did a Google search (“vb .net create access table” or similar) and found a few links that might be helpful:

http://www.dotnet4all.com/Dot-Net-Books/2004/08/creating-table-in-access-database-with.html

http://www.vbforums.com/showthread.php?t=251384

http://www.thescripts.com/forum/thread369481.html

 

There is a property node for the total samples per channel acquired that you can combine with the iteration count of the while loop to stop it when it reaches that number (or greater than that number to be safe). This would be OR’ed to the stop terminal. As there are several methods used in VB .NET to perform the read operation, this may be done in different ways, and there might be a better way. That’s just the way I would do it.

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 2 of 2
(2,964 Views)