LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing analog and digital i/o

We're using LabView 6.0 and a PCI-MIO-16E-4 to run our electrophysiology experiments, and have a moderately tricky set of requirements.

What we have so far: four analog inputs and two analog outputs to monitor and control two recording electrodes. We need tight synchronization (within << 1 msec) between input and output so that we can properly correlate the timing of responses with the timing of stimuli during each presentation (which are no more than a few seconds long). We do this by using the Clock Config AIs to have our output side set the scan clock (via the AO update signal through PFI 5) and the input side use that scan clock. This all works and we're happy with it.

What we need: we'd like to independently control at least 6 (preferably more) stimulator devices. The stimulators look for TTL triggers, so in principle we could use the DIO ports to send those trigger events. The trouble is timing: we want the digital output to be tightly synchronized (again << 1 msec) with the analog i/o and to be able to specify the timing of those events to within 100 usec or so. I've put together a very dumb VI that takes as input an array of (bit pattern,time) pairs, then uses a While loop and Wait to manage that event list and Write to Digital Port to generate the trigger events. Since Wait is only 1 msec precision, and since we don't have a good way to synchronize with the analog i/o, we've got jitter in the trigger events of about 1 msec, which is too big.

One solution to the Wait resolution problem might be pattern i/o, but our board apparently doesn't do that. I have vague ideas about synchronizing the start of the digital and analog by setting the analog output to start on a trigger and having the digital side write that trigger value to start everyone, but in practice I haven't got that working yet. (A possibly related problem: though our scan clock is supposedly running through PFI5, if I hook an oscilliscope to that terminal on our BNC-2090, I don't see anything. I'm probably doing something stupid. Can anyone spot it?)

I'm new to LabView (though an experienced C/C++ programmer) and thus would greatly appreciate any advice or examples people could provide.

Thanks much,
Kevin
0 Kudos
Message 1 of 3
(2,792 Views)
You are going to need some additional hardware to fully implement your problem. An interim approach would be to digitize the digital lines along with the analog data so that you at least have a corrolation of your existing data. The more complete solution is to use either a pattern generation board from NI or the DIO-64 board from our company. www.viewpointusa.com. With this board, you can "schedule" a digital pattern at a specific clock tick. resolutions to better than a microsecond are possible. The clock tick could come from the same clock that your are using. The reason your scope may not have seen the clock signal on your current setup is that the pulse is VERY short. your scope settings may not have been set to pick it up.
Stu
0 Kudos
Message 2 of 3
(2,792 Views)
Kevin,

Stu is correct. You will need some additional hardware in order to successfully implement your project. Specifically, the NI-6533 and NI-6534 boards will provide the hardware timing capability needed. You could synchronize pattern generation by sharing the AI scan clock across the RTSI bus. Below is an example that illustrates how to accomplish this synchronization in LabVIEW.

Synchronization Example
0 Kudos
Message 3 of 3
(2,792 Views)