From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Options for having cFP write and read file

I have a cFP VI that runs on a cFP 2110 controller for doing process automation on a custom piece of equipment.  It seems that each month we use the same equipment for a slightly different automated process routine.  What I have done in the past is to make a copy of my VI's and real-time project and then make the changes in the code for the new process.  Most of the changes to the code between processes are just changes to numeric controllers to change ramp and slope times or the number of times the code repeats a set of steps.  I have been playing around with writing a sort of configurations page to my VI to allow the user to change some numeric controls, save them to a file using the Read Key.VI and Write Key.VI.  In the simple tests I have done, this works If I have a target VI on the cFP 2110 and a host VI where I can have the configurations page and save the file to my computer's hard drive. 

 

The configurations file I would create would probably have 15-30 numeric controls and maybe some string commands.  I have a couple of questions about doing this.  Do I need to go back and create both Target and Host VI and communicate between the two using shared variables, or can I just keep my current VI and write a subVI that would save my files to the cFP controller?  If I save the files to the cFP controller, can user set the numeric controller and save the file and/or  likewise call-up any of say one of say 10 differnet files to populate the various sub-VI and run? 

 

Finally, provided that I can write and read these small configuration numeric controller files to the controller, is there any advantage to writing the files to one method or the other: writing to the controller vs, creating a target and host VI to load the data?

 

Thank you for the help. 

Danny
0 Kudos
Message 1 of 7
(6,465 Views)

Danny,

 

You can absolutely write a subVI that will place the file on your cRIO. I would check out the FTP LabVIEW Help to see how this can be accomplished. When you use this VI you can specify the IP address of your cRIO and place the file you want to write in the ni-rt folder.

 

If I'm understanding your second question, you can have multiple files on the cRIO as long as they have different names. You can then call any one of the files from the cRIO to get the information that you want.

 

Either method should work fine. I don't see any substantial benefits to implementing one solution versus the other. Let me know if you have any more questions.

Stephanie A.
Americas Marketing Manager
National Instruments
0 Kudos
Message 2 of 7
(6,444 Views)

StephanieO, thank you for the help.  When writing a data files to the compact fieldpoint from a running VI on the cFP, does the file really have to be saved on the controller by using FTP, or can you just do a standard write but specify the file path to the controller?

 

Thank again for the help.

 

 

Danny
0 Kudos
Message 3 of 7
(6,438 Views)

Danny,

 

If you are using a subVI from your Host PC, you would need to FTP the files over to the cFP.

 

If you are running a Target VI on the cFP, then you can do a standard write and specify the path to reside on the cFP controller.

Stephanie A.
Americas Marketing Manager
National Instruments
0 Kudos
Message 4 of 7
(6,401 Views)

StepanieO,

 

I finally had a change to play around with the cFP file write and read again.  I was able to write a the cFP and read the file back using write to spreadsheet and read from spreadsheet.  The one problem I can't seem to figure out is how you browse the cFP to select a file.  If I enter the file name and path into the string command it works.  But If I try to browse the cFP, the browse button only shows the computer hard drives.  Is there a way to browse the cFP controller for a specific file?

 

Thank you for the help.

 

Danny

 

 

Danny
0 Kudos
Message 5 of 7
(6,356 Views)

Danny,

 

Unfortunately there is not a way to browse for a path on your cFP target. The VI you are modifying is hosted on the PC until it is deployed. This means that when you browse for a path it will browse on the development PC instead of your cFP target. Creating a constant is the perfect solution to ensure that you are writing to your cFP when your VI is deployed.

Stephanie A.
Americas Marketing Manager
National Instruments
0 Kudos
Message 6 of 7
(6,339 Views)

StephanieO,

 

Thank you for the help.  

Danny
0 Kudos
Message 7 of 7
(6,337 Views)