安装了NI LabVIEW 2015 32bit版本,安装了NI FPGA Interface C API Generator,安装了硬件PCIe-7842R
- 打开FPGA Interface C API Generator,导入之前用LabVIEW编译生成的FPGA bitfile; a.bitfile
- 点击generate,生成了几个个文件:1.FPGA bitfile; 2.NiFpga.c;3.NiFpga.h;4.NiFpga_a.h;5.nidist.id。
其中NiFpga_a.h包含了应用程序中函数调用需要的常量,都是一些宏定义或枚举类型常量,如:
1 typedef enum 2 { 3 NiFpga_StepMode_ControlI16_FramAmp = 0x811E, 4 NiFpga_StepMode_ControlI16_FramOffs = 0x8122, 5 NiFpga_StepMode_ControlI16_FramStep = 0x811A, 6 NiFpga_StepMode_ControlI16_LineAmpl = 0x8132, 7 NiFpga_StepMode_ControlI16_LineOffs = 0x8136, 8 NiFpga_StepMode_ControlI16_LineStep = 0x812E, 9 } NiFpga_StepMode_ControlI16;
这些常量包括了bitfile名字,数字签名和FPGA中寄存器的偏移地址;
NiFpga.c和NiFpga.h对所有工程都是一样的,包含了调用NI FPGA的各种系统函数。
- 新建visual studio控制台应用程序,
在电脑上有关于FPGA Interface C API Generator的example
参考文献:
- 官网给出的R系列FPGA的C API用法说明http://www.ni.com/tutorial/8638/en/
- 电脑上给出的FPGA Interface C API Generator的example
时间: 2024-08-26 08:39:17