LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transition to DAQmx

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?

0 Kudos
Message 1 of 7
(2,778 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(2,767 Views)

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?

0 Kudos
Message 3 of 7
(2,755 Views)

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?

0 Kudos
Message 4 of 7
(2,726 Views)
Like Tim said, set it up as am external sample clock. There are examples that ship with LabVIEW.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 7
(2,705 Views)

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

0 Kudos
Message 6 of 7
(2,689 Views)

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.

0 Kudos
Message 7 of 7
(2,649 Views)