跳转到内容
STAGING SERVER
DEVELOPMENT SERVER

Line Connection#

通过 Line Connection 相机功能,您可以设置或确定当前所选 通用 I/O 线路(GPIO 线路)的连接信号。

连接信号用于控制某些相机功能。例如,“TWI SDA”和“TWI SCL”信号用于 Two-Wire Interface 通信。

该功能的使用#

设置 Line Connection#

设置线路连接:

  1. 设置 LineSelector 将参数设置为所需的 GPIO line.
  2. 设置 BslLineConnection 参数设置为以下值:
    • ConnectionOff:未为当前所选线路设置连接信号。
    • TwiSda:已为当前所选线路设置 TWI SDA 信号。
    • TwiScl:已为当前所选线路设置 TWI SCL 信号。
    • LightControl:已为当前所选线路设置 Light Control 信号。
  3. 请确保 LineMode 参数设置为 InOut。这使您能够将 GPIO 线路用作输入输出线路。如果该参数未自动设置为 InOut,请手动设置。

确定 Line Connection#

确定线路连接:

  1. 设置 LineSelector parameter to the desired I/O line.
  2. 获取 BslLineConnection 参数来确定 I/O 线路当前的线路连接。

示例代码#

// Select Line 2
camera.LineSelector.SetValue(LineSelector_Line2);
// Set the line connection to TWI SDA
camera.BslLineConnection.SetValue(BslLineConnection_TwiSda);
// Get the current line connection
BslLineConnectionEnums e = camera.BslLineConnection.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
// Set the line connection to TWI SDA
CEnumParameter(nodemap, "BslLineConnection").SetValue("TwiSda");
// Get the current line connection
String_t e = CEnumParameter(nodemap, "BslLineConnection").GetValue();
// Select Line 2
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
// Set the line connection to TWI SDA
camera.Parameters[PLCamera.BslLineConnection].SetValue(PLCamera.BslLineConnection.TwiSda);
// Get the current line connection
string e = camera.Parameters[PLCamera.BslLineConnection].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 Line 2 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
/* Set the line connection to TWI SDA */
errRes = PylonDeviceFeatureFromString(hdev, "BslLineConnection", "TwiSda");
CHECK(errRes);
/* Get the current line connection */
len = sizeof(e_str);
errRes = PylonDeviceFeatureToString(hdev, "BslLineConnection", e_str, &len);
CHECK(errRes);
# Select Line 2
camera.LineSelector.Value = "Line2"
# Set the line connection to TWI SDA
camera.BslLineConnection.Value = "TwiSda"
# Get the current line connection
e = camera.BslLineConnection.Value

您也可以使用 pylon Viewer 轻松设置参数。