LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using two different sample clock sources for one counter possible?

Hello All,
   I have 2 signals (both are pulse trains, one is 1 HZ and other other is about 100 HZ). My goal is to measure the time difference between the each pulse of 100HZ pulse train related to most recent 1HZ pulse.
 
My idea is that, firstly, use the 1HZ pulse train as the external sample clock of counter0, then drive the counter0 source input with 100KHZ internal timebase, then use "Counter Input U32 1Sample" vi to continuously read counter value as the time instant of most recent 1HZ pulse. 
Then I need to use 100HZ pulse train signal also as the sampling clock of this same counter, then I use same "Counter Input U32 1Sample" vi to continuously read counter value as the time instant of each pulse of 100HZ train.
I could use a OR gate to combine this two pulse trains into one counter gate. but the problem is how do I distinguish the counter value reading in VI? As I need to find out which is of 1HZ train, which is of 100HZ train.
 
Or, the other method is to use 2 counter hence 2 seperate "Counter Input U32 1Sample" vis to read 1HZ train and 100HZ train seperately. But the problem is how do I synchronize the 2 counter in the fly? As this is a long term measurement, though I could use a arm trigger to let 2 counter start counting same time, they problably will have some value difference after a while due to missing pulses or so. So i need to periodically synchronize them during the vi runs. So what's my options?
 
Thanks and Merry Xmas,
 
Feilong
 
 
0 Kudos
Message 1 of 11
(4,215 Views)
I was wondering if you could clarify things a bit.  Are you generating the pulse trains from Labview or a seperate peice of equipment?
 
If you are measuring an external pulse train are you measuring with a frequency counter?  Thanks,  SS


0 Kudos
Message 2 of 11
(4,191 Views)

I don't fully understand your measurement goals.  To help me out, let's consider the interval between the 1st and 2nd pulses of the 1 Hz clock.  You can expect 100 pulses of the 100 Hz clock during that time.  What data do you want to collect?

A. 1 measurement from the rising edge of the 1 Hz clock to the first subsequent rising edge of the 100 Hz clock

B. 100 measurements representing the time from the rising edge of the 1 Hz clock to the rising edge i of the 100 Hz clock

C. 100 measurements (actually 99) representing intervals between consecutive rising edges of the 100 Hz clock.  

Also, it'll help to know what data acq board you have.  Certain capabilities like "arm start triggers" and "two signal edge separation" measurements may be very useful, but are not available on all boards.

You probably want (or at least you probably *should* want) to perform a buffered measurement so you can achieve hardware-accurate timing.  Your references to "continuously reading count values" sound like software-timed polling, which can't be nearly as accurate or precise.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 11
(4,188 Views)

Thanks guys for your reply.

For Kevin's post, I think I am try to do the B option. The 100HZ is only the average rate which is not exactly 100HZ and that's why I want to measure the time duration of each pulse of that train from the 1HZ pulse (my reference in this case) .

For ShotSimon's post, I am not using frequncy measurement and the two pulse I am measuring are both from external device. The 1HZ pulse is actually a 1PPS signal from GPS receiver which fires at each even GPS second (GPS time), The 100HZ train is the data sampling clock from Inertial Measurement Unit (IMU). I just want to timestamp each IMU sample clock pulse related to GPS second. Because there's fluctuation on the IMU sample clock, so it's not perfect 100HZ.

I am using DAQ-card 6036E. It looks like doesen't support arm trigger. We also want to implement the same application on a M-series board in future. So I would like to know what's the best options for each set of my instrumentations.

 

Thanks

 

Feilong

 

0 Kudos
Message 4 of 11
(4,176 Views)
I'm not sure if you are locked into the hardware that you are using, but a more direct route to accomplish what you are trying to do is to use either a NI PCI-1588 or PXI-6682.  Both boards have the ability to timestamp any signal using their internal 10 MHz clock or you can sync the boards to an external reference.  Both support the ability to synchronize to a 1PPS or a IEEE-1588 reference clock.  The 6682 also has the ability to sync to GPS via an antenna or IRIG-B (DC and AM).

If you have the ability to switch to one of these boards this application would be much easier.  Both of these boards were designed with the purpose of timestamping signals and triggering future time events.

Good luck with your applicaiton,
Josh
0 Kudos
Message 5 of 11
(4,168 Views)
Unfortunately I have to make most of current hardware first. The GPS board seems a pretty good one but just not available for me right now.
 
0 Kudos
Message 6 of 11
(4,154 Views)

Hello,

Yes, you are correct the 6036E E-series card does not support the Arm Start Triggering, but the M series cards do support this feature.  For the future possibility of an M series card, I would suggest using the two counters with the arm start trigger. 

As for the E series card, I was a little confused about the setup you are describing.  You mentioned that you wanted to use the two pulses (the 1 Hz GPS and the 100 Hz IMU) to be the same external sample clock for one counter (counter 0).  However, later in the same post you mentioned wanting to use the two pulses as two different gates.  I am going to assume that you want to use the two pulses as gates on the same counter in-order to have them share the same 100 KHz source.  Then your question was how to differential in-between the two measurement, since you want to use an OR gate.

The problem is that whether you are using this setup (one counter) or utilizing two counter that share the same 100 KHz source on the E series … you still are not addressing the fact that the two inputs (1 Hz GPS and 100 Hz IMU) are not synchronized.  This will result in an offset signals and your measurements will not be reliable.  Thus the differential question is not as relevant

I would suggest using Buffered Period Measurements with a M series card for this application.  However, I do realize that in the end you might be trying to find a quick solution with the E series card.  For this, I would suggest taking the GPS out of the picture and just input the fluctuating 100 Hz signal.  With this setup you explore software monitoring options.

I have included links to articles about counters and Buffered Period Measurements.

 

Period Measurement with a Counter

Measure Buffered Pulse-Period on 2 Counters Simultaneously (DAQ-STC)

Samantha
National Instruments
Applications Engineer
0 Kudos
Message 7 of 11
(4,141 Views)
Samantha,
 Thanks for your advice. You are right, my goal is "want to use the two pulses as gates on the same counter in-order to have them share the same 100 KHz source.  Then your question was how to differential in-between the two measurement".
  However, i still didn't quite understand how to differentiate the two reading, supposing I am using a M card.
 
0 Kudos
Message 8 of 11
(4,136 Views)
Samantha,
 Thanks for your advice. You are right, my goal is "want to use the two pulses as gates on the same counter in-order to have them share the same 100 KHz source.  Then your question was how to differential in-between the two measurement".
  However, i still didn't quite understand how to differentiate the two reading, supposing I am using a M card.
 
0 Kudos
Message 9 of 11
(4,136 Views)

And for the M series card, I read a post somewhere in the forum mention a setup like this:

1. use encoder reading setting for the counter

2. use my 100HZ pulse train as gate

3. use internal 100KHz as source.

3. use my 1PPS train as Z to hardware reset the counter to 0 on the fly

I would think this is a good way to derive the time elasped (the arriving time instant of each 100HZ pulses) since most recent 1PPS pulse.

Please comment this idea.

Thanks and Merry X mas for all you guys

 

Feilong

0 Kudos
Message 10 of 11
(4,126 Views)