Instruction manual

AMPDIO DRIVERS
Page 86
CardType = DIO_TC.GetBoardModel(hBoard);
if (CardType = <Wanted>)
{
break; // Exit loop as we
// have valid card
}
else
{
// Free the unwanted card
DIO_TC.FreeBoard(hBoard);
}
}
hBoard = -1; // We don't have a suitable card
// Try the Next card
}
8) Go back to the form design window and press the F4 key to open the form’s properties
window. On the form properties, select ‘Events’ (represented by a ‘lightning strike’ icon).
Double click on the ‘Behavior|Closed’ method to add the ‘Form1_Closed’ function to the source
code window and add the following code to the function:
if (hBoard >= 0)
{
DIO_TC.FreeBoard(hBoard);
}
These steps will create the shell of a C#.NET application that can now be run. The program at this
stage does nothing more than register a board with the DLL on start-up, and free that board on
exit.
Section 6.4 describes the library functions available. All functions and constants are part of the
‘DIO_TC’ class in the ‘Amplicon.AmpDIO’ namespace. Where arguments to functions are
described as pointers, the address of a user-declared variable is required. For a simple variable,
the ‘&’ operator may be used, as for the C language. 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#.NET code example for displaying the Z1 Counter 0 count value would be as follows:
int count;
DIO_TC.TCgetCount(hBoard, Z1, 0, &count);
Text1.Text = count.ToString;
To pass a pointer to the first element of an array to one of the library functions, it is necessary to
use a ‘fixed’ statement to prevent the array being relocated. For example, using the
TCdriveNCBufferUserInterrupt function in some non-callback user interrupt code:
fixed (int *pData = &MyData[0])
{
DIO_TC.TCDriveNCBufferUserInterrupt(hBoard, hIntr,
(uint *)pData, &RetLength);
}
6.4 DIO_TC.DLL Library Functions
Details are given of each of the functions provided in the supplied Windows Dynamic Link Library
(DIO_TC.DLL).