This is a sample for digital input/output of AIO devices.
This sample program requires selection of a device with digital input/output function.
Sample specification |
* This is the initial value of the sample program. |
Program name |
./digita_io |
I/O direction |
0 (Port0: DI, Port1: DI) |
Port No. |
0 |
Bit No. |
0 |
Input data |
0 |
Output Data |
0 |
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.
- If you are using a device that
allows you to set the input/output direction of general-purpose digital
functions,
you can switch the input/output direction by selecting
the command [3 : AioSetDioDirection].
Please see AioSetDioDirection
function for details.
3. Processing of general-purpose digital input
- For 1 port (8 bits) input,
When selecting the command [4 : AioInputDiByte]
and specifying the desired port number in decimal (Dec), the input data
will be displayed in hexadecimal (Hex).
- For 1 bit input,
When selecting the command [5 : AioInputDiBit]
and specifying the desired bit number in decimal (Dec), the input data
will be displayed.
4. Processing of general-purpose digital output
- For 1 port (8 bits) output,
When selecting the command [6 : AioOutputDoByte],
you can output digitally in 8 bit units.
When specifying the desired port number in decimal
(Dec) and the desired output data in hexadecimal (Hex), the device will
output a digital signal.
- For 1 bit output,
When selecting the command [7 : AioOutputDoBit],
you can output digitally in 1 bit units.
When specifying the desired bit number in decimal
(Dec) and the desired output data, the device will output a digital signal.
5. Exit
- When selecting the command [8
: 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 : AioInit] and specify a new device name to perform device initialization processing
6. Processing to terminate the program
- When selecting the command [q : Quit], the program will terminate.