01-18-2018 05:32 AM
Hello,
I am using serial port of cRIO for input. I need to save the input data in my PC in a text file. Can someone please tell me how can I do that?
I tried using VISA read, write to do that, but could not succeed.
01-18-2018 05:41 AM - edited 01-18-2018 05:44 AM
Hi nehap,
LabVIEW comes with a lot of example VIs and projects, explaining most stuff…
Can someone please tell me how can I do that?
Did you try any of those RT examples projects? They explain how to transfer data from RIO to host PC!
I need to save the input data in my PC in a text file. I tried using VISA read, write to do that, but could not succeed.
Again I have to ask (as I did here😞
What have you tried?
Do you get error messages?
Which file path did you try?
Can you attach your VI (with meaningful default data in the controls)?
Btw. saving data to files is not related to GPIB or VISA, so I moved your message from hardware related board to LabVIEW board!
01-18-2018 06:12 AM
to get data from RT to PC, you can either use Network Shared Variables, from which you read on the PC, or you use Network Streams which is more involved.
have a look at these links
http://zone.ni.com/reference/en-XX/help/371361N-01/lvconcepts/data_comm/
http://zone.ni.com/reference/en-XX/help/370622N-01/lvrtbestpractices/rt_gui_bp/
01-18-2018 06:24 AM
Use a Network Stream to send your VISA Read data on the cRIO to your PC. On the PC, you can then read from the Network Stream and save that data to a file. But you will need multiple applications to do this (one on the cRIO and one on the PC). There are plenty of examples in the Example Finder (Help->Find Examples) for how to do each part of this process.
01-30-2018 12:00 AM - edited 01-30-2018 12:16 AM
Sorry for late reply.
pl see the VI attached.
Also, pl tell me whether to use RT-FIFO for saving the RT data from cRIO to host PC?
01-30-2018 01:37 AM - edited 01-30-2018 01:40 AM
Hi nehap,
tell me whether to use RT-FIFO for saving the RT data from cRIO to host PC?
No, the RT-FIFO only works "inside" the RT!
As has been suggested before: use network streams (or other network communication schemes)!
pl see the VI attached.
- you can resize the IndexArray node so you only need one of them
- what's the point of putting the PID inside this TimedWhileLoop?
- why did you delete the label of the stop button? NEVER do that again!
- as you didn't set any default values you still don't say the file path you are trying to save your data to…
- there is no error handling at the FileOpen function!
- do you think you can go the those default PID gain values?
01-30-2018 03:59 AM - edited 01-30-2018 04:03 AM
Thank you for the reply.
- what's the point of putting the PID inside this TimedWhileLoop?
I wanted a continuos data in the output, so i thought of putting PID in the same loop as that of the data input. Is it a wrong way to use it?
- as you didn't set any default values you still don't say the file path you are trying to save your data to…
I didnt get this point, can u pl ellaborate?
- do you think you can go the those default PID gain values?
I was trying to manually tune the gain values which I obtained from a simulation in simulink.
I have some more doubts,
1. I tried to use FTP to save data to the host PC? Is it right?
2. Is there any way by which I can save cRIO output data?
01-30-2018 04:23 AM - edited 01-30-2018 04:25 AM
i think GerdW did not show you the correct version, only a cleaned up and simplified version of your code,
which is appreciated if you ask for input to clean up your vi. (EDIT: but you could do it that way too, depends on time criticality)
the default values are values you put into your controls and then Edit->Save Current Values As Default,
which lets ppl see what your input values are (like the path for example)
use a network stream to transfer data from crio to pc and another network stream to transfer data from pc to crio.
use either a state machine or a producer-consumer design pattern.
your last two questions:
yes you can use s-/ftp/webdav do get data off your cRIO, but that means you have to log locally on the cRIO and depending on how much data you are acquiring, the space may not be sufficient
what do you mean by cRIO output data? like errors or measurement data?
01-30-2018 04:54 AM
Thank you for the inputs.
I am now reading about how to use FTP. For time being, I am directly saving the data through USB.
what do you mean by cRIO output data? like errors or measurement data?
Sorry for the confusion. I wanted to ask about the output measurement data from PID block. Can I save the data?
01-30-2018 05:22 AM
accessing data via s-/ftp/webdav is nothing you do from inside a VI!
of course you can save your data, you just have to build something that writes your data to a file.
if you want to build a standalone application on the crio that is controlled by a "gui" app on the pc, you need to use the network streams!
and regardless you need a proper architecture, read up on producer-consumer design pattern