This is a sample for generating with the specified number of channels/repeat count in device buffer mode.
Since the memory type specifies RING memory, the set output data can be output repeatedly. The repeat times can be set arbitrarily, and it is also possible to output infinitely.
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 |
AoGeneratingRingMemory |
Conversion data transfer mode |
0 (Device buffer mode) |
Start condition |
0 (Software) |
Clock type |
0 (Internal clock) |
Stop condition |
0 (Stop conversion by the specified times) |
Memory type |
1 (RING) |
Repeat times |
0 (Infinite) |
Event |
Event that device operation end, Event that repeat 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.
・When selecting the command [7
: AioSetAoRepeatTimes], you can specify the repeat times.
When specifying the desired repeat times, the CUI
menu will be displayed again.
5. Output Data Set
・When selecting the command [8
: Generate Output Data], you can specify the generating times.
When specifying the generating times, the data
for generating will be generated and 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:
・After generating the output data,
select the command [9 : AioSetAoSamplingDataEx] to notify the output data
to the device driver.
When the output data is notified to the device
driver, the CUI menu will be displayed again.
6. Generating Operation
・When selecting the command [10
: 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 [11
: AioGetAoSamplingCount], the generating count will be displayed.
When the generating count is displayed, the CUI
menu will be displayed again.
・When selecting the command [12
: AioGetAoRepeatCount], the repeat count will be displayed.
When the repeat count is displayed, the CUI menu
will be displayed again.
・When selecting the command [13
: AioGetAoStatus], the status will be displayed.
When the status is displayed, the CUI menu will
be displayed again.
・When selecting the command [14
: 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 [14 : Generating Stop] is selected, the device operation will stop.
7. Exit
・When selecting the command [15
: 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.