06-10-2015 12:49 PM
I have what seems a simple set-up with two digital inputs. The first line is to be read whenever a falling edge is detected on the second line, thus:
___ _______ ___
line 0: ____| |_______| |___| |_____
_ _ _ _ _ _ _ _
line 1: ____| |_| |_| |_| |_| |_| |_| |_| |___
1 0 0 1 1 0 1 0
would result in a binary value of 10011010 being read. The frequency of the signals can vary, but is typically 20KHz.
So, what I've done is to set up DAQmx to read these inputs, looking for line 1 to transition from 1 to 0 using shift registers. If this happens, I read line 0, save it to an unsigned byte, first shifting left if a counter is > 0, clearing it otherwise. The counter is then incremented, and if > 7 the byte value is saved to a buffer and the counter reset to zero.
This seems to work ok, but the thing is that this a re-write of an application which used the traditional NI-DAQ driver, which was broken by the change to Windows 7 64-bit.
In that legacy vi, all of the above was handled by a single call to nidaq.dll. So, given that DAQmx has improved the ease of DAQ, I assume that I am not taking the correct approach.
Can someone steer me in the right direction?
06-10-2015 01:02 PM
What hardware are you using?
Assuming your hardware can handle it, I would set up the task to be for just the first line and wire the second line to the sample clock, configured to sample on the negative edge. You then just have to read every so often as an array and then format your data to however you want it.
06-10-2015 01:48 PM
Thank you for your quick response.
I'm using an NI 6535 PCI card for my digital inputs.
Create virtual channels for each line of my digitial inputs.
Add DAQmx timing with Change Detection selected
Wire virtual channel to task/channel in
set rate to 20,000
set I/O source to ?? ( don't understand this - shouldn't my I/O source already be specified in my virtual channel?)
set active edge to Falling
set sample mode to Continuous Samples
set samples per channel to number of samples (bytes) I expect to read, say 10,000
wire the task out to a DAQmx read inside a while loop that does ??
Am I even close?
06-10-2015 05:03 PM
This is what I have so far. How do I get the Sample Clock from line 1 to interact with the signal from line 0?
06-10-2015 10:30 PM
06-11-2015 12:59 AM
The only one I've found that seems applicable is "Digital (Pipelined Sample Clock) - Continuous Input.vi" but I can't even get that one to run - get "Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property" error for the Sample Clock.
Sorry for being such a noo
06-11-2015 03:27 PM
DinnisW,
I think the best example for you would be Digital - Continuous Input. You will need to make some changes to the block diagram. For instance, you will need to create a control on the "active edge" terminal of the DAQmx Timing VI. This way you can set your digital input to clock on the falling edge of the 20kHz clock. Then, set the sample rate to the maximum sample rate you expect to see on your external clock.