コード例 #1
0
        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;
            }
        }