Finite Sampling Using Device Buffer


Appearance

 

Overview

This sample performs sampling for the specified number of channels/sampling times in device buffer mode.

This sample program requires selecting a device with an analog 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

AiSamplingOnceDev

Conversion data transfer mode

0 (Device buffer mode)

Start condition

0 (Software)

Clock type

0 (Internal clock)

Stop condition

0 (Specified times)

Memory type

0 (FIFO)

Buffer size for saving data

1MByte

Event

Event that device operation end, Event that overflow, Event that sampling clock period error, Event that AD conversion 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.
    

 

3. Analog Input Set

  ・When selecting the command [3 : AioSetAiRangeAll], you can specify the range.
    When specifying the range, AioSetAiRangeAll will be executed and the CUI menu will be displayed again.

    Depending on the device used, the setting may not be effective unless the input range is changed with the jumper pin on the device.
    

  ・When selecting the command [4 : AioSetAiInputMethod], you can specify the input method.
    When specifying the input method, AioSetAiInputMethod will be executed and the CUI menu will be displayed again.
    

 

4. Sampling Set

  ・When selecting the command [5 : AioSetAiChannels], you can specify the number of channels.
    When specifying the number of channels, AioSetAiChannels will be executed and the CUI menu will be displayed again.

    The starting channel number is fixed at 0ch. For example, if 3 channels are specified, data will be acquired from 0ch to 2ch.
    

  ・When selecting the command [6 : AioSetAiSamplingClock], you can specify the sampling clock period.
    Enter the desired sampling clock period in units of [usec].
    When specifying the sampling clock period, AioSetAiSamplingClock will be executed and the CUI menu will be displayed again.

    The minimum sampling clock period that can be specified depends on the device used.
    You should also consider the number of channels value you specified.

    For details, please refer to the item of [Glossary] sampling clock period error.

    

  ・When selecting the command [7 : AioSetAiScanClock], you can specify the conversion speed.
    Enter the desired conversion speed in units of [usec].
    When specifying the conversion speed, AioSetAiScanClock will be executed and the CUI menu will be displayed again.

    The minimum conversion speed that can be specified depends on the device used.
    

  ・When selecting the command [8 : AioSetAiStopTimes], you can specify the stop times.
    Enter the desired sampling times.
    When specifying the stop times, AioSetAiStopTimes will be executed and the CUI menu will be displayed again.

    If acquisition of multiple channels is specified in the Number of Channels, the number of data specified in the Stop Times is acquired from each channel.
    

  ・When selecting the command [9 : Basic Settings], the conditions in the "Sample specification" table above will be set to the device.
    When the settings for the device are complete, the CUI menu will be displayed again.
    

 

5. Sampling Operation

  ・When selecting the command [10 : Sampling Start], sampling will start.
    When sampling starts, the CUI menu will be displayed again.
    

  ・When selecting the command [11 : AioGetAiSamplingCount], the sampling count will be displayed.
    When the sampling count is displayed, the CUI menu will be displayed again.
    

  ・When selecting the command [12 : AioGetAiStatus], the status will be displayed.
    When the status is displayed, the CUI menu will be displayed again.
    

  ・When selecting the command [13 : Sampling Stop], the data sampling will stop.
    When the data sampling has stopped, the CUI menu will be displayed again.
    

  ・When data acquisition is completed up to the specified Stop Times, or when sampling stops, Event that device operation end occurs.
    In the event processing, all converted data in FIFO are acquired and saved to the text file "SamplingData.csv", and the following message is displayed.
    

 

6. Exit

  ・When selecting the command [14 : 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.