This is a sample that performs generating for the specified number of channels/generating times in user buffer mode.
This sample program requires selection of a device with an analog output function.
Sample specification |
* This is the initial value of the sample program. |
Program name |
./ao_generating_once_user |
Conversion data transfer mode |
1 (User buffer mode) |
Start condition |
0 (Software) |
Clock type |
0 (Internal clock) |
Stop condition |
0 (Stop conversion by the specified times) |
Memory type |
0 (Not repeat output) |
Event |
Event that device operation end, Event that generating clock period error, Event that DA conversion 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. Analog Output Set
- When selecting the command [3
: AioSetAoRangeAll], you can specify the range.
When specifying the range, AioSetAoRangeAll will
be executed and the CUI menu will be displayed again.
Depending on the device
used, the setting may not be effective unless the output range is changed
with the jumper pin on the device.
4. Generating Set
- When selecting the command [4
: AioSetAoChannels], you can specify the number of channels.
When specifying the number of channels, AioSetAoChannels
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 output from 0ch to 2ch.
- When selecting the command [5
: AioSetAoSamplingClock], you can specify the generating clock period.
Enter the desired generating clock period in units
of [usec].
When specifying the generating clock period, AioSetAoSamplingClock
will be executed and the CUI menu will be displayed again.
The minimum generating
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 [6
: 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. Output Data Set
- When selecting the command [7
: User Buffer Settings], you can specify the generating times.
When specifying the generating times to be stored
in the user buffer, the data for generating is generated and notified
to the device driver.
When the output data is notified to the device
driver, the CUI menu will be displayed again.
Generated data: A
sine wave is generated according to the specified range. One
cycle is the specified Generating Times.
For
multiple channels, a sine wave with a phase delay of 1/4 period (90 degrees)
is generated for each channel.
Generated data example:
6. Generating Operation
- When selecting the command [8
: Generating Start], data output from the device will start.
When the device starts outputting data, the CUI
menu will be displayed again.
- When selecting the command [9
: AioGetAoTransferCount], the transfer position will be displayed.
When the transfer position is displayed, the CUI
menu will be displayed again.
- When selecting the command [10
: AioGetAoStatus], the status will be displayed.
When the status is displayed, the CUI menu will
be displayed again.
- When selecting the command [11
: Generating Stop], data output from the device will stop.
When the data output from the device is stopped
and the status is displayed,, the CUI menu will be displayed again.
- When data output is completed up to the specified Generating Times, or when the command [11 : Generating Stop] is selected, the device operation will stop.
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 output from different devices (e.g.
AIO001, etc.) without terminating the program.
When AioExit is executed, the CUI menu will be
displayed again.
- To output data 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.