Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog acquisition with digital reference

Hello all,
I worked with one of our university NI reps today to hash out a simple VI that required fast operation. I am trying perform a simple sequence of events: 1) Send a digital line low, 2) Read N number of samples from an analog channel, then 3) Send the DO line back high.

We drafted a VI that uses error wiring to orchestrate the timing. It runs very quickly but come to find out it does not send the line back high. If I add a "Stop Task" to the analog input sequence (immediately following the Read subvi), then it performs as intended but very slowly (one iter = 10ms). This is unacceptable. Can anyone see an obvious flaw in my approach? Why is the second digital command not being carried out?

Regards,
Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 1 of 4
(3,180 Views)

Hi Matthew,

 

Thank you for posting to the NI forums.  I’ll be looking into the source of this problem, as well as a good workaround, and post back with the results.

 

Ed W.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 4
(3,133 Views)
Ed,
Thanks for looking into it. In the meantime I'm working on a version which uses analog acquisition with a digital edge trigger. I believe this would be the more "correct" and rigorous approach, however I am still curious as to what's wrong with the posted version.

Thanks again,
Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 3 of 4
(3,126 Views)

Hi Matthew,

 

I’ve looked into your VI, and I have some recommendations for your program.

 

  1. You shouldn’t start or “re-start” your analog input task without stopping it.  Currently, this occurs every iteration of your loop.  I would recommend pulling the Start Task outside of the while loop, so you’re just performing a finite acquisition each iteration.
  2. Although you wired up most of the error bars, you never used them to control your loop stop condition.  I would recommend using the status variable from the error cluster to stop the loop if it turns true.
  3. You are currently using the iteration count as a stop condition for your while loop, giving it similar functionality to a for loop.  Although this doesn’t pose an inherent problem, you may find some trouble when determining the maximum iteration count.  For instance, you specified an iteration value of 20 to stop your while loop – this corresponds to 21 iterations, since the iteration counter starts on 0.  Using while loops in this way often creates “off-by-one” errors just like this.

It sounds like your program is working with a more appropriate architecture, but I hope this information helps.  Good luck with your application!

 

Ed W.

Applications Engineer

National Instruments

0 Kudos
Message 4 of 4
(3,118 Views)