Digital I/O

Showing results for 
Search instead for 
Did you mean: 

DAQmx multi-line digital serial input with latch

Hi,  I'm new to labview and I'm unsure how to capture the data I'm interested in using the DAQmx functions.  I have the following signals:

10 Digital inputs
1 Clock
1 Latch

I need to sample all of the digital lines on the rising edge of the clock.  This I've been able to do.  I'm unsure however how to integrate the latch.

The digital inputs each need to be read as though they are individually being fed to 10 shift registers, each incidentally 128bits in length.
I then need to store the most recently clocked in 128bits from each digital line on the falling edge of the latch signal.

I had started with a DAQmx digital input vi, wired with the 10 digital lines, and set for one channel for each line.  I later read that tasks using all lines in one or more ports must use "one channel for all lines"; as such i suspect this must be changed.  Also, I have a sample clock in the same task, set to sample continuously on the clock's rising edge, with samples/channel set to 128.  Again, having dug through documentation I suspect the buffer is being made much larger than 128samples x 10 channels; although it looks as though I can force the 128 size.  Even so I am unclear on three things:

1.  Which DAQmx read instance should I use to return the most recently clocked in 128 samples of all 10 channels?
2.  How should the buffer be configured for this DAQmx read?
3.  How can I initiate the DAQmx read on the latches falling edge?

I've made the latch input a separate task, set as the clock input, but I have no data to read with this.  I only want to use the latch to initiate the inputs read.  Counters seem like a possibility, but when I attempt to add one Labview doesn't populate any to select; I suspect my hardware doesn't provide counters.  I've tried using the DAQmx Create Timing Source Vi with digital change detection and a timed loop, in conjuction a complex attempt at converting digital waveforms to arrays of U32 ints with no luck.

Any suggestions would be much appreciated.  Thanks in advance.

0 Kudos
Message 1 of 4
Hello Matt,

What you are trying to do is very easily accomplished by using a trigger.  You said that you need to "store the most recently clocked in 128bits from each digital line on the falling edge of the latch signal."  If this means that you want to acquire the next 128 digital samples after the falling edge of your "latch" signal, then you would configure a start trigger.  If this means that you want to acquire the 128 digital samples directly before the falling edge of your latch signal, then you would configure a reference trigger

For more information on start and reference triggers, please refer to the NI-DAQmx Help (shortcut in Start >> Programs >> National Instruments >> NI-DAQ).  Within this help file, look under NI-DAQmx Key Concepts >> Timing and Triggering >> Triggers

I'm not sure what hardware you are using.  If it is an M Series device, I would also suggest that you take a look at KB
3GTBBN0K: Can M Series DIO Operations be Triggered? and the example Performing Triggered Digital IO with an M Series Device in LabVIEW.  If you are using a 6533 or 6534, setting up the triggering will be even easier since these boards have dedicated digital timing engines. 

I hope this information helps!

Best regards,
0 Kudos
Message 2 of 4

Thanks for your reply.  I had considered using a reference trigger, however I need to do more than one read.  That is to say there will be several latches so triggering on the first latch will not capture all the data I'm interested in.  After each read should I clear and restart the task so as to trigger again on the next latch?  The latches will appear at roughly 125khz, will there be performance issues when I'm restarting the task after every latch?

Also, I will need to read the 128 samples of pretrigger data immediatly prior to the reference trigger.  To do this do I need to set the DAQmx Read RelativeTo property to "Reference Trigger" and Offset to -128 ?

I do have a 6534, is there anything specific I need to do to take advantage of the onboard timing engine?

Thanks again,
0 Kudos
Message 3 of 4
Hello Matt,

You may not be able to keep up with edges coming in at 125 kHz by stopping and starting the task, but you would just have to try it.  In terms of setting up hardware timing and a reference trigger, please refer to the LabVIEW example Read Dig Chan-Int Clk-Dig

I hope this helps!

Best regards,
0 Kudos
Message 4 of 4