Implement Callback Function

It is necessary for the callback function to identify the message content and device, and add processing according to the message contents. For creating the skeleton of callback function, please refer to the tutorial of Use Event.

The following parameters are passed to the callback function.

ID
Pass the ID obtained by function AioInit. This ID is used to identify which device uses event notification, when using events on multiple devices.

Message
Pass the message number. For all event notifications used by API-AIO, the content of event is judged by the message number. The range of message number used by API-AIO is 256 from 1000H to 10FFH. The message number corresponding to the analog input event is as follows.

Analog Input Message Factor

Macro

Value

Event that AD conversion start

AIOM_AIE_START

1000H

Event that repeat end

AIOM_AIE_RPTEND

1001H

Event that device operation end

AIOM_AIE_END

1002H

Event that the specified number of data are stored

AIOM_AIE_DATA_NUM

1003H

Event that the specified number of data are transferred

AIOM_AIE_DATA_TSF

1007H

Event that overflow

AIOM_AIE_OFERR

1004H

Event that sampling clock period error

AIOM_AIE_SCERR

1005H

Event that AD conversion error

AIOM_AIE_ADERR

1006H

wParam
Not use.

lParam
Pass the specific parameter of each event.

Event Factor

Parameter

Event that AD conversion start

None

Event that repeat end

Current number of repeat times

Event that device operation end

Current number of sampling times

Event that the specified number of data are stored

Current number of sampling times

Event that the specified number of data are transferred

Current number of transfer times

Event that overflow

Current number of sampling times

Event that sampling clock period error

Current number of sampling times

Event that AD conversion error

Current number of sampling times

Param
Pass the parameters set by function AioSetAiCallBackProc.