RTC6 boards
Doc. Rev. 1.0.21 en-US
6 Developing RTC6-User Programs
134
else
{
printf(
"
Initializing the DLL: Error %d detected\n
"
, ErrorCode );
free_rtc6_dll();
return;
}
}
else
{
// Reading the internal board number for the desired
RTC6 board
const UINT SerialNumberOfDesiredBoard ( 12345 );
const UINT RTC6CountCards = rtc6_count_cards();
UINT InternalNumberOfDesiredBoard ( 0 );
for ( UINT i = 1; i <= RTC6CountCards; i++ )
{
if ( n_get_serial_number( i ) == SerialNumberOfDesiredBoard )
{
InternalNumberOfDesiredBoard = i;
}
}
if ( InternalNumberOfDesiredBoard == 0 )
{
printf(
"
RTC6 board with serial number %d not detected.\n
"
, SerialNumberOfDesiredBoard);
free_rtc6_dll();
return;
}
// Selecting the desired
RTC6 board
as the active
RTC6 board
for this user program
if ( InternalNumberOfDesiredBoard != select_rtc( InternalNumberOfDesiredBoard ) )
{
// Errors which occurred during execution of select_rtc
ErrorCode = n_get_last_error( InternalNumberOfDesiredBoard );
if ( ErrorCode & 256 ) // RTC6_VERSION_MISMATCH
{
if ( ErrorCode = n_load_program_file( InternalNumberOfDesiredBoard, 0 ) )
{
printf(
"
n_load_program_file returned error code %d\n
"
, ErrorCode );
}
}
else
{
printf(
"
No access to RTC6 board with serial number %d\n
"
, SerialNumberOfDesiredBoard );
free_rtc6_dll();
return;
}
if ( ErrorCode )
{
printf(
"
No access to RTC6 board with serial number %d\n
"
, SerialNumberOfDesiredBoard );
free_rtc6_dll();
return;
}
else
{
// if n_load_program_file has been successful, select the desired board
(void) select_rtc( InternalNumberOfDesiredBoard );
}
}
}