Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

aperiodic acquisition analog signal

Solved!
Go to solution

dear sirs,

excuse my English, it is not my native language but I cannot get help from the forum in my tongue.

I have folllowed 2 LABVIEW courses but have not been taught on DAQmx acquisition. I am using LABVIEW2011, a NI 6229 PCI card/CB68LP connector and I want to acquire an analog signal that should be considered as non periodic.

A motor is spindling at 20Hz nominal with an uncertainty of 20%. 2 sensors ara attached to this motor and send digital signals :

S1 -> 1 signal per rotation, reliable (f1~20Hz)

S2 -> 1024 teeth in 1 one revolution (f2~1024*20Hz) but must consider missing teeth possibility

The analog signal must be acquired during 20 or 40 periods (counter on S1) on each falling edges of S2 and I want to store each value with the corresponding time (relatively to the start of the acquisition) in microseconds and the counter index on S1. Is it possible to do so without switching to LABVIEW RT?

I have succeeded in acquiring an analog signal from a function generator but am unable to go further.

Any help would be welcome on DAQmx assistant configuration regarding those points :

- should Dev1/ai0 analog be triggered by S1 or S2 PFI inputs, reference trigger? advanced timings parameters?

- counter input/edge count on S1?

- digital/line input for S2?

Thanks in advance for your help,

 

Pierre

0 Kudos
Message 1 of 11
(4,834 Views)

bonjour,

 

From my understanding, you want three data points for each sample:

 

1.  The value on the analog input

2.  The corresponding S1 count

3.  The time relative to t=0

 

This should all be done in hardware, so LabVIEW RT will not provide any benefit.  Here's what you'll need to configure:

 

1.  Continuous analog input task.

S2 connected to any PFI line.  Use that PFI line as the sample clock.

No triggering necessary.

 

2.  Continuous counter input edge count task.

S1 connected to any other PFI line.  Use this PFI line as the source for the edge count task.

Use the AI Sample Clock (/Dev1/ai/SampleClock) for the sample clock of the edge count task.

Use the AI Start Trigger (/Dev1/ai/StartTrigger) for the arm start trigger.

 

3.  Continuous counter input edge count task

Use an internal timebase for the source for the edge count task.

Use the AI Sample Clock (/Dev1/ai/SampleClockfor the sample clock of the edge count task.

Use the AI Start Trigger (/Dev1/ai/StartTrigger) for the arm start trigger.

 

 

Start the analog input task after both counter tasks have started.  When you do this, it will trigger both counter tasks.

 

You dont know exactly how many samples you will end up with, so you will need to just read the data until the value of the S1 count exceeds your threshold (20 or 40 is what you mentioned above).

 

 

I'd suggest not trying to do this in the DAQ Assistant, but rather use the lower-level DAQmx API.

 

 

Best Regards,

John Passiak
Message 2 of 11
(4,827 Views)

thank you John for your time and suggestions. I will proceed as you propose and let you know as soon as possible - next week - about the results. I was asking about LABVIEW RT since some colleagues have told me that LABVIEW (not RT) time functions return values that are not reliable under the millisecond. Best regards,

 

Pierre

0 Kudos
Message 3 of 11
(4,808 Views)

@pbigen wrote:

I was asking about LABVIEW RT since some colleagues have told me that LABVIEW (not RT) time functions return values that are not reliable under the millisecond.


It's true that the OS clock is not very accurate.  In your case you can configure a hardware clock and use that to time your measurements so the OS clock accuracy doesn't make any difference.

 

 

Best Regards,

John Passiak
Message 4 of 11
(4,793 Views)

dear John,

I have found examples of VI's that could be useful for these tasks. I think I will use ContAcq&GraphVoltage-ExtClk.vi for part 1) but for the 2 other tasks I have difficulties to figure which example they relate to. The differences between task 2 and task 3 seem very small except for the internal time base. Thank you again for your time and advices.

Pierre

0 Kudos
Message 5 of 11
(4,742 Views)
Solution
Accepted by topic author pbigen

The basic configuration (up to starting the task) would look like this:

 

EdgeCountExample.png

 

 

Task 2 and 3 are indeed very similar, one uses a PFI line for the source while the other uses the 80 MHz timebase (or whatever internal timebase you prefer).

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 11
(4,733 Views)

Thank you John.

I am not as fast as you are to answer on the forum but I read nonetheless your answer fast. With your precious help, I will certainly succeed. It is not a rookie job and I would have been long stuck to the ground without your advices.

Best rehards,

 

Pierre

0 Kudos
Message 7 of 11
(4,682 Views)

dear John,

sorry to bother you again but I feel I am close to the end of the problem but can't get over it.

could you please tell me from the attached VI what is wrong and why I get error -201003 on the lowest line using Onboard Clock as sample clock.

Thanks in advance for your suggestions and time,

 

Pierre

0 Kudos
Message 8 of 11
(4,455 Views)

dear sirs,

actually the error message is -200303, instead of -201003. Best regards,

 

Pierre

0 Kudos
Message 9 of 11
(4,446 Views)

Error -200303:

External sample clock source must be specified for this application.

 


As the error message indicates, the counter input task must use an external sample clock.  There is no dedicated timing engine to generate the sample clock for a counter input task.

 

 

Best Regards,

John Passiak
0 Kudos
Message 10 of 11
(4,435 Views)