LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping analog input when analog output is complete and synchronization

Solved!
Go to solution

Hi

 

I'm trying to get my LabVIEW program to send an analog output voltage to a machine and read an acceleration using the cDAQ-9184. The output chassis I'm using is the NI 9263 and the input chassis is the NI 9234. I generate a white noise signal using LabVIEW's express signal generator.

 

The first problem I have is synchronization. I had a old VI that started measuring the acceleration roughly a second after the input was given to the machine. I used LabVIEW's tutorial on how to synchronize the analog input and output, only to find out that it doesn't work with two different chasses. Then I found another tutorial that showed how to synchronize different chassis with each other.

 

The second problem is the termination of the LabVIEW program. What I want it to do is to generate the signal and then simultaneously send and read the analog inputs and outputs, respectively. This is because I don't want a phase difference or any shorter signals to achieve direct comparison. But as soon as the signal is done being sent to the machine, I want the analog input to stop reading and then then the LabVIEW program must stop. I want to be able to choose any length of signal to be generated and stop everything once the entire time length of the signal has been sent to the machine.

 

I have tried "DAQmx stop", "DAQmx timing" and "DAQmx is task done?" and none of them have worked for me. This is also my first time posting on a forum, so I hope I've given enough information. I Have attached my VI as well. The VI shows that I am reading a voltage input for the analog input, but I am only using this to try get to program working.

 

I would really appreciate any help I could get.

 

Thanks in advance

Peter

0 Kudos
Message 1 of 3
(2,853 Views)
Solution
Accepted by topic author peterlabuschagne

 Hi Peter,

 

I've got a few recommendations for you that I think will get you closer to your solution. First off, I assumed that you meant you had 1 chassis (the cDAQ-9184) that had two modules in it (NI-9263 and NI-9234). My next steps are based off this assumption, so if this is wrong, please let me know.

 

For your first question regarding synchronization, the code you provided is very close to what you need. You do, however, need to implement slave/master architecture for the DAQmx start tasks functions. In order to do this, you can add another frame to the flat sequence structure and put the master start task (the voltage input) after the slave start task (the voltage output).

 

To handle your second question and have the program terminate when you want it to, the first step is to get rid of all the logic you are using with the time length local variable. Instead of using this logic, just wire the "task done?" node from the "Is Task Done?" function to the while loop stop. This will cause your while loop to stop as soon as the signal is sent to the machine.

 

I have a few other recommendations for you that will increase performance of your program:

1) Rather than writing to a file inside the last while loop, you can use the "DAQmx Configure Logging (TDMS).vi. You would place this VI between the DAQmx Timing.vi and DAQmx Start Task.vi for the Analog Input Voltage task. 

2) After the last while loop, you will want to stop the Analog Output task as well using another DAQmx Stop Task.vi.

3) Rather than using a local variable for the Displacement Input and wiring it to the DAQmx Write.vi, you can wire directly from the waveform output node of the Build Waveform function.

 

That should get you started in synchronizing these tasks.

 

-Alex C.

Applications Engineer

National Instruments

 

 

Alex C.
Applications Engineering
National Instruments
Message 2 of 3
(2,800 Views)

Yes, I did mean one chassis with to modules. Thanks so much for the help, it seems so simple after you explained it like that. 

0 Kudos
Message 3 of 3
(2,785 Views)