This is a sample for simple input of single channel and multiple channels.
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_simple |
Range |
0 (±10V) |
Input method |
0 (Single-end input) |
Specified channel: Channel No. |
0 |
Multiple channels: Number of channels |
1 |
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 [2
: 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 [3
: AioSetAiInputMethod], you can specify the input method.
When specifying the input method, AioSetAiInputMethod
will be executed and the CUI menu will be displayed again.
3. Channel simple input processing
- Every time you select the command [4: AioSingleAiEx] or [5: AioMultiAiEx], the input data will be updated.
- When inputting only one specified channel,
When selecting the
command [4 : AioSingleAiEx], you can specify the channel number.
When specifying the channel number, AioSingleAiEx
will be executed and the input value from the device will be displayed.
- When inputting multiple channels,
When selecting the
command [5 : AioMultiAiEx], you can specify the number of channels.
When specifying the number of channels, AioMultiAiEx
will be executed and the input value from the device will be displayed.
The starting channel number is fixed at 0ch. For
example, if 3 channels are specified, data will be acquired from 0ch to
2ch.
- When the input value is displayed, the CUI menu will be displayed again.
4. Exit
- When selecting the command [6
: 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.
5. Processing to terminate the program
- When selecting the command [q : Quit], the program will terminate.