This is a sample that performs counter operation. Operation is only for one channel.
This sample program requires selection of a device with a counter input function.
Sample specification |
※This is the initial value of the sample program. |
Program name |
Counter |
Operating channel |
1 channel only |
Event |
Comparison count match event, Counter operation error |
1. Specify the desired program name, run the program, and a window that looks like the one above will appear.
Appearance may vary depending on software version.
2. Initialize
・Specify the device name set in the device manager as the device name, and click the [AioInit] button.
Notifies the device driver to start using the specified device.
3. Processing of Counter Set
・Specify the desired channel No. in [ChannelNo:] and press the [Set...] button to display the counter setting dialog box.
・For the Comparison Count Set or Comparison Match Preset Set, the processing becomes effective when the check box is attached.
・Up to 5 Comparison Count Sets can be reserved.
When the value of [Comparison Count Data] matches with the count value of the specified channel, the next reserved comparison count data becomes valid.
・Up to 5 Comparison Match Preset Sets can be reserved.
When the value of [Comparison Count Data] matches with the count value of the specified channel, the preset value is set to the count value.
In addition, the next reserved preset value becomes valid.
4. Processing of Counter Preset
・Specify the desired value in [Preset Data:] and press the [AioPresetCnt] button to preset the counter.
5. Counter Operation
・When you press the [Count Start] button, counting starts according to the set conditions.
When the comparison count matches, the displayed value of [Comparison Match Count:] is updated.
・When you press the [AioGetCntCount] button, the displayed value of [Count Value:] is updated.
・When you press the [AioGetCntStatus] button, the displayed value of [Status:] is updated.
・Press the [Count Stop] button to stop counting.
6. Exit
・Press the [AioExit] button to notify the device driver that the use of the current device is complete.
Data can be output from different devices (e.g. AIO001, etc.) without terminating the program.
To output data again, specify a new device name and press the [AioInit] button to initialize the device.
7. Processing to terminate the program
・Press the [Close] button in the window to terminate the program.