Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Running two applications in RT and selecting one of them to run in the foreground.

Hello  All,
Can anyone help in by suggesting a solution to this problem....
I am using a RT controller cRIO-9002, I need to deploy two independent applicatons( both of these applications use serial com port to receive and transmit data) in such a way that one of them is running in the foreground and other in the background. On receiving a command the two applications should interchange themself ie. the former should now run in the background and the later in foreground.Is it possible to go about??? If possibe .......... please continue reading....the  second part.
 
This controller is to be deployed in the field.There is one more appllication(not RT) running on a PC and located a far distance(few  Kms). These two applications(PC & RT) communicate through a radio modem which has a serial com interface.   Something this way.....
 
PC application>>serial port>>radio modem.........Tx...............radio modem>>serial port>>RT application
 
PC application<<serial port<<radio modem.........Tx...............radio modem<<serial port<<RT application
 
So there is two way comunication.
 
The processed data from the RT application(field)is sent to the serial port which is connected to a radio modem and gets transmitted.
The user interface(PC) appilication receives this data through a similiar radio modem. On will i need to change some setting for the RT application  through the user interface(PC) application which goes as command following the (first) path  dipicted above.
 
In the end i also need to  change  which application should run in the foreground and which in the background through the user interface(PC) application.
 
This too much i believe......take time .........no hurry ......please suggest some way to achieve this.
Thanking you in advance.
Regards
aswin & siva
 
0 Kudos
Message 1 of 2
(3,250 Views)

My first suggestion would be to abandon the serial modem and to see if you can use a TCP connection through the cRIO's ethernet port. Depending on the area and on the strength of transmission, you can get some variants of the 802 wireless standards to supports the ranges you want or you can have some of your network wired.
Then, each program can open its own port, you should have much faster rates of communication, you won't have a problem with using a shared hardware resource (the modem) and you will have a much easier time if you need to replace the hardware or port the program, because TCP is built for this and can be found practically anywhere. You can find examples for communication protocols between LV programs if you search the example finder for "TCP" or if you search this site for "Messaging Protocol".

If you still do want to use the serial modem (although I still think that's a bad idea), your best bet is probably to put both programs into a single calling VI and switch between them by ending the running program and starting the other one. Another option is to have both of them running and to use a common resource (like a global) to let each program know whether it can use the serial port or not. Yet another option is to have a single location handle the serial communication and to pass messages to that location and back using a communication mechanism like queues or RT FIFOs.


___________________
Try to take over the world!
Message 2 of 2
(3,246 Views)