Example Code - Scanlab RTC 5 PC Interface Board Installation And Operation Manual

Table of Contents

Advertisement

6.2.5 Example Code

The following C source code for a console application
(environment: Win32) illustrates the programming
fundamentals of DLL and RTC
complete demo programs, see
// System header files
#include <windows.h>
#include <stdio.h>
#include <conio.h>
®
// RTC
5 header file for implicitly linking to the RTC5DLL.DLL (for building the executable, also link with the (Visual C++)
// import library RTC5DLL.LIB):
#include "RTC5impl.h"
®
// Alternatively: RTC
5 header file for explicitly linking to the RTC5DLL.DLL (for building the executable, link with the file
// RTC5EXPL.OBJ, which you can generate from the source code RTC5expl.c):
//#include "RTC5expl.h"
void __cdecl main( void*, void* )
{
// only for explicitly linking:
// if ( RTC5open() ) // error detected, RTC5open returns 0 for no error
// {
// printf( "Error: RTC5DLL.DLL not found\n" );
// terminateDLL();
// return;
// }
printf( "Initializing the DLL\n\n" );
UINT ErrorCode;
// Initializing the DLL (the following command must be called as the first RTC
ErrorCode = init_rtc5_dll();
// Following the
init_rtc5_dll
// for the case the desired RTC
// A corresponding example code is listed on
®
// Initializing the RTC
5:
®
// - Selecting the RTC
5 board number 1 as the active RTC
// - If desired: Selecting the RTC
// - Stopping any list running on RTC
// a list might still be running. This would prevent
// - Calling
load_program_file
// included to catch possible errors – e.g. file or system errors – during initialization; see
// - Clearing all previous error codes (stop_execution might have created an RTC5_TIMEOUT or RTC5_BUSY error)
®
// - Configuring the RTC
5 board's list memory, default: 4000 storage positions for list 1, 4000 for list 2).
(void) select_rtc( 1 );
set_rtc4_mode();
stop_execution();
ErrorCode = load_program_file( 0 ); // pPath = 0: path of current working directory
if ( ErrorCode )
{
printf( "Program file loading error: %d\n", ErrorCode );
free_rtc5_dll();
return;
}
reset_error( -1 );
config_list( 4000, 4000 );
// Following the above initialization code you can include the program code defining the laser scan process.
// An example code is listed on
// End of main program
®
RTC
5 PC Interface Board
Rev. 1.9 e
6 Developing User Applications
®
5 initialization (for
page
566).
command you should include a program code to catch an error during initialization, e.g.
®
5 board is not detected, access is denied or for another error (e.g. a version mismatch).
page
90.
®
5 board for this application
®
4 compatibility mode as operation mode (default: RTC
®
5 board number 1 (if this board has been used previously by another application,
load_program_file
for resetting the board, loading the program file, etc. (here also a program code should be
page 97
Necessary sources: RTC5impl.h, RTC5DLL.LIB (for
implicit linking) or RTC5expl.h, RTC5expl.c (for
explicit linking). Additionally, the DLL must be called
by the program (see
page
62). If the operating system
does not find the RTC5DLL.DLL on program startup, it
will produce a corresponding error message and
terminate the program.
®
5 command)
®
5 mode)
and
load_correction_file
page
from being executed).
90)
67

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RTC 5 PC Interface Board and is the answer not in the manual?

Subscribe to Our Youtube Channel

Related Products for Scanlab RTC 5 PC Interface Board

Table of Contents

Save PDF