01-22-2012 09:19 PM
I have developed an application in LabVIEW FPGA 2011 on an R-series PXI board and a LabVIEW 2011 host application on Windows XP to communicate with it via DMA FIFO. I'm trying to adapt the interface to CVI 8.1 (preferred) or CVI 2009 using the FPGA Interface C API 2.0. The FIFO example that it stores in the C:\Documents and Settings\All Users\Documents\National Instruments\FPGA Interface C API\Examples\ directory left me with a few questions:
- Jim
Solved! Go to Solution.
01-23-2012 11:39 AM
Jim,
In regards to your questions:
1. Yes those two functions do the same thing, however there is one big difference between the two. NiFpga_AcquireFifoWriteElementsI16 acquires, writes and releases FIFO elements to prevent the need to write first into a separate user-allocated buffer then copy the contents of elements to the host memeory buffer. Whereas, NiFpga_WriteFifoI16 does not. So the NiFpga_ReleaseFifoElements should always be used with the NiFpga_WriteFifoI16. The example is just showing how the code should be used, but is not necessarily showing which functions should be used together. I completely understand why it was confusing.
2. The best way to ensure that you have a valid session is by using the NiFpga_IsNotError() function. I've attached a screenshot of example code that demonstrates the best way to accomplish this and inserted the image below.
3. In regards to using CVI 8.1, there isn't anything in specific that would make your code not work in 8.1, however we can guarantee that C API 2.0 will work successfully with 9.0.
Regards,
Larry H.
01-23-2012 12:24 PM
01-23-2012 01:19 PM
Jim,
In regards to question 2, if a session is successfully initialized, you would expect a non-zero number. When a session is not initialized, I believe you should expect a value of 0 to be present.
In regards to quesiton 3, it appears that using older versions of CVI are not compatible with C API 2.0 when it comes to actually running the code. But yes, I must agree, it is very fast when used with the proper software.