This is a sample that perform sampling in synchronization with a counter comparison match within a single device.
This sample program requires selection of a device with counter input function and analog input function.
Please refer to Example 3 for Using Event Controller for synchronous operation.
Sample specification |
※This is the initial value of the sample program. |
Program name |
InternalSyncCounterSampling |
Conversion data transfer mode |
0 (Device buffer mode) |
Start condition |
10 (Event controller output) |
Clock type |
0 (Internal clock) |
Stop condition |
0 (Stop conversion by the specified times) |
Memory type |
0 (FIFO) |
Buffer size for saving data |
1MByte |
Event |
Master: Comparison count match event, Counter operation 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. Counter/Analog Input Set
・Specify the desired channel No. in the [ChannelNo:] setting in the Counter(Master).
・Specify the desired comparison count value in the [Comparison Count Value:] setting in the Counter(Master).
・Specify the Analog Input Set [Range:] in the Sampling(slave), and also specify [Input Method:].
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.
・When you press the [Counter/Analog Input Set] button, the above specified contents are notified to the device driver.
4. Sampling Set
・Specify the desired number of channels in the [Number of Channels:] setting in Sampling(Slave).
The starting channel No. is fixed at 0ch. For example, if 3 channels are specified, data will be input from 0ch to 2ch.
・Specify the desired internal clock value in [μsec] in the [Internal Clock Value:] setting within Sampling(Slave).
The minimum internal clock value 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 acquired data in the [Stop Times:] setting in Sampling(Slave).
・When you press the [Sampling Set] button, the above specified contents are notified to the device driver.
5. Synchronous Operation Setting
・When you press the [Sync Process Set] button, the start condition, clock condition, and stop condition are notified to the device driver.
6. Sampling Operation
・When you press the [Sampling Start] button, it will be in the standby state of the start condition [Comparison count match].
No sampling of the analog input takes place immediately.
7. Counter operation
・Press the [Counter Start] button to start the counter operation.
・If you specify [Preset Value:] in the Counter Preset and press the [AioPresetCnt] button, the count value will be preset to the specified preset value.
8. Getting Status
・When you press the [Get Status] button, the displayed values of [Count Value:] and [Sampling Count:] are updated.
・When the count value becomes the same as the [Comparison Count Value:] specified in the Counter(master), the [Comparison count match] state occurs and analog input sampling begins.
・Press the [Sampling Stop] button to stop the sampling of the analog input.
・Press the [Counter Stop] button to stop the counter operation. To start the counter operation again, press the [Counter Start] button.
・An Event that device operation end occurs when analog input is completed up to the specified Stop Times, or analog input sampling stops.
When the event occurs, the sampled data value is displayed in the [Sampling Data:] text box.
9. Saving sampling data
・By pressing the [Output Acquired Data to File...] button, you can save the sampling data displayed in the text box.
Sample file example:
10. 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.
11. Processing to terminate the program
・Press the [Close] button in the window to terminate the program.