Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I run 2 vi's at the same time?

Hi,

 

I am using 3 channels of a NI 9211 to measure strain in one VI.  In a second VI, I am using the 4th channel of the 9211 to measure temperature using a thermocouple.  Both VI's work nicely, but, when I try to run them at the same time, I get the error shown in the attached jpg, error 50103.

 

I don't think that I can combine the 2 vi's because the vi that uses the 3 channels for the 3 strain gauges is controlling motors/motion, and cannot be slowed down.

 

Can I run the two vi's at the same time and eliminate this error somehow?  Also, how do I select the channel on the 9211 that the DAQ assistant reads?  Perhaps I did it some time ago, but, now I cannot remember what I did!!!

 

Thanks,

Dave

0 Kudos
Message 1 of 11
(4,474 Views)

Your actual solution would be to put all of the channels into a single task.  They will all have to be read at the same rate.


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 11
(4,470 Views)

If you put all the channels into a single task, does that mean that they would all have to be in the same VI?  I am trying to run my machine with two VI executing in parallel. 

 

If I put all the channels into the strain gauge vi, could the other vi read the output temperature data?  If so, how is that done?

 

Dave

Message 3 of 11
(4,462 Views)
Yes, they have to be in the same VI. Why would you need two?
0 Kudos
Message 4 of 11
(4,460 Views)

Well, one VI runs motors and does some motion control.  I am afraid to add anything to that VI because it will slow things down, and jeopardize the performance of that VI.  The motion control VI is sending updated commands every 30-100ms, but, I only need to read teh temperature once every 60 seconds and send a 1-3 second "ON" command via the NI 9472 which activates a relay that turns on the heating elements.  If I am sending a digital signal for 3 seconds, won't that delay my motion commands?  I cannot afford to wait 3 seconds in between motion commands...my mechanical system will fail if the updates are spread out for thousands of milliseconds.

 

I guess that maybe a question is this..."Is it possible to send a 3 second "ON" command with the 9472 that does not cause any delays in my motion control commands?  I was assuming that the motion control commands would have to wait until the 9472 is finished doing it's thing. Am I thinking correctly about that?

 

dAve

0 Kudos
Message 5 of 11
(4,456 Views)
Your error would appear to be related to trying to read. I can't look at your VI now but you can try using 1samp mode. What module are you using for motion control? Is it the same module? You could combine the on/off command into the same task as that as well as the single task for the analog inputs.
0 Kudos
Message 6 of 11
(4,448 Views)

There are many ways to pass the data from the motion controller loops to the temperature controller loop.  In fact, now that I'm thinking about it, I would just make a loop that does nothing but read from the DAQ.  It can read the signals and then pass the data to the other loops via a queue or notifier.


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 7 of 11
(4,438 Views)

The motion control is done by sending serial commands to the motor controllers. The serial commands are generated by my VI and are derived from the strain gauge data, and encoder speed data that is constantly being collected by a producer/consumer loop.  The serial commands are sent directly from PC to the motor controllers via USB-RS232 communication, not a motion control module.  The temperature controller needs to read the temperature AND send out an "ON" signal using the 9472 to send a digital signal to a relay that turns on a heating element for a chosen amount of time, e.g. 2000 ms  (variable up to 5000 seconds). 

 

If I am turning on a relay with a 2000 millisecond signal from the NI 9472, can I simultaneously continue to send serial commands to the motor controllers at 50ms intervals?  If the answer is "YES" then,  I can combine the two VI's and in principle, my problem is solved, but, I am not sure how to do that.

0 Kudos
Message 8 of 11
(4,435 Views)

If coded to run in parallel, then Yes.

 

You already have a producer/consumer setup.  For the temperature controller, use a Notifier instead of a queue (since you only care about the latest value).  Have the DAQ in a loop and then have it separate the data and send it to whoever needs 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 9 of 11
(4,400 Views)

Thanks for the advice about running in parallel.  I am not familiar with "notifier."  Can you point me in the direction of an example of a notifier so that I can have a template to model my vi on?  It was a real struggle to get the producer /consumer working right, so, I need to be careful adding anything to it. 

0 Kudos
Message 10 of 11
(4,398 Views)