Skip to content

open_io_deviceOpenIoDeviceOpenIoDeviceopen_io_deviceT_open_io_device🔗

説明🔗

open_io_deviceOpenIoDeviceOpenIoDeviceopen_io_deviceT_open_io_device — I/O デバイスを開いて構成する。

書式🔗

open_io_device( string IOInterfaceName, tuple IODeviceName, string GenParamName, string GenParamValue, out io_device IODeviceHandle )void OpenIoDevice( const HTuple& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* IODeviceHandle )static void HOperatorSet.OpenIoDevice( HTuple IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue, out HTuple IODeviceHandle )def open_io_device( iointerface_name: str, iodevice_name: str, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, float, str]] ) -> HHandle

Herror T_open_io_device( const Htuple IOInterfaceName, const Htuple IODeviceName, const Htuple GenParamName, const Htuple GenParamValue, Htuple* IODeviceHandle )

void HIODevice::HIODevice( const HString& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue )

void HIODevice::HIODevice( const char* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue )

void HIODevice::HIODevice( const wchar_t* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue ) (Windows only)

public HIODevice( string IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue )

void HIODevice::OpenIoDevice( const HString& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue )

void HIODevice::OpenIoDevice( const char* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue )

void HIODevice::OpenIoDevice( const wchar_t* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue ) (Windows only)

void HIODevice.OpenIoDevice( string IOInterfaceName, HTuple IODeviceName, HTuple genParamName, HTuple genParamValue )

説明🔗

オペレーター open_io_deviceOpenIoDevice は、指定したデバイスの選択した I /O デバイスインターフェースを開いて構成します。デバイスインターフ ェースは、基底のライブラリの基底名によって指定し、 IOInterfaceNameIOInterfaceNameiointerface_name に渡されます。インターフェースライブラリ は、デバイスインターフェースの最初のデバイスを構成するときに動的に ロードされます。デバイス自体は、IODeviceNameIODeviceNameiodevice_name に渡される名 前によって識別されます。有効な名前は、query_io_interfaceQueryIoInterface によって照会できます。デバイスは、パラメーター GenParamNamegenParamNamegen_param_name とパラメーター GenParamValuegenParamValuegen_param_value によっ て構成できます。デバイスインスタンスへの参照は、 IODeviceHandleIODeviceHandleiodevice_handle に返されます。デバイスのインスタンスが必要 なくなったら、オペレーター close_io_deviceCloseIoDevice を介してそれを 解放して閉じる必要があります。

特定のデバイスを開いたら、open_io_channelOpenIoChannel を呼び出すこと で、送信チャンネルを開くことができます。その後、開いた送信チャンネ ルでオペレーター read_io_channelReadIoChannel とオペレーター write_io_channelWriteIoChannel を使用して、I/O チャンネルの値の読み取り と書き込みを行うことができます。

開いたデバイスインスタンスは、オペレーター set_io_device_paramSetIoDeviceParam とオペレーター get_io_device_paramGetIoDeviceParam を使用して再構成できます。

特定の I/O デバイスインターフェースに関するドキュメントがあるかど うかディレクトリ doc/html/reference/io をチェックしてくだ さい。ここには、サポートされるすべてのデバイス固有パラメーターがリ ストされます。

注意🔗

Windows システムでは、インターフェースの依存モジュール見つからない 場合(対応する SDK がインストールされていなかったなど)、オペレー ティングシステムからエラーダイアログボックスが表示される可能性があ ります。エラーボックスの表示は、Windows のエラーモードを設定するこ とで制御できます。Windows MSDN ドキュメント内の SetErrorMode の説 明を参照してください。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • 並列演算処理には未対応

このオペレータはハンドルを返します。このハンドルタイプのインスタンスの状態は、特定のオペレータにおいては、入力パラメータとして使われている場合であっても変更されることがあります。

パラメーター🔗

IOInterfaceNameIOInterfaceNameiointerface_name (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

HALCON I/O インターフェース名

初期値: [][]
推奨値: 'ADLINK-DAQPilot', 'ADLINK-EOS', 'Advantech', 'Contec', 'Hilscher-cifX', 'Interface', 'Linux-GPIO', 'NIDAQmx', 'OPC_Classic', 'OPC_UA'"ADLINK-DAQPilot", "ADLINK-EOS", "Advantech", "Contec", "Hilscher-cifX", "Interface", "Linux-GPIO", "NIDAQmx", "OPC_Classic", "OPC_UA"

IODeviceNameIODeviceNameiodevice_name (input_control) tuple → (string)HTuple (HString)HTuple (string)strHtuple (char*)

I/O デバイス名

初期値: [][]

GenParamNamegenParamNamegen_param_name (input_control) string-array → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

動的パラメーター名

初期値: [][]

GenParamValuegenParamValuegen_param_value (input_control) string-array → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Sequence[Union[int, float, str]]Htuple (char* / Hlong / double)

動的パラメーター値

初期値: [][]

IODeviceHandleIODeviceHandleiodevice_handle (output_control) io_device → (handle)HTuple (HHandle)HIODevice, HTuple (IntPtr)HHandleHtuple (handle)

開いた I/O デバイスのハンドル

例🔗

(HDevelop)


* Select a suitable i/o device interface of name IOInterfaceName
query_io_interface (IOInterfaceName, 'io_device_names', DeviceNames)
open_io_device (IOInterfaceName, DeviceNames[0], [], [], IODeviceHandle)
query_io_device (IODeviceHandle, [], 'io_channel_names.digital_input', \
                 ChannelInputNames)
open_io_channel (IODeviceHandle, ChannelInputNames[0], [], [], \
                 IOChannelHandle)
read_io_channel (IOChannelHandle, Value, Status)

結果🔗

パラメーターが有効ならば、オペレーター open_io_deviceOpenIoDevice は 値 2 (H_MSG_TRUE) を返します。必要に応じて、例外が発生します。この場合は、拡 張エラー情報が設定され、オペレーター get_extended_error_infoGetExtendedErrorInfo を使用して照会できます。

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

query_io_interfaceQueryIoInterface

後処理の候補

set_io_device_paramSetIoDeviceParam, get_io_device_paramGetIoDeviceParam, open_io_channelOpenIoChannel

モジュール🔗

Foundation