Line Mode#
您可以配置任何通用 I/O 线路(GPIO 线路)的线路模式。对于光电耦合 I/O 线路,您只能确定当前的线路模式。
该功能的使用#
配置线路模式#
仅应在未使用 I/O 线路时配置线路模式。否则,相机可能会表现出无法预料的行为。
设置 LineSelector
parameter to the desired GPIO line.
设置 LineMode
参数设置为以下值:
Input
: Configures the GPIO line as an input line.Output
: Configures the GPIO line as an output line.InOut
: If available, configures the GPIO line as an input-output line. This is used, e.g., for the 两线接口 和 Light Control features.
确定线路模式#
- 设置
LineSelector
parameter to the desired I/O line. - Get the value of the
LineMode
parameter to determine the current line mode of the I/O line.
示例代码#
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK; /* Return value of pylon methods */
size_t len = 0;
char e_str[64] = {0};
/* Select GPIO line 3 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line3");
CHECK(errRes);
/* Set the line mode to Input */
errRes = PylonDeviceFeatureFromString(hdev, "LineMode", "Input");
CHECK(errRes);
/* Get the current line mode */
len = sizeof(e_str);
errRes = PylonDeviceFeatureToString(hdev, "LineMode", e_str, &len);
CHECK(errRes);
您也可以使用 pylon Viewer 轻松设置参数。