This is a sample that uses a synchronous bus in device buffer mode and performs sampling for the specified number of channels/sampling times.
This sample program uses a synchronous bus, so it is necessary to select a device that has a synchronous connector.
Also, connect the sync connector on the master device and the sync connector on the slave device with a dedicated sync cable in advance.
Please refer to Example 2 for Using Event Controller for synchronous operation.
Sample specification |
* This is the initial value of the sample program. |
Program name |
./ecu_sync_sampling |
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) |
Event |
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 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:
Initialize], you can specify the device name.
Notifies the device driver to start using the specified
device.
The master side and
slave side also need to specify the device name.
When specifying the device name, AioInit will be
executed and the CUI menu will be displayed again.
3. Analog Input Set
- When selecting the command [3
: Analog Input Set], you can specify the range for Sampling(Master).
- When specifying the range for
Sampling(Master), you can specify the input method for Sampling(Master).
- When specifying the input method
for Sampling(Master), you can specify the range for Sampling(Slave).
- When specifying the range for
Sampling(Slave), you can specify the input method for Sampling(Slave).
- When specifying the input method
for Sampling(Slave), all analog input settings will be notified to the
device driver.
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 the analog input settings are complete, the CUI menu will be displayed again.
4. Sampling Set
- When selecting the command [4
: Sampling Set], you can specify the number of channels, the sampling
clock period and the stop times for Sampling(Master).
The starting channel number is fixed at 0ch. For
example, if 3 channels are specified, data will be acquired from 0ch to
2ch.
- The sampling clock period for
Sampling(Master) is specified in units of [usec].
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.
- For the stop times for Sampling(Master), specify the desired number of acquired data.
- When the Sampling(Master) settings
are complete, you can specify the number of channels for Sampling(Slave).
The starting channel number is fixed at 0ch. For
example, if 3 channels are specified, data will be acquired from 0ch to
2ch.
- When specifying the number of channels for Sampling(Slave), all sampling settings will be notified to the device driver.
- When the sampling settings are complete, the CUI menu will be displayed again.
5. Sync Operation Set
- When selecting the command [5
: Sync Operation Set], the start condition, clock type, and stop condition
will be notified to the device driver.
When the synchronous operation settings are complete,
the CUI menu will be displayed again.
6. Sampling Operation
- When selecting the command [6
: Sampling Start], data sampling will start.
Data sampling of the slave side device is also
performed at the same timing as the master side device.
When data sampling has taken place, the CUI menu
will be displayed again.
- When selecting the command [7
: Get Status], the sampling count and status will be displayed.
When the sampling count is displayed, the CUI menu
will be displayed again.
- When selecting the command [8
: Sampling Stop], the data sampling will stop.
When the sampling has stopped, an Event that device
operation end occurs.
When the event occurs, the sampling data on the
master are saved in "sampling_data_master.csv".
Also, the sampling data on the slave are saved
in "sampling_data_slave.csv".
7. Exit
- When selecting the command [9
: 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 : Initialize] 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.