Technical description Chapter 10
APCI-/CPCI-1500
105
c) Example in C for Windows 3.1x
void main (void)
{
int
i_ReturnValue;
unsigned
char
b_BoardHandle;
if (Initialisation (&b_BoardHandle) == 0)
{
if (i_APCI1500_SetBoardIntRoutineWin16
(b_BoardHandle, 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_TIMER,
1UL,
APCI1500_CONTINUOUS,
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");
}