Set Operation Condition

The basic operation of the counter is to count signals input from external.
The counter has a function of comparing count match, and other operations can be performed at the timing when the preset count value matches the current count value.

Operation after Comparison Count match

1. Output pulses to external
2. Preset count value load
3. Comparison count value load

Operation occurs by comparison count match, 1 "Output pulses to external" is automatically performed.
It is possible to set whether or not to use loading of the 2 "Preset count value load" and 3 "Comparison count value load".

Use function AioSetCntComparisonMode to do this setting.

Ret = AioSetCntComparisonMode( Id , CntChannel , CntMode )

Sets the channel number of counter in the CntChannel.

Specifies the operation mode from the following  range in macro or numerical value in the CntMode.
CntMode has the following meanings in bit, it can be specified by a combination of these bits.

Operation mode

Macro

Value

Preset count value load

CNT_LOADPRESET

00000001H

Comparison count value load

CNT_LOADCOMP

00000002H

"Preset count value load" is an operation which the count value will move to the preset value set in advance after comparison count match.
If the value is set, you must set the preset value using the function AioSetCntPresetReg.
If the preset value isn't set, it becomes the initial value 0.

"Comparison count value load" is an operation which the next comparison count value will be updated to the set value in advance after comparison count match.
If the value is set, you must set the comparison count value using the function AioSetCntComparisonReg.
If the comparison count value isn't set,  it becomes the initial value 0.