LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop Target vi and Host vi from either program using Command-Based Architecture?

I am running LVRT7.1 on a PXI8176 connected by Ethernet to Windows XP PC.

I am running a motion control program using Command-Based Architecture to communicate (http://zone.ni.com/devzone/conceptd.nsf/webmain/CD63FD0F746B17A686256F090065F572). My programs consist of:

RT Target vi:
1) Time-critical TIMED loop (handles motion control, reads and writes values to RT-FIFOs)
2) Receive WHILE loop to get commands from Host via TCP Read and write to RT-FIFO
3) Medium-Priority Tasks (MPT) TIMED loop to read from RT-FIFO and send values to host via TCP Write

Host vi:
a) Event-driven WHILE loop to write values to TCP when changed
b) Receive WHILE loop to read values written by MPT

I want to be able to stop all loops by either of two methods
A) User presses STOP button on front panel (command generated in loop a), or
B) actuator reaches some given position (command generated in loop 1)

How can I do this?
It is not so hard for condition A (STOP ends loop b, NewValue in event writes to TCP then ends loop a, received value on RT Target ends loop 2 and remotely stops loops 1 and 3). For condition B, I can stop all RT loops, but not the host loops. My Event structure has a short timeout, but I can't use local variables to stop both loops due to the latching action of the stop button.

Has anyone dealt with this issue (bidirectional stopping) specific to the Command-Based Architecture structure? I think the solution would also apply to RT Communication Wizard programs.


I do not have LabVIEW available now, but can include a small sample prgram in a few days if that would make the issue clearer. Thank you.
__________________________________
Laine
0 Kudos
Message 1 of 5
(3,561 Views)
Sorry, thought I posted to RT Board.
__________________________________
Laine
0 Kudos
Message 2 of 5
(3,559 Views)

It sounds like you could add a "ping" command to your protocol to decide if the host should stop. You could use your T.O. case to send the pings.

Post your code and we can offer better ideas.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 5
(3,555 Views)
Please find host and target sample code attached.  This is a simplified version of my larger program.  I am not near my RT target so have not test run the code, but execution should be fairly obvious from the BD.
Note the stop criteria case in the program loop.  How to handle it?  I am interested in any suggestions or questions.
 
Thank you.
__________________________________
Laine
Download All
0 Kudos
Message 4 of 5
(3,532 Views)

Hi Laine,

Do you see any issues with using a stop button with a switching action and changing the termination condition from 'Stop if True' to 'Continue if True'? This will let you use local variables.

Regards,
Prashanth

0 Kudos
Message 5 of 5
(3,521 Views)