Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between hardware and PC

Hello,

 

I have a question. Is it possible to create User Interface VI on PC, which is by network shared variables connected with a VI on cRIO (which controls hardware), and then to enable that hardware activates only when I change some control value within UI VI, without opening  cRIO VI at the same time?

 

I hope that I was clear.

 

Thank you for your answer 🙂

0 Kudos
Message 1 of 5
(2,680 Views)

I (used to) do it all the time.  You just create an application that runs on the cRIO and deploy it.  Then the application is running whenever the cRIO is turned on.  You can then use a VI in LabVIEW or build an executable that can communicate with the cRIO application via TCP/IP, UDP, or Network Streams.  Yes, Network Shared Variables do work, but I personally think they are 99% evil.  I have just had soooooooo many issues with them (weird race conditions, slow updates, security of the data).  So I highly recommend creating a messaging protocol and use TCP or Network Streams to send data back and forth.  What I use is the STM library with a TCP connection.



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
Message 2 of 5
(2,606 Views)

Thank you for the answer.

 

I started with variables, and I am still learning, I will probably switch to some other method later. 

 

I just have one more question. I have created a network shared variable, but the command which I give in User Interface VI (for example change in value of control button) doesn't change the state of LED connected with digital output for which I created the variable if I don't start both VIs (UI and cRIO RT VI) at the same time. 

 

Can you possibly assume where is the problem?

 

Thank you, once again.

0 Kudos
Message 3 of 5
(2,590 Views)

Another reason I hate NPSVs...

One of the targets has to host the variables.  That should be the cRIO.  So make sure you deploy the variables on the cRIO before starting your VIs.



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 4 of 5
(2,587 Views)

 

I have deployed them on cRIO, and deployed them in library once again, and when I look at my NI system manager, the value of the variable changes, but the hardware doesn't respond, and the LED is off if only User Interface is active. 

 

When I run both VIs at the same time, one on cRIO, and the other on my PC, the value of the variables also changes, but this time the signal is transferred to Digital output, and the LED is on. 😄

 

 

 

0 Kudos
Message 5 of 5
(2,583 Views)