11-16-2012 05:05 PM
I am planning to use the cRIO, and I would have a relay card with 4 channels. For the application, only the first 2 relays at channel 1 and 2 of the relay module are used. If the relays at channel 1 and 2 go bad, I want to be able to switch to channel 3 and 4 and modify the setting in a ini file without having to change my code. Is that easy to do? I know how to do that in a compact DAQ, but not sure how to do that with FPGA. Thanks!
11-19-2012 03:05 PM
Hey Jyang,
Its not going to be the same process as you went through on a cDAQ. There is no INI file to determine what channels your FPGA uses.
Although you could certainly program the functionality you're looking for using LabVIEW Real-Time/ FPGA. The Real-Time controller can read a INI file you create for it, and decide which input to write to on the FPGA. (Your architecture will change slightly between using the FPGA in scan interface or LabVIEW FPGA.)
You could also program the controller/FPGA to recognize that the relay on channel 1 or 2 has gone bad and automatically switch. (this would likely require additional feedback to the system such as AI channel)
Does that answer your question?
11-19-2012 03:25 PM
so how do I do that? How do I do that with only FPGA? And how do I do that with real time?
11-19-2012 04:46 PM
To use the FPGA on the cRIO you will have to use the Real-Time controller, unless you're referring to an Ethernet RIO such as the 9148.
It may be possible, but highly impractical to read a file on an FPGA, due to the resources required to do so. You'll want to read the file in the Real-Time(RT) code, and communicate those values to the FGPA through I/O methods (LabVIEW FPGA) or by switching to a different set of I/O variables if you're using the scan interface.
On the FPGA you can compile the code to determine which relay to use depending on the input received from the RT controller.
If you did use additional feedback such as an analog in card, you could program the FPGA to determine which relay to used based on that feedback.
11-19-2012 06:09 PM
You are giving me some good ideas, but I have no idea how to impletement them at all.
11-20-2012 11:30 AM
File I/O on a Real-Time target is going to be essentially the same as in regular LabVIEW (there are some good examples in the example finder), just be aware that File I/O is non-deterministic and should not be done in a Time Critical SubVI or Timed loop.
If you're new to LabVIEW Real-Time you may want to look through the Getting Started with the LabVIEW Real-Time Module here.
I'd also recommend checking out our cRIO developers guide. It can be found here.