请大神帮忙解答
我在LabView中使用array控件创建一个一维数组,数组长度64,编译后用C interface 生成API函数在CVI中调用,但是我调用NiFpga_WriteArrayU8函数向数组写值,总是无法写对,输出管脚测量波形不对。该函数在使用时有什么需要注意的。控件地址是不是这个数组的首地址,连续向里面写数地址指针是否会自动加一,写入的数据长度有特殊要求吗?
求好心人指导。
我的函数调用是这样的:
NiFpga_WriteArrayU8(session,NiFpga_Card4_SPI_ControlArrayU8_ArrayTx_SPI1, WriteData,5);
其中:NiFpga_Card4_SPI_ControlArrayU8_ArrayTx_SPI1是我的数组ID
WriteData是一个100位长度的一维数组。
LabView版本2011
CVI版本2010
C Interface版本12.0
已解决! 转到解答。
Why use C interface? and / or LabVIEW?
Since you already use CVI, why not doing all that in CVI?
Or do everythig in LabVIEW.
That's an very odd combination. No one does that.
So you probably will not get reply.
Hi George
Thanks for your reply!
The reason for my using of LabView and CVI is that I have to use the FPGA of 7833R to emulate a SPI port.
The array is used as buffer for my communication.So I have to use this combination.
In old version of Labview, NI provide a subVI so that the user can easily get the control ID in LabView and program in CVI, and
now NI provide the user C Interface as the combination between CVI and LabView. They other API worked well in my program
such as getting an unsigned char data or writing an unsigned char data. However, the array function don't work well. I don't kown why.
Hope for reply.
Thank you.
Michael.
Could you tell me more details?
I have problem to transfer data from CVI to LabView just for the array control, when I use a unsigned char control to transfer single data, it is successful.
So my problem is how to write an array to LabView or read an array from it by using CVI.
My LabView Version is 2011, CVI is 2010 and C Interface is 12.0.
Can you just write the data to a .csv file in CVI, and then in LabVIEW, read in the file, and then pass to FPGA Interface C API?
Thanks for your reply and please forgive my absense for few days.
I have solved my problem. The way to use the function of NiFpga_WriteArrayU8 is that I have to Write all the data to the array whatever the number of data I want to write. The last variable of the function is the fix lenth of the array you defined in the labview.
I can read and write the array I defined in Labview and use the C Interface function to operate it in CVI.
Thank you very much.
Michael