EasyManua.ls Logo

Scanlab RTC6 PCIe Board - Example Code (C)

Scanlab RTC6 PCIe Board
1004 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
RTC6 boards
Doc. Rev. 1.0.21 en-US
6 Developing RTC6-User Programs
133
innovators for industry
6.8.3 Example Code (C)
The following example C source code shows how to
catch an error during initialization. It ensures the
user program terminates with an error message, if:
An error occurs during initialization with
init_rtc6_dll (for example, if no RTC6 PCIe Board
has been detected)
The desired RTC6 PCIe Board (here: the board
with serial number 12345) is not found
Access is denied to the desired RTC6 PCIe Board
An error occurs during load_program_file (for
example, a version mismatch, file or system error)
The code must be included in a user program, see
Chapter 6.2.5 ”Example Code (C)”, page 100.
UINT ErrorCode;
ErrorCode = init_rtc6_dll();
if ( ErrorCode )
{
// Reading the number of RTC6 boards detected during initialization with init_rtc6_dll
const UINT RTC6CountCards = rtc6_count_cards();
if ( RTC6CountCards )
{
// Detailed error analysis for all detected boards
UINT AccError( 0 );
for ( UINT i = 1; i <= RTC6CountCards; i++ )
{
// Errors which occurred during execution of init_rtc6_dll
const UINT Error = n_get_last_error( i );
if ( Error != 0 )
{
AccError |= Error;
const UINT SerialNumber = n_get_serial_number ( i );
printf(
"
RTC6 board number %d (serial number %d): Error %d detected\n
"
,
i, SerialNumber, Error );
n_reset_error( i, Error );
}
}
if ( AccError )
{
free_rtc6_dll();
return;
}
}

Table of Contents