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
100
innovators for industry
6.2.5 Example Code (C)
The following C source code for a console
user program (environment: Win32) illustrates the
programming fundamentals of RTC6 DLL and
RTC6 PCIe Board initialization (for complete demo
programs, see Chapter 11 ”Demo Programs”,
page 866).
Necessary sources:
RTC6impl.h
,
RTC6DLL.lib
(for
implicit linking) or
RTC6expl.h
,
RTC6expl.c
(for explicit
linking) to link the RTC6 DLL to the program, see
Chapter 6.2.1 ”DLL Calling Convention”, page 95. If
the operating system does not find the
RTC6DLL.dll
on user program startup, it produces a
corresponding error message and terminates the
program.
// System header files
#include <windows.h>
#include <stdio.h>
#include <conio.h>
// RTC6 header file for implicitly linking to the RTC6DLL.dll (for building the executable, also link
// with the (Visual C++) import library RTC6DLL.lib):
#include
"
RTC6impl.h
"
// Alternatively: RTC6 header file for explicitly linking to the RTC6DLL.dll
// (for building the executable, link with the file RTC6expl.obj, which you can generate
// from the RTC6expl.c source code):
//#include
"
RTC6expl.h
"
void __cdecl main( void*, void* )
{
// only for explicitly linking:
// if ( RTC6open() ) // error detected, RTC6open returns 0 for no error
// {
// printf(
"
Error: RTC6DLL.dll not found\n
"
);
// terminateDLL();
// return;
// }
printf(
"
Initializing the DLL\n\n
"
);
UINT ErrorCode;
// Initializing the
RTC6 DLL
(the following command must be called as the first RTC6 command)
ErrorCode = init_rtc6_dll();
// Following init_rtc6_dll you should include a program code to catch an error during
// initialization, for example, for the case the desired board is not detected, access is denied
// or for another error (for example, a version mismatch).
// See Chapter 6.8.3 ”Example Code (C)”, page 133.

Table of Contents