Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

keep last value between loops

I have a NI6534 pci card, and I used it for digital pulse train generation, please see the following labview code.
 
This part of the code is a subvi and this subvi is put inside a loop. Inside the loop after this subvi, there are other things to do. 
 
Currently, after each time this subvi is executed, all the line on the digital output port become low by itself. My question is, is it possible for the card to keep the last given value between each calls to this subvi?
 
Thank you!
 
chen 
 
 
0 Kudos
Message 1 of 12
(4,995 Views)

Reiterate my problem.

Inside the subvi, I give the card a pulse train to generate. The last value of this pulse train for the lines of the port are not all zero. I wish to keep the values that way after the subvi finished till the next execution. However, the current situation is, somehow the card clears all the lines into zero.

Grateful to any suggestion!

 

0 Kudos
Message 2 of 12
(4,983 Views)
It seems the "Digital Output:Line States: Done State Property" does not apply to NI6534, any other idea appreciated.


Message Edited by lcdos on 04-08-2008 02:05 PM
0 Kudos
Message 3 of 12
(4,972 Views)
Hello Chen,

did you try not creating and destroying the task every time? My hunch tells me that the values would stay put on the digital port (but I might be wrong).

Hopefully this helps.
LDP
0 Kudos
Message 4 of 12
(4,967 Views)

Thanks for suggestion.

In the documenation,

Labview Help::VI and Function Reference::Measurement IO VIs and Functions:: DAQmx Data Acquisition VIs and Functions::Additional Information::Supported Properties by Device::Task Creation and Destruction

It says if in a loop, not clearing task will give error.

emmm, hard to do.

 

 



Message Edited by lcdos on 04-08-2008 02:37 PM
0 Kudos
Message 5 of 12
(4,962 Views)
Hello Chen,

you can create the task once and then perform a loop in which you write data to the task and always wait for it to finish. Then, when your application is done, you can clear (destroy) the task. That will work as expected.

Hopefully this helps.
LDP
0 Kudos
Message 6 of 12
(4,958 Views)
Will give it a try now, thanks a lot for your great suggestion.
0 Kudos
Message 7 of 12
(4,950 Views)

Had a try yesterday.

If I don't have "Stop Task" in the loop, error -200288 will show up when the loop is executed after the first time. It happens when writing data to the card.

If I have "Stop Task" in the loop, all lines goes to zero again.

Thanks for suggestions anyway.

0 Kudos
Message 8 of 12
(4,929 Views)

Hello Lcdos,

 

In your first screen shot you have a DAQmx Clear Task VI; this is not the same as a DAQmx Stop Task VI.  If you're referring to the DAQmx Clear Task as the "Stop Task" then this is probably the problem.  Stopping the task ends the generation but it doesn't clear the task so the last values you output should stay on the lines.  I've attached a screen shot below of how I would code the output you've described.  I would make your subVI only include the code that is inside of the while loop.  This way you can create the task once, write a finite number of samples, stop the task, then change the write buffer and write a finite number again while maintaining the last values on the lines.  Then you clear the task a single time at the end of your program.  Note:  VI before the DAQmx Write is just to make a waveform to write.  In you're program I'd make this an input on the subVI.

 

 

If you've already made a modification similar to the one I've suggested it would be helpful to if you can post another screen shot of your current VI.

 

I hope this helps get you started, and have a good day.

 

Cheers,



Message Edited by Brooks_C on 04-09-2008 12:47 PM
Brooks
Message 9 of 12
(4,913 Views)

Thank you Brooks,

I did mean Daqmx Stop Task.vi.

Currently there is no error coming out, yet it seems the card still clears the line.

0 Kudos
Message 10 of 12
(4,899 Views)