LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring pre-trigger samples

Solved!
Go to solution

Thanks Jeff for that code! I did need to tweek the In Place Element Structure because it turns out that when you program it to split the 20-array into subarrays of length 1 and 19 and then try to insert a value into the 19-array, it inserts it at the same place you make the cut (in this case in the first spot) rather than just appending the new value to the end of the 19-array. However, I used a similar idea using just "Delete from Array" and "Build Array" to accomplish the same thing. Anyway, the code is working much faster now (I think fast enough! Hurray!)

 

Thanks again for your help!

 

-Kamna 

0 Kudos
Message 11 of 18
(1,130 Views)

Hi,

 

I have another question. I am now trying to expand my program to include 2 counters (eventually it will have 6), still triggered by the same line. I tried adding the second counter to the same while loop, but that slows the program waayyy down and I eventually get a buffer overflow error, probably because my loop is no longer running fast enough to read the values from the buffer. Is there a way around this? Or should I place my data acquisition tasks in separate but synchronized loops and somehow try to link my trigger loop to my counter loops?

0 Kudos
Message 12 of 18
(1,105 Views)

Actually, I kind of resolved the speed issue (rather than putting everything in one large while loop I split it up, I'll stick with that unless there's a better way that I haven't thought of?) Now I have a question on synchronizing the while loops. I have the timing set up so that whenever there is a pulse on my data line, my program reads the the counter value on the 20MHz Timebase. If I set up several lines this way, would they automatically be synchronized because they all use the same 20MHz Timebase?

 

Thanks in advance for your help!

 

Kamna

0 Kudos
Message 13 of 18
(1,100 Views)

Hi kgupta,

 

If you would like all the counters to have the same setup and synchronize to the same clock, you can include them all in the same DAQmx task.  You can do this by selecting all of the counter lines you are iterested in acquiring at the start of the DAQmx task.  Then the read will output a value for each counter.  

 

When using multiple DAQmx tasks running in parrallel, the best way to insure they are acquiring at the same time is to set the clock source to the timebase you would like then trigger one task with the other.  There are some great examples on this included in the Labview example finder under synchronization in the DAQmx folder under Hardware Input and Output.  I hope this helps!

Andy K.
Applications Engineer
National Instruments
0 Kudos
Message 14 of 18
(1,087 Views)

Hi Andy,

 

Thanks for the reply!

Unfortunately, I don't think I can do that directly in my case. The aim of my code is to get the times of a line data pulses. I do this by running my 20MHz Timebase and I have the computer return the counter value of that timebase whenever a pulse arrives. To do this, I treat my pulse as the clock because the arrival of the pulse is what controls when I take the value from the 20MHz counter. I realize this is a little roundabout but it works and I could not think of a better way that would also give me the microsecond precision I need. In order to expand this to several incoming pulses, I need to use one 20MHz timebase as the counter, but several clocks (one clock for each stream of pulses), and I want separate data for each pulse line. Is there a way to do this, using one task?

 

I don't have hopes for there being a way to do this in one task, in which case I go back to my original question: if every task uses the 20MHz Timebase, will they all be synchronized, since there is only one timebase on my card?

 

Kamna 

 

 

0 Kudos
Message 15 of 18
(1,081 Views)

@kgupta wrote:

I don't have hopes for there being a way to do this in one task, in which case I go back to my original question: if every task uses the 20MHz Timebase, will they all be synchronized, since there is only one timebase on my card?

 

Kamna 

 


YES, and you can even route an external source to use as your timebase to syncronize several cards together.  PXI expands this a bit futher by routing the clock source with correct delays so that the clocks arrive at the same time (Time on target)


"Should be" isn't "Is" -Jay
0 Kudos
Message 16 of 18
(1,077 Views)

Great! That makes my job easier 🙂

Follow-up: how can I correct for the time delay? I have the PCI-6602 card.

0 Kudos
Message 17 of 18
(1,073 Views)

@kgupta wrote:

Great! That makes my job easier 🙂

Follow-up: how can I correct for the time delay? I have the PCI-6602 card.


Throw out the PCI card and buy a  PXI device and a backplane (Chassis) and controller that supports time on target sync.  Smiley Wink

 

You need better hardware that supports the advancesd clock sync features


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 18
(1,063 Views)