This is a sample that synchronizes generating/sampling inside one device.
Generating is master and sampling is slave.
This sample program requires selection of a device with analog output and analog input functions.
Please refer to Example 1 for Using Event Controller for synchronous operation.
Sample specification |
※This is the initial value of the sample program. |
Program name |
InternalSyncGeneratingSampling |
Conversion data transfer mode |
0 (Device buffer mode) |
Start condition |
Master: 0 (Software) Slave: 10 (Event controller output) |
Clock type |
Master: 0 (Internal clock) Slave: 10 (Event controller output) |
Stop condition |
Master: 0 (Stop conversion by the specified times) Slave: 10 (Event controller output) |
Memory type |
0 (FIFO) |
Buffer size for saving data |
1MByte |
Event |
Master: Event that device operation end, Event that overflow, Event that generating clock period error, Event that DA conversion error Slave: Event that device operation end, Event that overflow, Event that sampling clock period error, Event that AD conversion error |
1. Specify the desired program name, run the program, and a window that looks like the one above will appear.
Appearance may vary depending on software version.
2. Initialize
・Specify the device name set in the device manager as the device name, and click the [AioInit] button.
Notifies the device driver to start using the specified device.
3. Analog input/output setting
・Specify the Analog Output Set [Range:] in Generating(Master).
・Specify the Analog Input Set [Range:] in Sampling(slave), and also specify [Input Method:].
・When you press the [Analog I/O Set] button, the above specified contents are notified to the device driver.
Depending on the device used, the setting may not be effective unless the input/output range is changed with the jumper pin on the device.
4. Generating Set, Sampling Set
・Specify the desired number of channels in the [Number of Channels:] setting in Generating(Master).
The starting channel No. is fixed at 0ch. For example, if 3 channels are specified, data will be output from 0ch to 2ch.
・Specify the desired generating clock period in [μsec] in the [Generating Clock Period:] setting in Generating(Master).
The minimum value of the 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.
・Specify the desired number of generatings in the [Generating Times:] setting in Generating(Master).
・Specify the desired number of channels in the [Number of Channels:] setting in Sampling(Slave).
・When you press the [Generating/Sampling Set] button, the above specified contents are notified to the device driver.
5. Synchronous Operation Setting
・When you press the [Sync Operation Set] button, the start condition, clock condition, and stop condition are notified to the device driver.
6. Setting output data
・When you press the [Output Data Set...] button, a file for generating with the number of points specified in the "Generating Times:" setting will be generated.
After generating the output data, notify the output file to the device driver.
Storage folder for generated files: (current folder) *Same folder as the EXE file
Generated file name: GeneratingData.csv
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 file example:
7. Generating/Sampling Operation
・When you press the [Generating/Sampling Start] button, data output from the device will start.
Data sampling is also performed at the same timing as the generating clock.
・When you press the [Get Status] button, the displayed values of [Generating Count:] and [Sampling Count:] are updated.
・Press the [Generating/Sampling Stop] button to stop data output from the device and data sampling.
・When data output is completed up to the specified Generating Times, or when generation stops, an Event that device operation end occurs.
When the event occurs, the sampled data value are displayed in the [Sampling Data:] text box.
8. Saving sampling data
・By pressing the [Output Acquired Data to File...] button, you can save the sampling data displayed in the text box to a text file.
Sample file example:
9. Exit
・Press the [AioExit] button to 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.
To output data again, specify a new device name and press the [AioInit] button to initialize the device.
10. Processing to terminate the program
・Press the [Close] button in the window to terminate the program.