
In this Usual Counter Sample, you can configure various settings and check the operation easily.
When viewing/changing the source code for
basic counter functions only, please refer to [Flow
Chart for Counter Function].
When viewing/changing the source code for the count match function in addition
to the counter function, please refer to [Flow
Chart for Output Pulse when Count Match [Usual Counter]].
This sample program requires use with a usual
counter type device.
To check the counter type of the device you are using, please refer to
[Counter
Type Specifications].
If you are using a high-performance counter type device, please use the [High-performance Counter Callback Sample].
Step to Operate
Input the device name set in the Device Manager into [Device Name], and click the [CntInit] button.
Click the [Mode Set...] button to display the [Set
Mode] dialog.
After setting the mode, click the [OK] button.
For details about mode settings, please refer to Counter
Operation Mode Setting.
Click the [Comparison Set...] button to display the
[Comparison Set] dialog.
In the case of using count match function, specify the comparison value
and pulse length, and click the [OK] button.
In the case of not using count match function, click the [Cancel] button
to close the dialog.
For details about count match function, please refer to Count
Match Setting [Usual Counter].
In this sample program, message notification is used for event processing
when count matches.

Click the [CntStartCount] button to start count.
Click the [CntPreset] button to set the count value described in "Preset Value".
Click the [CntStopCount] button to stop count.
Click the [CntExit] button to end the use of the device.
Click the [Exit] button to end the program.