Counter


Appearance

 

Overview

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.
Please note that it is different from the initial value of the driver.

Program name

./counter

Operating channel

1 channel only

Event

Comparison count match event, Counter operation error

  

Step to Use

1. Specify the desired program name, run the program, and a CUI(Character User Interface) menu that looks like the one above will appear.
    Appearance may vary depending on software version.

 

2. Initialize

  - When selecting the command [1: AioInit], you can specify the device name.
    Notifies the device driver to start using the specified device.
    When specifying the device name, AioInit will be executed and the CUI menu will be displayed again.
    

  - When selecting the command [3 : Counter Channel No. Set], you can specify the counter channel No..
    When specifying the counter channel No., the CUI menu will be displayed again.

    

 

3. Processing of Counter Set

  - When selecting the command [4 : Counter Settings], the Counter Settings menu will be displayed.
    

  - When selecting [1: Comparison Counter Set] in the Counter Settings menu, you can set the comparison count.
    You can specify the valid/invalid of the comparison count function, the comparison count data, and the valid/invalid of the repeat setting function.
    When the comparison count setting is specified, the Counter Settings menu will be displayed again.

    Up to 5 comparison count data 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.
    

  - When selecting [2: Comparison Match Preset Set] in the Counter Settings menu, you can set the comparison match preset setting.
    You can specify the valid/invalid of the comparison match preset function, the comparison match preset data, and the valid/invalid of the repeat setting function.
    When the comparison match preset setting is specified, the Counter Settings menu will be displayed again.

    Up to 5 comparison match preset setting 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.
    

  - When selecting [b: Back] from the Counter Settings menu, you will return to the Top menu.

 

4. Processing of Counter Preset

  - When selecting the command [5 : AioPresetCnt], you can preset the counter value.
    When specifying the preset value, AioPresetCnt will be executed and the CUI menu will be displayed again.
    

 

5. Counter Operation

  - When selecting the command [6 : Count Start], counting will start according to the set conditions.
    

  - When selecting the command [7 : AioGetCntCout], the count value will be displayed.
    

  - When selecting the command [8 : AioGetCntStatus], the status will be displayed.
    

  - When selecting the command [9 : Count Stop], counting will stop.
    

 

6. Exit

  - When selecting the command [10 : AioExit], it will notify the device driver that the use of the current device is complete.
    Data can be acquired from different devices (e.g. AIO001, etc.) without terminating the program.
    When AioExit is executed, the CUI menu will be displayed again.
    

  - To perform data acquisition processing again, select the command [1 : AioInit] and specify a new device name to perform device initialization processing.

 

7. Processing to terminate the program

  - When selecting the command [q : Quit], the program will terminate.