Technical description Chapter 9
PA 3110
53
e) Example in C for Windows NT / 95 (synchronous mode)
void main(void)
{
int i_Cpt;
unsigned char b_Gain [4];unsigned char b_Polar [4];unsigned char b_Channel [4];
unsigned char b_BoardHandle;
if (Initialisation(&b_BoardHandle) == 0)
{
if (i_PA3110_SetBoardIntRoutineWin32(b_BoardHandle,SYNCHRONOUS_MODE,
sizeof(str_UserStruct),
(void **) &GlobalUserStruct,
v_InterruptRoutine) == 0)
{
b_Channel[0] = PA3110_CHANNEL_0;
b_Gain
[0] = PA3110_1_GAIN;
b_Polar
[0] = PA3110_UNIPOLAR;
b_Channel[1] = PA3110_CHANNEL_1;
b_Gain
[1] = PA3110_1_GAIN;
b_Polar
[1] = PA3110_UNIPOLAR;
b_Channel[2] = PA3110_CHANNEL_2;
b_Gain
[2] = PA3110_1_GAIN;
b_Polar
[2] = PA3110_UNIPOLAR;
b_Channel[3] = PA3110_CHANNEL_3;
b_Gain
[3] = PA3110_1_GAIN;
b_Polar
[3] = PA3110_UNIPOLAR;
if (i_PA3110_InitAnalogInputAcquisition (b_BoardHandle,4,b_Channel,b_Gain,b_Polar,
PA3110_SIMPLE_MODUS, 1500,0,16,
PA3110_DMA_USED,PA3110_SINGLE) == 0)
{
ps_GlobalUserStruct -> b_ReceiveInterrupt = 0;
if (i_PA3110_StartAnalogInputAcquisition (b_BoardHandle) == 0)
{
while (ps_GlobalUserStruct -> b_ReceiveInterrupt == 0);
ps_GlobalUserStruct -> b_ReceiveInterrupt = 0;
printf("\n Acquisition 1 %u %u %u %u %u %u %u %u \n%u %u %u %u %u %u %u %u",
ps_GlobalUserStruct -> ui_SaveArray[0],
ps_GlobalUserStruct -> ui_SaveArray[1],
ps_GlobalUserStruct -> ui_SaveArray[2],
ps_GlobalUserStruct -> ui_SaveArray[3],
ps_GlobalUserStruct -> ui_SaveArray[4],
ps_GlobalUserStruct -> ui_SaveArray[5],
ps_GlobalUserStruct -> ui_SaveArray[6],
ps_GlobalUserStruct -> ui_SaveArray[7],
ps_GlobalUserStruct -> ui_SaveArray[8],
ps_GlobalUserStruct -> ui_SaveArray[9],
ps_GlobalUserStruct -> ui_SaveArray[10],
ps_GlobalUserStruct -> ui_SaveArray[11],
ps_GlobalUserStruct -> ui_SaveArray[12],
ps_GlobalUserStruct -> ui_SaveArray[13],
ps_GlobalUserStruct -> ui_SaveArray[14],
ps_GlobalUserStruct -> ui_SaveArray[15]);
i_PA3110_StopAnalogInputAcquisition(b_BoardHandle);
i_PA3110_ClearAnalogInputAcquisition(b_BoardHandle);
}
else
printf("\n Start acquisition error");
}
else
printf("\n Acquisition initialisation error");
i_PA3110_ResetBoardIntRoutine(b_BoardHandle);
}
else
printf("\n Interrupt routine initialisation error");
i_PA3110_CloseBoardHandle(b_BoardHandle);
}
else
printf("\n Initialisation error");
}
Summary of Contents for ADDIALOG PA 3110
Page 35: ......