The National Instruments FPGA Interface C# API is used for communication between processor and FPGA within NI reconfigurable I/O (RIO) hardware such as NI CompactRIO, NI Single-Board RIO, NI FlexRIO, and NI R Series multifunction RIO.
Note this project is not supported by National Instruments and is meant to serve as an example or starting point of how to interact with NI FPGAs from C#. It has only been minimally manually tested and has not been code reviewed.
This project is just the output of an "innovation days" type thing and is probably ~50% written by Github Copilot. I haven't used C# in years so this is mostly the output of throwing the C and Python APIs into Copilot and steering it a little.
Currently supported feature:
- Controls and indicators - every datatype but SGL
- FIFOs - primitive types only, basic reads and writes
Features not yet supported:
- IRQs
- Host Memory Buffer / Low Latency Buffer
- Peer to Peer FIFOs
Contributions are welcome.
using (var session = new Session("BitfilePath.lvbitx", "RIO0"))
{
session.reset();
session.run();
var myControl = session.Registers["MyControl"];
myControl.Write(4);
var data = myControl.Read();
var autoinc_fifo = session.Fifos["DMA 0 Input"];
var autoinc_values = autoinc_fifo.ReaderWriter<uint[]>().Read(20, out elementsRemaining);
}