Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Start and Stop Acquisition of NI 6233 using external source.

This is my first project using DAQmx in labVIEW. I need to measure the current and voltage of the Device. Here is what I did:

I have made three sub Vi's which does the following operations.

1. A triggering signal is sent by the external device, at this point I should start recording the data. The port used is PFI0(Input) and Ctr0.

2. Data recording should be stopped untill a next triggering rising edge is received. The port used is PFI3(Input)

3. I need to measure the current and voltage the time at which the relay is closed, opened and between closing and opening.

 

By doing in this way I think that some of the samples are being missed. Any suggestions?

 

Do I really need to use two ports or can it be done using single port? Can it be done using a single program?

 

It would be great if anyone has an example program for this.

 

0 Kudos
Message 1 of 7
(4,327 Views)

Hi,

 

what you need are start trigger and reference trigger. Have a look at that, Figure 9:

 

Tips and Techniques in Data Acquisition Triggering - NI-DAQmx - National Instruments
http://www.ni.com/tutorial/4329/en/

 

You can have a reference trigger and a start trigger on the same PFI-Line:

 

How Do I Use a Digital Trigger in LabVIEW to Start and Stop Acquiring Data? - National Instruments
http://digital.ni.com/public.nsf/allkb/BA775B0E445BFA79482571FE0032CCEB

 

There is an example coming with the last one.

 

Regards

René

0 Kudos
Message 2 of 7
(4,301 Views)

Hello Rene,

I already looked the example you posted. But the problem is the same program should be used to trigger the system. I am facing problem how and when to trigger, start and stop record. It would be great if you could post some sample code

0 Kudos
Message 3 of 7
(4,274 Views)

Hi,

 

from the problem description you posted, I thought I did:

 

"I need to measure the current and voltage of the Device"

 

I interpreted this in a way that you are doing some kind of DAQmx Analog Input with a National Instruments Card. I assumed that you are configuring multiple input channels of that card in one task.

 

"A triggering signal is sent by the external device, at this point I should start recording the data. The port used is PFI0(Input) and Ctr0"

"Data recording should be stopped untill a next triggering rising edge is received. The port used is PFI3(Input)"

"Do I really need to use two ports or can it be done using single port?"

 

All these questions are explicitely answerd in the knowledge base (second link), and there comes an example with it. Why is this example not working for you? This examples starts aquiring when a trigger is received, and stops, when a second one comes.

 

As mentioned there, you have the limitation, that there are no real stop triggers and you have to work with reference trigger.

 

"Can it be done using a single program?"

You can do all that not only in a single VI, you can do all that in a single task. What do you mean with "a single program"? Do you mean a single VI without subVIs? Or do you mean a single while loop?

 

The answer is in both cases yes, but VI wouls you avoid SubVIs?

 

"It would be great if you could post some sample code"

 

As I said, the sample code you already have should work. When it is not, then we need to talk about why it´s not what you are looking for. "But the problem is the same program should be used to trigger the system".

 

It is in fact one single VI here that does the triggering and the aquiring.

 

Regards

René

0 Kudos
Message 4 of 7
(4,270 Views)

Sorry fr the late responce . Ihave been busy with other stuff for the past 2 days.

The attached vi is used to record data during the start and stop trigger. Actually the guy who did this left the company and i made some changes to it. 

1. Physical Channel : Is used to reaad the voltage from different devices. [Dev1/ai0:5]

2. Dev1/ai6--> For reading current.

3. TrigSource and Control Signals: Dev1/PFI0(Start Trigger), Dev1/PFI3(Stop Trigger) and the control signals used are Dev1/ctr0 and Dev1/ctr1 respectively.

 

I have seperate program to record the data in between trigger signals. this is my first project to work with the DAQmx. It would be great if can suggest me. if you need more information I can provide you.

 

Thanks.

 

 

0 Kudos
Message 5 of 7
(4,234 Views)

Hi,

 

Please correct me if I am wrong - initially you wrote:

 

"1. A triggering signal is sent by the external device, at this point I should start recording the data. The port used is PFI0(Input) and Ctr0."

 

In your code it seems that you are programming a counter task to send the trigger signals - so not from an external device.

 

If that ´s correct, the easier approach would be to use pause triggering:

when the logic on a PFI is high: aquisition, if Low, no aquisition. This is much easier to do then Start/Stop-Trigger funktionality.

 

The example code is also in the papers I sent you: look for (scan clock gating) - pause triggering in the white paper.

 

But again the question: why are the examples are not working?

 

The code you posted is not an approach to Start/Stop triggering. It is just a start triggered AI Task.

 

Regards

René

0 Kudos
Message 6 of 7
(4,202 Views)

Now i changed the complete program as you suggested. Every thing is working perfectly. Thank you.

0 Kudos
Message 7 of 7
(4,165 Views)