static void Main(string[] args) { // TODO: Select a board UInt32 systemId = 1; UInt32 boardId = 1; // Get a handle to the board IntPtr handle = AlazarAPI.AlazarGetBoardBySystemID(systemId, boardId); if (handle == IntPtr.Zero) { Console.WriteLine("Error: Open board {0}:{1} failed.", systemId, boardId); return; } // Configure sample rate, input, and trigger parameters if (!ConfigureBoard(handle)) { Console.WriteLine("Error: Configure board {0}:{1} failed", systemId, boardId); return; } // Acquire data from the board to an application buffer, // optionally saving the data to file if (!AcquireData(handle)) { Console.WriteLine("Error: Acquire from board {0}:{1} failed", systemId, boardId); return; } }
static unsafe void Main(string[] args) { // TODO: Select a board UInt32 systemId = 1; UInt32 boardId = 1; // Get a handle to the board IntPtr boardHandle = AlazarAPI.AlazarGetBoardBySystemID(systemId, boardId); if (boardHandle == IntPtr.Zero) { Console.WriteLine("Error: Open board {0}:{1} failed.", systemId, boardId); return; } // Get a handle to the FFT module UInt32 retCode; UInt32 numModules; IntPtr fftHandle = IntPtr.Zero; retCode = AlazarAPI.AlazarDSPGetModules(boardHandle, 0, &fftHandle, &numModules); if (numModules < 1) { Console.WriteLine("This board does any DSP modules"); return; } retCode = AlazarAPI.AlazarDSPGetModules(boardHandle, 1, &fftHandle, &numModules); // TODO: Select the record length UInt32 recordLength_samples = 2048; // Configure sample rate, input, and trigger parameters if (!ConfigureBoard(boardHandle, fftHandle, recordLength_samples)) { Console.WriteLine("Error: Configure board {0}:{1} failed", systemId, boardId); return; } // Acquire data from the board to an application buffer, // optionally saving the data to file if (!AcquireData(boardHandle, fftHandle, recordLength_samples)) { Console.WriteLine("Error: Acquire from board {0}:{1} failed", systemId, boardId); return; } }
//--------------------------------------------------------------------------- // // Function : DisplayBoardInfo // // Description : Display information about a board // //--------------------------------------------------------------------------- static public unsafe bool DisplayBoardInfo(UInt32 systemId, UInt32 boardId) { UInt32 retCode; IntPtr handle = AlazarAPI.AlazarGetBoardBySystemID(systemId, boardId); if (handle == IntPtr.Zero) { Console.WriteLine("Error: Open systemId {0} boardId {1} failed", systemId, boardId); return(false); } UInt32 samplesPerChannel; byte bitsPerSample; retCode = AlazarAPI.AlazarGetChannelInfo(handle, &samplesPerChannel, &bitsPerSample); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarGetChannelInfo failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } UInt32 aspocType; retCode = AlazarAPI.AlazarQueryCapability(handle, AlazarAPI.ASOPC_TYPE, 0, &aspocType); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarQueryCapability failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } byte cpldMajor; byte cpldMinor; retCode = AlazarAPI.AlazarGetCPLDVersion(handle, &cpldMajor, &cpldMinor); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarGetCPLDVersion failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } UInt32 serialNumber; retCode = AlazarAPI.AlazarQueryCapability(handle, AlazarAPI.GET_SERIAL_NUMBER, 0, &serialNumber); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarQueryCapability failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } UInt32 latestCalDate; retCode = AlazarAPI.AlazarQueryCapability(handle, AlazarAPI.GET_LATEST_CAL_DATE, 0, &latestCalDate); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarQueryCapability failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } Console.WriteLine("System ID = {0}", systemId); Console.WriteLine("Board ID = {0}", boardId); Console.WriteLine("Serial number = {0}", serialNumber); Console.WriteLine("Bits per sample = {0}", bitsPerSample); Console.WriteLine("Max samples per channel = {0}", samplesPerChannel); Console.WriteLine("CPLD version = {0}.{1}", cpldMajor, cpldMinor); Console.WriteLine("FPGA version = {0}", (aspocType >> 16) & 0xff, (aspocType >> 24) & 0xf); Console.WriteLine("ASoPC signature = {0}", aspocType); Console.WriteLine("Latest calibration date = {0}", latestCalDate); if (IsPcieDevice(handle)) { // Display PCI Express link information UInt32 linkSpeed; retCode = AlazarAPI.AlazarQueryCapability(handle, AlazarAPI.GET_PCIE_LINK_SPEED, 0, &linkSpeed); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarQueryCapability failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } UInt32 linkWidth; retCode = AlazarAPI.AlazarQueryCapability(handle, AlazarAPI.GET_PCIE_LINK_WIDTH, 0, &linkWidth); if (retCode != AlazarAPI.ApiSuccess) { Console.WriteLine("Error: AlazarQueryCapability failed -- " + AlazarAPI.AlazarErrorToText(retCode)); return(false); } Console.WriteLine("PCIe link speed = {0} Gbps", 2.5 * linkSpeed); Console.WriteLine("PCIe link width = {0} lanes", linkWidth); } Console.WriteLine(""); // Toggling the LED on the PCIe/PCIe mounting bracket of the board int cycleCount = 2; int cyclePeriod_ms = 200; if (!FlashLed(handle, cycleCount, cyclePeriod_ms)) { return(false); } return(true); }