Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6221 examples in visual basic

Hi,
Just bought a PCI-6221 card but couldn't find any examples after installing the driver and support programs. I'm new to this card and needed help on the following areas in VB6 (without the Measurement Studio) :
 
1) How to write a program to configure the DIO to either input or output which the user can defined as required.
2) Continuous read the digital input and set an output signal when required.
3) Single read on multiple analog input upon trigger.
4) Single write on the 2 analog output upon trigger.
 
Beside that, where can I find more information on the wiring setup for the analog and DIO connection.
 
Thanks in advance for any advice given.
 
Jason
   
0 Kudos
Message 1 of 6
(5,365 Views)

Hi Jason,

Let's see if we can get you up and running. When you install NI-DAQmx, you are given install options such as support for Visual Basic 6.0. This will install examples to your hard drive that you can find in the default location of C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\Visual Basic 6.0. If you don't see these files, go into Add/Remove Programs in your control panel and edit your National Instruments installation of NI-DAQmx.

In here you should be able to find many different examples dealing with analog I/O, digital I/O and triggers. Also, I've added some links that can help you out dealing with DAQmx and VB6.

Getting Started with NI-DAQmx: Main Page

KB 41P6PDLA: NI-DAQmx Examples for Visual Basic 6.0
KB 3146J6FQ: Programming DAQ in Visual Basic 6.0

 
PBear
NI RF
0 Kudos
Message 2 of 6
(5,337 Views)

Thanks. Managed to find the samples but still have some queries regarding running multiple task and multiple channel in VB6.

Below are some of the doubt that I have:

1) Is it possible to create and start more than 1 task, for example 4 task with different measurement channel like digital input, output, analog input and output together?

2) Or just 1 task to handle the different measurement channel as mentioned above?

3) Or is it faster to start stop individual task when required? 

Pls help asap, thanks.

0 Kudos
Message 3 of 6
(5,302 Views)

Hi Jason,

A single DAQ board can run one task at a time. That task can contain mulitple channels of varying type but you can not have multiple timing engines. So the answer to your question is #2. Try looking through the Getting Started With DAQmx tutorials and you will gain a better understanding of how to program with DAQmx. There are quite a bit of examples and also some very useful information in there. For example, this is one of my favorite pages: Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications

 
PBear
NI RF
0 Kudos
Message 4 of 6
(5,288 Views)
Hi Patrick,
 
Thanks for the info, but I can't find much help in VB6 on the problem that I've in those area.
 
Can you briefly explain how to create and add multiple channel in a task and execute the channel when required?
 
Is there any example on this areas?
 
Below are the task that I'm trying to achieve:
1) continuous monitor some digital and analog inputs channel
2) write to a digital and analog output channel when required
 
I've no problem loading and executing each channel individually but have some problems monitoring the digital and analog input together.
 
Please advise asap as I'm stuck in my project due to this.
 
Your help is greatly appreciated!
 
Thank you,
Jason
   
0 Kudos
Message 5 of 6
(5,275 Views)

It is straightforward to create a multiple channel task.  For example, the Acq-Int Clk.frm example to measure analog inputs contains the function :  DAQmxCreateAIVoltageChan.  This function is used to configure the analog inputs.  To read from more than one channel all you need to do is specify the range of channels you want to read instead of a single channel. The second input to this function is “physicalChannel.”  Either hard coded or in the user interface you can enter Dev0/ai0 to read from one channel or Dev0/ai0:4 to read from channels 0 – 4.  It is as simple as that.  The “data” read back will now be a multi-dimensioned array with the various channels.

All of this information can be found in the help files Start >> Programs >>National Instruments >> NI-DAQ >> NI-DAQmx C API Visual Basic 6.0 Help c and the NI-DAQmx C Reference help.  The NI-DAQmx C functions and Visual Basic 6.0 functions are basically the same.

 

You might also look for at the DAQmx ANSI C examples.  They can be easily converted to Visual Basic 6.0.

This link explains how to convert them:  NI-DAQmx Examples for Visual Basic 6.0

 
Jared T.
0 Kudos
Message 6 of 6
(5,243 Views)