Duplicating the Project
Before moving an FPGA example to a different target, make a duplicate of the original example. This way you do not modify the original and can return to it later if you choose to make changes.
- Open the example you want to move to a new FPGA target in the LabVIEW software. This tutorial uses the NI 9205 Basic IO.lvproj example in the NI Example Finder at Hardware Input and Output » CompactRIO » Module Specific IO » Analog Input » NI 9205 Basic IO.lvproj.
- Make a duplicate of the project and VIs by navigating to File » Save As. Click Duplicate .lvproj file and contents and Select the contents to copy. Click Continue.
. Duplicate the original example.
- Deselect the Dependencies folder(s) so LabVIEW uses copies of the dependencies from vi.lib rather than a new copy. Click OK and choose a location to save the files.
. Deselect the dependencies to minimize unnecessary code copies.
- Close the original example and open the new copy.
Moving the Files to a New Target
When moving an example to a new target, copy all the VIs, I/O, and FPGA resources specific to the example to the new target to ensure LabVIEW FPGA can link the project resources with the physical FPGA resources. LabVIEW FPGA uses the names of the VIs, I/O, and FPGA resources such as DMA FIFOs, registers, and memory items to link your code with the project resources.
- Add your target, including your FPGA and any I/O, to the project.This tutorial moves the example to a cRIO-9036 device.
- To add a remote FPGA target such as a CompactRIO or Single-Board RIO device, right-click the top Project item in the project and click New » Targets and Devices. Select your remote target from the list. To add the FPGA target, right-click the chassis item on the newly added target and click New » FPGA Target.
- To add a local FPGA target such as an R Series card, right-click My Computer in the project and click New » Targets and Devices. Select your local FPGA target from the list.
- To add I/O to the FPGA target, right-click the FPGA target and click New » C Series Module or FPGA I/O.
. Add the intended FPGA target to the project by right-clicking the item, choosing New » Targets and Devices
, and locating the cRIO-9036 in the displayed list.
- Expand the CompactRIO target, chassis, and FPGA target of both targets. Move the VIs and FPGA resources (DMA FIFOs, registers, memory items, and so on) between the existing and new target by clicking and dragging between the two. Any host VIs on a Real-Time target should also be copied.
. Move VIs and FPGA resources between targets. In this example, NI 9205 Basic IO (FPGA).vi, NI 9205 Basic IO (Host).vi, and the Data DMA FIFO were moved from the cRIO-9068 to the cRIO-9036.
- Rename the I/O under the new target to match the I/O names under the original target. Right-click on any I/O channels whose names need to be changed and click Rename. LabVIEW FPGA uses the input type (that is, analog input) and name to link physical channels to I/O nodes on the block diagram. In this example, no I/O needs renaming because the default channel names were used.
. Rename a FPGA I/O channel.
- Open the main VI for the example under the new target. Ensure the run arrow is not broken. If the run arrow is broken, use the error list (View » Error List) to debug and fix the root cause of the broken VI such as a missing subVI, incorrectly named I/O, or missing FPGA resources under the FPGA target.
. Examine the run arrow of the retargeted FPGA VI to ensure all VIs, I/O, and FPGA resources were moved correctly.
- Remove the old FPGA target from the project by right-clicking on the target and clicking Remove from Project.
. Remove the old target from the project when no longer needed.
Compiling the Code
To complete the process of moving the FPGA VI to a new target, recompile the FPGA VI and update the FPGA VI reference in the host application if needed.
- Right-click the main FPGA VI and click Create Build Specification.
. Create an FPGA build specification for the retargeted example.
- Right-click the created build specification and click Build. Select your compile server in the window and click OK. The compilation process may take several minutes to several hours, depending on the complexity of the example.
. Build the FPGA code.
- If the example has a host VI, locate the Open FPGA VI Reference node on the block diagram, right-click it, and click Configure Open FPGA VI Reference. Otherwise, skip to step 5.
. Locate the Open FPGA VI Reference and open the configuration window to change the FPGA target.
- Click the folder to the right of the build specification field and select the FPGA VI in the displayed window. Click OK. Click OK in the Configure Open FPGA VI Reference window. The host VI should no longer have broken wires related to the FPGA nodes.
. Choose the updated FPGA VI to run and use for the FPGA reference in the host VI.
- Run the code after the FPGA code finishes compiling.