Skip to content

Line Connection#

The Line Connection camera feature allows you to set or determine the line connection of the currently selected general purpose I/O line (GPIO line).

Setting the line connection is required when using the Two-Wire Interface (TWI) camera feature.

Using the Feature#

Setting the Line Connection#

To set the line connection:

  1. Set the LineSelector parameter to the desired GPIO line.
  2. Set the LineMode parameter to InOut. This allows you to use the GPIO line as an input-output line.
  3. Set the BslLineConnection parameter to one of the following values:
    • ConnectionOff: No connection signal is set for the currently selected line.
    • TwiSda: The TWI SDA signal is set for the currently selected line.
    • TwiScl: The TWI SCL signal is set for the currently selected line.

Determining the Line Connection#

To determine the line connection:

  1. Set the LineSelector parameter to the desired I/O line.
  2. Get the value of the BslLineConnection parameter to determine the current line connection of the I/O line.

Sample Code#

// Select Line 2
camera.LineSelector.SetValue(LineSelector_Line2);
// Set the line mode to InOut
camera.LineMode.SetValue(LineMode_InOut);
// 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 1
CEnumParameter(nodemap, "LineSelector").SetValue("Line1");
// Set the line mode to InOut
CEnumParameter(nodemap, "LineMode").SetValue("InOut");
// 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 1
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line1);
// Set the line mode to InOut
camera.Parameters[PLCamera.LineMode].SetValue(PLCamera.LineMode.InOut);
// 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 1 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line1");
CHECK(errRes);
/* Set the line mode to InOut */
errRes = PylonDeviceFeatureFromString(hdev, "LineMode", "InOut");
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);

You can also use the pylon Viewer to easily set the parameters.

Back to top