Line Mode#
您可以配置任何通用 I/O 线路(GPIO 线路)的线路模式。对于光电耦合 I/O 线路,您只能确定当前的线路模式。
该功能的使用#
配置线路模式#
仅应在未使用 I/O 线路时配置线路模式。否则,相机可能会表现出无法预料的行为。
将 LineSelector
参数设置为所需的 GPIO 线路。
将 LineMode
参数设置为以下值:
Input
:将 GPIO 线路配置为输入线路。Output
:将 GPIO 线路配置为输出线路。InOut
:将 GPIO 线配置为输入-输出线。
注意:此模式仅在您的相机支持双线接口功能时才可用。
确定线路模式#
- 将
LineSelector
参数设置为所需的 I/O 线路。 - 获取
LineMode
参数的值以确定 I/O 线路的当前线路模式。
示例代码#
// Select GPIO line 3
camera.LineSelector.SetValue(LineSelector_Line3);
// Set the line mode to Input
camera.LineMode.SetValue(LineMode_Input);
// Get the current line mode
LineModeEnums e = camera.LineMode.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Select GPIO line 3
CEnumParameter(nodemap, "LineSelector").SetValue("Line3");
// Set the line mode to Input
CEnumParameter(nodemap, "LineMode").SetValue("Input");
// Get the current line mode
String_t e = CEnumParameter(nodemap, "LineMode").GetValue();
// Select GPIO line 3
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line3);
// Set the line mode to Input
camera.Parameters[PLCamera.LineMode].SetValue(PLCamera.LineMode.Input);
// Get the current line mode
string e = camera.Parameters[PLCamera.LineMode].GetValue();
/* 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 轻松设置参数。