Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read n samples of digital input synchronized with digital output?

I'm working with a 6259 M-Series Multifunction DAQ Card, Measurement Studio, and Visual Studio 2003 (C#).
 
I want to read n samples of digital input while at the same time doing digital output in synchronized manner. The read line and write line are separate DIO PFI lines in port 1.
Can someone suggest how to do this or point me in the direction of a good example in either C or C++ or C#?
 
Thank you,
Jim
0 Kudos
Message 1 of 5
(3,445 Views)

Hi Jim-

In order to perform synchronized digital operations on your M Series card you will need to use the correlated digital I/O capabilities of port 0 rather than port 1.

There are no C# shipping examples for concurrent DIO operations, but I was working on a similar application earlier this week.  There is no digital timing engine on the card so you have to use a sample clock from another source to clock the digital operation (hence the name "correlated").

Basically there are two options- you can run an analog input operation concurrently and use the ai/SampleClock as the timing source or you can use an onboard counter to generate a sample clock for your digital circuitry.  I have attached two examples that illustrate both of these concepts and one method for writing and reading from a split port and using bit shifting to realign the samples. 

Hopefully this helps-

 

Tom W
National Instruments
0 Kudos
Message 2 of 5
(3,435 Views)

Thanks very much - your code sample is very clear and helpful.

We are essentially doing the same as in your code but with the analog output clock driving everything.

We didn't know about the limitation with the PFI lines, but this explains a lot. Luckily we have some port 0 lines open and we can re-route the PFI's to them.

Thanks Again,

Jim

0 Kudos
Message 3 of 5
(3,418 Views)

Hi Jim-

I'm glad my suggestions were helpful- good luck with the rest of your application!Smiley Happy

Tom W
National Instruments
0 Kudos
Message 4 of 5
(3,415 Views)
Hi Tom:
I have a question about the PCI6251. I use com1 (serial port) to drive a moto-stage, then output a triangel signal and get some replied data. Since the PCI6251 has both AO and AI, I think that I can control the whole system with one PCI6251 card. The sequence of the process is:
first move the stage to one position, when it stops at the position, get several-period data (for average), then move the stage to the next position.
The problem is the AO port need to output the triangel signal from the beginning to the end, while the samples input to AI are only valid when the stage is not moving (staying at the position). I have tried to sychronize those two ports, but I find it difficult to make sure that the each DAQ starts at the same time (according to the triangle waveform). Could you give me some advice? Because I think it can be solved by some functions in the Labview7.1
The attachment is my program.
 
Thanks,
0 Kudos
Message 5 of 5
(3,249 Views)