LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to structure a project

Hi, everyone!

 

I have a question about how to structure my project So i have a PC and a cRIO connected through ehernet. I have a user interface for the PC. For the cRIO i only have a VI which does the data acquisition. (I am working with shared variables). The data is then displayed on the PC User Interface.

So my question is: Can I do one VI on the PC which collects the data from the cRIO and then displays it directly (using producer/consumer) or do the data acquisition VIs in the project need to run under the cRIO?

 

Thanks!

0 Kudos
Message 1 of 3
(2,260 Views)

Depending on the cRIO, you could run a VI directly on the cRIO (not on the PC) and visualise it on the PC screen.

This will take time to load it onto the cRIO each time you start it, but it can be good for testing.

 

Some cRIO-based devices are available on a connected PC, but I'm not sure of any e.g. DAQmx-based devices that match this claim. I can seemingly (I haven't tested) use the RS232 port on a cRIO-9045 directly (over ethernet) from PC.

 

Probably you're better sticking to the acquisition on cRIO, then streaming in some way (possibly shared variables, possibly something else like Network Streams) to PC, then displaying on PC.

With a bit of fiddling, you can have the cRIO acquire continuously, but only stream when you "connect" using a VI on the PC.

This isn't difficult to set up the first time, it's the reconnection after disconnect that can be more tricky - you have to create a new Network Stream connection if that's what you choose to use (the old one will get an error saying the "Remote Endpoint disconnected").


GCentral
Message 2 of 3
(2,208 Views)

@mirelche wrote:

I have a question about how to structure my project So i have a PC and a cRIO connected through ehernet. I have a user interface for the PC. For the cRIO i only have a VI which does the data acquisition. (I am working with shared variables). The data is then displayed on the PC User Interface.

So my question is: Can I do one VI on the PC which collects the data from the cRIO and then displays it directly (using producer/consumer) or do the data acquisition VIs in the project need to run under the cRIO?


You have to think of the cRIO as a completely separate computer.  So it has to have code on it to acquire the data and then send it to your PC.  I will highly recommend against using Shared Variables (they have caused nothing but headaches for me).  Instead, use TCP/IP or Network Streams to send the data from your cRIO to the PC.  The PC should then have a loop that manages that network connection and passes the data on to the GUI using User Events or Queues.


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
Message 3 of 3
(2,207 Views)