APCI-/CPCI-1500 Technical
description Chapter 10
106
d) Example in C for Windows NT/95/98 (in asynchronous mode)
void main (void)
{
int
i_ReturnValue;
unsigned
char
b_BoardHandle;
if (Initialisation (&b_BoardHandle) == 0)
{
if (i_APCI1500_SetBoardIntRoutineWin32 (b_BoardHandle, APCI1500_ASYNCHRONOUS_MODE,
0, NULL, v_InterruptRoutine) == 0)
{
i_ReturnValue = i_APCI1500_InitTimerInputClock (b_BoardHandle, APCI1500_1_8_KHZ);
printf ("\nTimer input clock initialisation return value = %d", i_ReturnValue);
i_ReturnValue = i_APCI1500_InitTimerCounter1
(b_BoardHandle, APCI1500_ENABLE);
printf ("\nTimer initialisation return value = %d", i_ReturnValue);
i_ReturnValue = i_APCI1500_StartTimerCounter1
(b_BoardHandle);
printf ("\nTimer start return value = %d", i_ReturnValue);
do
{
printf ("\nTimer interrupt counter = %d", b_TimerCounterCpt [0]);
}
while (!kbhit());
getch ();
i_ReturnValue = i_APCI1500_StopTimerCounter1
(b_BoardHandle);
printf ("\nTimer stop return value = %d", i_ReturnValue);
i_ReturnValue = i_APCI1500_ResetBoardIntRoutine (b_BoardHandle);
printf ("\nReset board interrupt return value = %d", i_ReturnValue);
i_ReturnValue = i_APCI1500_CloseBoardHandle
(b_BoardHandle);
printf ("\nClose board handle return value = %d", i_ReturnValue);
}
else
{
printf ("\nInterrupt initialisation error");
i_ReturnValue = i_APCI1500_CloseBoardHandle
(b_BoardHandle);
printf ("\nClose board handle return value = %d", i_ReturnValue);
}
}
else
{
printf ("\nBoard initialisation error");
}