RTC6 boards
Doc. Rev. 1.0.21 en-US
16 Appendix A: The RTC6 Ethernet Board
901
16.4.2 Example Code (C++):
Initialization Covering
RTC6 Ethernet Boards
// Abstract
// A console application to demonstrate how to initialize RTC6 boards
//
// Comment
// This application demonstrates how to properly intialize RTC6 boards.
// It will enumerate all available PCIe boards as well as search for Ethernet boards in a given subnet.
//
// Platform
// Win32 - 32-bit Windows
// x64 - 64-bit Windows
//
// Necessary Files
// RTC6impl.h
// RTC6DLL.dll for Win32 or RTC6DLLx64.dll for x64
// RTC6DLL.lib for Win32 or RTC6DLLx64.lib for x64
// RTC6DAT.dat
// RTC6OUT.out for PCIe boards and/or RTC6ETH.out for Ethernet boards
// RTC6RBF.rbf
// Cor_1to1.ct5 or any other correction file
//
// Compiler
// - tested with Microsoft C++ Compiler 19.00.24215.1.
#include
"
RTC6impl.hpp
"
#include <iostream>
#include <array>
#include <string>
#include <conio.h>
using namespace std;
// RTC error codes
const UINT ERROR_NO_ERROR = 0U;
const UINT ERROR_NO_CARD = 1U;
const UINT ERROR_VERSION_MISMATCH = 256U;
// Use current working directory as path
const char* PROGRAM_FILE_PATH = nullptr;
// Use Cor_1to1.ct5 in current working directory as correction file
const char* CORRECTION_FILE_PATH =
"
./Cor_1to1.ct5
"
;
// Subnet to use for Ethernet board search
const char* ETH_SEARCH_IP =
"
192.168.250.253
"
;
const char* ETH_SEARCH_NETMASK =
"
255.255.255.0
"
;
bool LoadProgramAndCorrectionFile(UINT card)
{
// DAT, ETH/OUT and RBF need to be in the current working directory
const auto loadProgram = n_load_program_file(card, PROGRAM_FILE_PATH);
if (loadProgram != ERROR_NO_ERROR)
{
cout <<
"
n_load_program_file for card
"
<< card <<
"
failed with error code:
"
<< loadProgram << endl;
return false;
}
// Acquire board for further access
const auto acquire = acquire_rtc(card);
if (acquire != card)
{
cout <<
"
acquire_rtc for card
"
<< card <<
"
failed with error code:
"
<< acquire << endl;
return false;
}