This is a sample that performs sampling with a stop condition other than the Stop conversion by the specified times in device buffer mode.
Sampling data is added to the file that saves the data at Event that the specified number of data are transferred.
In addition to the current sampling count, the total sampling count since the start of sampling is retained/displayed.
This sample program requires selecting a device with an analog input function.
Sample specification |
* This is the initial value of the sample program. |
Program name |
./ai_sampling_infinite_dev |
Conversion data transfer mode |
0 (Device buffer mode) |
Memory type |
0(FIFO) |
Buffer size for saving data |
1MByte |
Event |
Event that AD conversion start, Event that device operation end, Event that the specified number of data are stored, Event that overflow, Event that AD conversion error, Event that sampling clock period error |
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. Parameter 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.
- 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.
4. Sampling condition setting
- When selecting the command [6
: Condition Set], the Condition Set menu will be displayed.
- When selecting [1: Start Condition]
from the Condition Set menu, the Start Condition menu will be displayed.
Select the desired start condition from the Start
Condition menu.
When the desired start condition is specified,
the Condition Set menu will be displayed again.
- When selecting [2 : Sampling
Clock Condition] from the Condition Set menu, the Sampling Clock Type
menu will be displayed.
Select the desired clock type from the Sampling
Clock Type menu.
If the Internal clock
is selected, enter the sampling clock period in units of [usec]. The minimum
sampling clock period that can be specified depends on the device used.
If the External clock is selected, data will be
obtained at the cycle of the external clock connected to the device.
You should also consider the number of channels you specified. For details, please refer to the item of [Glossary] Sampling clock error.
When the desired sampling clock is specified, the Condition Set menu will be displayed again.
- When selecting [3: Conversion
Speed Condition] from the Condition Set menu, you can specify the conversion
speed.
Enter the desired conversion speed in units of
[usec].
When the desired conversion speed is specified,
the Condition Set menu will be displayed again.
The minimum value
that can be specified depends on the device used.
- When selecting [4: Stop Condition]
from the Condition Set menu, you can specify the desired stop condition.
You can select from External trigger rise edge,
External trigger fall edge, Command, Level comparison, and In Range/Out
Range comparison.
When the desired stop condition is selected, the
Condition Set menu will be displayed again.
- When selecting [b: Back] from the Condition Set menu, you will return to the Top menu.
5. Event that the specified number of data are stored Set
- When selecting the command [7
: AioSetAiEventSamplingTimes], you can specify the sampling times.
When entering the desired sampling times, AioSetAiEventSamplingTimes
will be executed and the CUI menu will be displayed again.
6. Sampling Operation
- When selecting the command [8
: Sampling Start], sampling will start.
When sampling starts, the CUI menu will be displayed
again.
An event occurs when
the sampling data for the number of Sampling Times in the "Event
that the specified number of data are stored Set" is stored in the
FIFO memory.
Every time an event occurs, the [Total Sampling
Count], [Sampling Count] and [Status] will be displayed and updated on
the bottom line of the screen.
- When selecting the command [9
: AioGetAiSamplingCount], the sampling count will be displayed.
When the sampling count is displayed, the CUI menu
will be displayed again.
- When selecting the command [10
: AioGetAiStatus], the status will be displayed.
When the status is displayed, the CUI menu will
be displayed again.
- When selecting the command [11
: Sampling Stop], the data sampling will stop.
When the data sampling has stopped, the CUI menu
will be displayed again.
7. Exit
- When selecting the command [12
: 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.
8. Processing to terminate the program
- When selecting the command [q : Quit], the program will terminate.