LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming Advice

My setup is a cRIO-9068

NI 9214 module

OMEGA Thermocouple with a fine diameter of 20 mm

 

My program runs fine with one channel and I can export the data so that it is in one column in a text file, however, my colleague wants a file that has each column correspond to each channel on the NI 9214 (Channel 0, Channel 1, ...) and each row will be the data. It's also delimited by commas. I attached my VI for how it works currently and what I get from it which is all the data in one column. Any advice on how I could implement that with multiple channels?

Download All
0 Kudos
Message 1 of 22
(3,228 Views)

RT should not really stop.  RT should not have a front panel.  It should be running off on its own and you send commands to it via TCP/IP, Network Streams, etc.  So what you should do is create a command to tell the VI to log for X time or samples.  When the command is received, open/create the file.  Then just write the data to file and then close the file when the time/samples has expired.

 

For more samples, just use more of the Scan Engine channels and use Build Array to combine all the data into a single wire.  Then you can use Array To Spreadsheet String and then Write To Text File to log the data to your file.


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 22
(3,207 Views)

How do I send commands to it? My colleagues wanted a GUI so that we can monitor our sensors and be able to control when to abort the test. Is that something the RT target is capable of? I was just given this hardware and started working with it. However, I do have a cDAQ as well if that's more suitable for my application.

0 Kudos
Message 3 of 22
(3,135 Views)

crios don't have the ability to run Front Panel code,

you may see your frontpanel in coding and debugging,

but finally when deployed and run in standalone,

there is no front panel stuff.

 

you have to have another computer to display the gui you have to build.

so RT reads the data, sends to UI, UI presents the data and sends back control, like start/stop.

note, that RT apps run from the moment you start the device (if set to autorun).

 

there may be options with webfrontend or somesuch, but i have no experience with it.

 

also have a look here https://forums.ni.com/t5/LabVIEW/data-saving-in-host/m-p/3654705 for links to crio help/guides


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 22
(3,124 Views)

i think if it is a relatively simple application (and not very time critical), use network shared variables (exported from crio target),

then you can use them quite easily in your GUI app,

and dont have the hassle of setting up the communications part.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 5 of 22
(3,117 Views)

Currently I'm using the network shared variables and it's showing the data in a graph on the front panel with a numeric indicator. Can I still use it this way? I just plan on bringing the same setup to our test site with the host computer there as well to show my GUI and control it that way. 

0 Kudos
Message 6 of 22
(3,114 Views)

i guess so, you just have to make sure, that the variables are reachable from your GUI device


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 7 of 22
(3,111 Views)

Okay. It will be 600 feet away from the chassis. I don't think that should be a problem with a ethernet cable. 

 

But I also got off the phone with NI application engineer and he said my best bet would be to use the cRIO undeployed because of the GUI that my company would like to use during the test for control and the serial interface it has which is needed for the test.

 

With that said, would anyone be able to help me with getting the CSV file formatting correct? I'm having trouble with getting the multiple channels out in the CSV file. Currently I have one channel coming out in one column but what would I need to do to get the multiple channels as the columns in the file separated by commas?

0 Kudos
Message 8 of 22
(3,096 Views)

will have a go at it tomorrow ...


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 9 of 22
(3,079 Views)

 

i found several things in your code that may be improved upon:

- only use "initialize array" if you know your array size in advance

- don't use insert array for an ever growing array, where you just append, use build array

- use the shift-register output and not create another output for the same data

 

appended a snippet (you can drag+drop it onto a block diagram) with two channels of data as example

example-csv.png

 activate the context help (ctrl+h), hover over things and read the long help

 

if questions remain, feel free to ask

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 10 of 22
(3,054 Views)