Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI6120 -Acquire an analog signal on every edge of a digital signal

Solved!
Go to solution

Hi ,

I have PCI-6120 card and Labview 7.1.

I have a digital signal from encoder. I wish to acquire analog voltage on every rising edge of the digital signal. In addition I have another digital signal ( index) between which I wish to carry out the acquisition.

 

I have tried several options. But I cannot acquire on the digital edge via the hardware. Please help urgently. Alternative I have migrated to acquiring high speed acquisitions on analog and the two digital channels and deteting the change in software programming and then finding the analog voltage. Which is cumbersome and inefficient.

 

Kindly guide for correct programming technique.

 

Regards

Shradha

0 Kudos
Message 1 of 7
(3,902 Views)

Hi Shradha,

 

Good afternoon and I hope your well today.

 

Thanks for your post/question.

 

You should be able to setup an Analog DAQmx Task with two important aspects,

 

1. use an external clock source to clock the acquisition. You can do this by configuring the sample clock DAQmx VI. So this would be use Digital Signal index. This will need to be TTL (very clean) pulse. 

 

2. You can use a Digital Edge Start Trigger and the source can be the signal from the encoder. 

 

Note: You must make sure the number of samples you require is smaller than the frequency of your encoder pulses.. otherwise your acqusition may not have completed.

 

The example below shows the two VIs. The image is a finite DAQ - so you would need to make this re-triggerable.

 

Hope this helps to get you started, 

 

If you want to post back .. I'd be interested to know the frequency of the signals and if its a Voltage your acquiring.  I am also interested in what you have tried up to this point.

Message Edited by Hillman on 04-08-2009 05:30 PM
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 7
(3,886 Views)

Hi James,

Thanks for your interest in the problem.

I have the following signals :

1. Index pulse at 0.5 Hz. ie 1 per 2 secs.

2. Encoder pulses at 2048 Hz. ie. 4096 pulses in 2 secs.

3. A time varying analog signal which is random.

Between the two index pulses,  I wish to measure 1 analog signal sample at  each rising edge of the encoder.

 

Now on what all things I have tried . The CARD is PCI 6120.

1.  acquire analog waveform with , digital edge start as encoder and index as reference trigger. This was totally confusing on what is happening.

 

2. I tried to use " Change detection " on encoder edge as clock source and index as digital edge start. But It says that the card doesnt support change detection !!! I expected to acquire one analog sample on every clock ( encoder edge).

 

I have tried the code you have shown but I have not used encoder as clock source along with the sample clock as selection. I thought that sample clock can be only internal !!

 

Now with all this trial, I supposed that the card doesnt support triggered acquisition on every edge not just a start signal. Please also throw a light on how to do a retriggered acquisition.

 

Best Regards

Shradha

 

 

 

 

0 Kudos
Message 3 of 7
(3,874 Views)

Hi Shradha,

 

Good Morning and I hope your well today.

 

So I want to break your issue down into a few aspects.

 

1. You can use an external clock source for you AI DAQmx Task. If you look at the routing table for the PCI 6120 the ai sample clock source can be from any of the PFI and RSTI lines. Therefore you can apply your encoder signal to say PFI0 for example and this signal is used to sample your AI signal. 

 

An example of this can be found in the NI Example Finder - Acq&Graph Voltage- Ext clk.vi and setting Clock Source to DevX/PFIx. 

 

2. You are also talking about using your index signal to trigger you acquisition. Could you maybe draw an image of the signals and the result you wish to achieve?

 

I currently don't understand why you only want to acquire data on every other index pulse. 

 

Please let me know,

 

 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 7
(3,867 Views)

Hi James,

 

Thanks for your help .

I am attaching the drawing of the scheme.

 

Your scheme works but with a lil bit of problem. The problem is that I dont get all the date points.

 I don't know the exact speed of the encoder , roughly I know it is 2048pulses /sec . What should I set as the sample clock rate . Meaning it should be lower or higher than the actual ? What difference does it make on measurement if I m unable to specify the exact speed!!!

 

Btw, Today m KUDOS-ing  u  Smiley Happy

Regards

Shradha

0 Kudos
Message 5 of 7
(3,846 Views)
Solution
Accepted by topic author sp

Hi Shradha,

 

Thanks for the update and I hope your well today.


Sorry for the delay but it has been the Easter Holiday! 

 

Thank you also for your kudos. 

 

I would set your sample rate to the maximum expected rate of the clock source (encoder). The DAQmx driver uses the sample rate (and the number of samples per channel) information to make various calculations and set sizes for the buffer. 

 

If you set it too high, nothing will happen - you'll still just acquire on every edge the device receives. If you set it too low, your buffer could be too small and you could lose data.

 

Hope this helps, 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 6 of 7
(3,831 Views)

Hi James,

 

Hope you had a good week end.

 

Thanks again for your help. My problem of software is solved. Now I m struggling with noises on index  pulses. Hope to overcome that soon.

 

If more issues arise, I'll get back to you.

 

Thanks and Best Regards

Shradha

0 Kudos
Message 7 of 7
(3,824 Views)