LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronized digital output and delay triggered analog input

Hello,

I am using a PCI-6221 board to do synchronized digital output and analog input.  I need to output digital pulses on two lines and then obtain analog data after a specified delay. These two tasks need to be accurately synchronized, because this process is extremely time-sensitive. I have written a LabView program which does this. I am using a counter's internal output as the sample clock signal for both the analog input and the digital output, as this was the only way to provide the same clock signal to both tasks. I tried several other methods, for example using the 10 MHz timebase for both sample clocks, but the frequency of this clock was unsupported by the analog input. I also tried using the timebase for the Sample Clock for the digital output, and then the do/SampleClock for the analog task, but this also returned an error. The internal counter timing, on the other hand, works fine. 

For the trigger, I am using the other counter's internal output. The counter is set to "ticks" output, and the delay is specified at the counter (I did this because the startTrigger.Delay property on the analog input task was conflicting with the sample clock for some reason). 

My problem is this: When I run the program, it works fine for a delay of less than 300 ticks and analog input samples of less than 300. When I try to increase these numbers to above this range, the program hangs up. This is a problem, because I need both of these numbers to be higher than these values. Confusingly, if I run the counter trigger and analog input task as a separate VI, using a hardware timebase as the sample clock, I get no such limitations on the delay and samples to be obtained. It is only when I use the counter output as the sample clock that this problem occurred. I tried separating the trigger counter and analog input as a separate VI, with sample clock as a control, and calling it from my main VI, but this caused the same problem I described above. This indicates to me that the problem I am having is due to the specific sample clock I am using. However, I cannot change this because it is the only method I have found that synchronizes the digital output and analog input. 

I have attached a screen shot of the program I have written. Any help in resolving this problem would be greatly appreciated.

Thanks!

0 Kudos
Message 1 of 2
(3,318 Views)

I don't get all your requirements, so my idea might be mislead. But I think you can make it much simpler:

* Use 2 digital channels, not PFI, not Counters, simple digital waveforms (the buffer is of size 1024, so this might limit this approach)

* Set the sample clock of the digital channels to 'ai sample clock'. (use the OnBoardClock for ai)

* Start your ai task, this will start the 2 do task at the same moment because of the shared clock

* Throw away the ai data from the delay period

 

Felix 

0 Kudos
Message 2 of 2
(3,313 Views)