Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Use of "Change detection" Timing vi to sync an Analog input with an external signal

Hi everyone,

 

I am using a CompactDAQ 9178.

 

I have a sensor outputing a 30000 Hz digital signal, composed of one 250 ns falling edge every 1/30000 sec, as in the picture attached.

The digital signal is connected to a NI9401 and I'm measuring its frequency.

 

I want to take a sample of my analog input NI9215 (pressure reading) at every Falling edge of the digital signal. it is very important that these two task are sync. (See P.S 2 for details)

 

So I build a VI with timing "change detection" but I don't know if I have to put the sample mode in Finite sample and wired 1 sample, or if I need to put continous sample ?

For the moment I put continous sample and set the DAQmx read according to it (1 channel 1 sample).

 

Could you please have a look at my vi and tell me how to configure it ?

I just want to be sure I take my pressure measurement when the signal on the 9401 is falling (a very short fall because the pulse duration is only 250 ns).

 

 

Thank you very much,

 

Guillaume.

 

 

P.S : I have first build a Vi with DAQmx trigger "start on digital edge", to start a AI task on every falling edge, but I have read that it will be too slow to start a task and stop a task every  3,3 *10^-5 sec, could you confirm that ? that's why I am interested in "change detection" timing vi.

 

P.S 2 : In my application, the input signal come from a crankangle encoder outputing a falling pulse every 0.1°. Therefore at 500 rpm it is a 30000Hzsignal. I want to take a pressure measurement inside the cylinder every time the crankangle encoder ouput the pulse, so every 0.1°

Message Edited by gdlbb on 02-06-2010 05:11 PM
Message Edited by gdlbb on 02-06-2010 05:12 PM
0 Kudos
Message 1 of 8
(4,640 Views)
At the end, I want to end up with a graph of the Pressure vs Crank angle. I have noticed that even if I erased the Metronome from my Vi, I think the duration of an iteration of the while loop will be greater than the period of the signal, Is it a problem ? (I am quite confused... 😞 )
Message Edited by gdlbb on 02-06-2010 05:36 PM
0 Kudos
Message 2 of 8
(4,632 Views)

So I tried it today and It did not work, It never reads samples 😞

 

My signal is looking like the picture number 1, And lengh 250 ns

 

I tried also with singal on picture number 2, with a pulse lengh of 1,5 ms, and it did not work either.

 

Enclosed also my last Vi with a waveform graph.

 

Many thanks,

Guillaume.

0 Kudos
Message 3 of 8
(4,592 Views)

Hi Guillaume,

 

Have you tried the Cont Acq&Graph Voltage-Ext Clk.vi example?  It's designed to measure a point of analog data based on an external sampling signal, like the digital input you want to use. You should be able to add a parameter to that one to sample on the falling edge as you desire.

 

Regards,
Kyle

0 Kudos
Message 4 of 8
(4,569 Views)

Thank you for your reply,

 

I look into the example you suggest. If I defined the clock source as PFI0 on my 9401, It will automaticaly sync the clock on the rising/falling edge of the signal ? (I'm not sure..).

 

I don't understand exactly why I need to spécified "rate" if The rate is determined by my signal.(1 sample every falling edge).

That's what I read about it in the Help : "If you use an external source for the Sample Clock, set this input to the maximum expected rate of that clock"

Does it means that It will acquire XX samples of data at Rate YY every Clock Tick ? So If the clock tick is really fast, and I set a High number of samples with a low rate, Every samples will not have the time to be read before the next clock tick am I right ?

 

So If I want 1 sample on every tick (<=> falling edge of my digital signal), I put a high rate  (30 kS/s) and 1 sample per channel am I still right ?

 

With the experience I got with Digital input, sometimes It seems that source pulse too short to be detected by DAQ/labVIEW with digital input only, and has to be detected with a counter.

 

That why I built the vi :  Cont Acq&Graph Voltage-Ext Clk + Create Timing Source (counter).vi

 

Can you also please have a look at it and tell me if it is ok ?

I linked the "pink" output of "create timing source" to the purple input of DAQmx timing "clock source", and It looks compatible (I don't what's the difference between these two colors type.

 

Thank you very much for your replies, and very sorry for my high number of questions !

 

Guillaume.

Message Edited by gdlbb on 02-13-2010 04:05 PM
Message Edited by gdlbb on 02-13-2010 04:06 PM
0 Kudos
Message 5 of 8
(4,534 Views)

Hi Guillame,

 

Your VI looks like it should work well for your application.  Don't worry, the sampling will be completely controlled by your external signal; NI-DAQmx uses the sample rate you specify to allocate memory buffers and provide accurate timing information through the waveform data type.  You should use the maximum expected rate of that clock, regardless of what you're sampling with it.

 

Your application probably doesn't need to use the counter to detect the edge, but it should work very well this way too.

 

Glad to help and hope your application is up and running.

 

Regards,

Kyle

0 Kudos
Message 6 of 8
(4,502 Views)

Thank you, very good link !

 

My (final ?) question :

At the same time, I will measure the frequency of the pulse signal with one counter (CTR0).

If I use the First vi (Cont Acq&Graph Voltage-Ext Clk (original).vi) And I set the external clock source to "CTR0internal output" will it work ? (I cannot test it for the moment).

 

Or maybe I should choose another option in the list (see attached file).

 

I imagine that to be able to measure the frequency, It must count edge before, so it might be possible to use this data as the clock source.

 

I have explained it more clearly with two little comments on the block diagram of the attached file.

 
I'm very glad you helped me, really.

Thank you very much indeed.

 

Guillaume.

Message Edited by gdlbb on 02-16-2010 04:32 PM
0 Kudos
Message 7 of 8
(4,480 Views)

Hi Guillaume,

 

If you want to run your frequency counting task and your analog input task on the same signal, you'll want both to share the same input. /cDAQ1/Ctr0Source (or simply the digital line your signal is on, e.g. /cDAQ1/Mod3/PFI0) sounds more appropriate for this application.  Using the counter output would be desirable if you were generating a signal with the counter (like a PWM output).

 

You're welcome!

 

Regards,

Kyle

0 Kudos
Message 8 of 8
(4,471 Views)