Instruction manual

Table Of Contents
Page
55
PC215E
6.3 Windows DLL and Examples
The PC215E DLL is a 16-bit Windows programmer's interface to the PC215E board. Provided
that the compiler/interpreter supports Windows, i.e. uses the Windows calling conventions, all
the functions can be called by software written in any language.
For C/C++ language applications, the software includes a ready prepared header file,
DIO_TC.H which covers all function definitions and declared constants. Similarly for Visual
Basic there is a module DIO_TC.BAS for inclusion in a project make file for DLL declarations
and constant definitions. For other languages the user will need to compile a suitable header in
which the DLL functions and constants are declared, and these files can be used as an
example.
The software includes Visual Basic examples as both runtime and source code. The runtime
examples can be used to exercise and become familiar with the hardware. The source code
serves two purposes. Firstly it can be used as a source of reference to see how the DLL
functions are used. Also it provides a starting point for anyone who wishes to write software
with similar functionality.
6.4 DOS 'C' Library and Examples
The 'C' library is a DOS programmer's interface to the PC215E board. The software includes
'C' examples as both runtime and source code. The source code can be compiled using the
Microsoft C/C++ or Borland C++ compilers - conditional compilation based on a #define at the
top of the program file allows the source code to be compatible with both languages.
To define the 'C' compiler in use, a single line in file DIO_TC.H must be changed for Microsoft or
Borland C/C++ users. The line that is not required must be removed (or made inoperative by
commenting out)
The following example extracted from the 'C' source shows the program set up for Borland C++
#define __BORLAND_C__ // Borland C++ users use this
//#define __MICROSOFT_C__ // Microsoft C/C++ users use this
Section 6.6 describes the library functions available. Please note that in C/C++, the function
syntax lines given should always end with a semi-colon. Where arguments to functions are
described as pointers, the address of a user-declared variable is required. This is easily done
by using the '&' reference operator. For example, function
TCgetCount
requires a pointer to a
variable declared as long, into which the count value result will be placed. A typical 'C' code
example for displaying the Z1 Counter 0 count value would be
long count; // declare count as long
TCgetCount( h, Z1, 0, &count ); // pass count by reference
printf( "count = %ld", count ); // count now contains new value
where h is a handle to a registered board. N.B. The large memory model should be used
when compiling the library and example programs.