Example 3 for Using Event Controller

Here is an example of setting the event controller that analog input is performed at the timing of counter comparison count match.

Connect [Counter comparison count match signal] to [Analog input conversion start signal].

1. Set the start condition of analog input

Use function AioSetAiStartTrigger to set the conversion start condition.
Since the control signal from counter is used as the start condition, the parameter is 10 (Event controller output).

Ret = AioSetAiStartTrigger ( Id , 10 )

2. Set the event controller

Set the event controller.
The connection destination (Destination) is [Analog input conversion start signal].
The connection source (Source) is [Counter comparison count match signal].

Ret = AioSetEcuSignal ( Id , AIOECU_DEST_AISTART , AIOECU_SRC_CNT_COMP )

In this case, conversion starts from the analog input. In fact, conversion does not start until counter comparison count match occurs.

3. Conversion start

Ret = AioStartAi ( Id )
Ret = AioStartCnt ( Id )