Line Connection#
连接信号用于控制某些摄像机功能。例如,“TWI SDA”和“TWI SCL”信号用于Two-Wire Interface通信。
该功能的使用#
设置 Line Connection#
设置线路连接:
- 设置
LineSelector将参数设为矩阵中所需的 GPIO 线路. - 设置
BslLineConnection参数设置为以下值:ConnectionOff:当前选定的线路未设置连接信号。TwiSda:为当前选定的线路设置 TWI SDA 信号。TwiScl:为当前选定的线路设置 TWI SCL 信号。LightControl:为当前选定的线路设置光控制信号。
- 确保
LineMode参数设为InOut这样就可以将 GPIO 线用作输入/输出线。如果该参数未自动设置,则表示未启用。InOut手动设置。
确定 Line Connection#
确定线路连接:
- 设置
LineSelector参数设置为所需的 I/O 线。 - 获取
BslLineConnection用于确定 I/O 线当前线路连接的参数。
示例代码#
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);
您也可以使用 pylon Viewer 轻松设置参数。