Callback Function

Use function AioSetAiCallBackProc to register the callback function.

Ret = AioSetAiCallBackProc ( Id , CallBackProc , AiEvent , Param)

In CallBackProc, specify the pointer of the created callback function.
Please set for each language as follows.

When callback function name is CallBackProc

VB: Ret = AioSetAiCallBackProc(Id, AddressOf CallBackProc, AIE_END, 0)
VC: Ret = AioSetAiCallBackProc(Id, CallBackProc, AIE_END, this);

In AiEvent, specify the event factor by macro or numeric value from the following range.
AiEvent has the following meaning in bit units, and can be specified by combined them.
Event factors that can be used differ between the device buffer and user buffer.

Event Factor

When Using Device Buffer

When Using User Buffer

Macro

Value

Event that AD conversion start

OK

OK

AIE_START

00000002H

Event that repeat end

OK

OK

AIE_RPTEND

00000010H

Event that device operation end

OK

OK

AIE_END

00000020H

Event that the specified number of data are stored

OK

NG

AIE_DATA_NUM

00000080H

Event that the specified number of data are transferred

NG

OK

AIE_DATA_TSF

00000100H

Event that overflow

OK

OK

AIE_OFERR

00010000H

Event that sampling clock period error

OK

OK

AIE_SCERR

00020000H

Event that AD conversion error

OK

OK

AIE_ADERR

00040000H

Event that AD conversion start
This event occurs when the start condition of AD conversion is satisfied.
This event is invalid when the conversion start condition is [Software].

Event that repeat end
This event occurs each time the repeat operation ends.

Event that device operation end
This event occurs when all operations including repeat are completed.

Event that the specified number of data are stored
An event occurs when the number of sampling times in memory exceeds the value set by function AioSetAiEventSamplingTimes. For FIFO memory, an event occurs each time the condition is satisfied. For RING memory, events corresponding to the number of repeat times are generated.
When using [Event that the specified number of data are stored], use function AioSetAiEventSamplingTimes to set the number of sampling times for generating event.

Ret = AioSetAiEventSamplingTimes ( Id , AiSamplingTimes )

In AiSamplingTimes, set the number of sampling times for generating event. For FIFO memory, an event occurs each time the condition is satisfied. For RING memory, events corresponding to the number of repeat times are generated.

Event that the specified number of data are transferred
This event occurs each time the number of data are transferred, which is set by function AioSetAiEventTransferTimes.
When using [Event that the specified number of data are transferred], use function AioSetAiEventTransferTimes to set the number of transfer times for generating event.

Ret = AioSetAiEventTransferTimes ( Id , AiTransferTimes )

In AiTransferTimes, set the number of transfer times for generating event.

Event that overflow
This event occurs when trying to store conversion data in the memory which is in the full state.

Event that sampling clock period error
This event occurs when the sampling clock period is too fast and the conversion stops.

Event that AD conversion error
This event occurs when conversion stops due to an AD conversion error.

In Param, set a parameter to be passed to the callback function with a pointer.