You can configure the line mode of any general purpose I/O line (GPIO line). For opto-coupled I/O lines, you can only determine the current line mode.
In this topic Hide
Configure the line mode only when the I/O lines are not in use. Otherwise, the camera may show unpredictable behavior.
// 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
CEnumerationPtr(nodemap.GetNode("LineSelector"))->FromString("Line3");
// Set the line mode to Input
CEnumerationPtr(nodemap.GetNode("LineMode"))->FromString("Input");
// Get the current line mode
String_t e = CEnumerationPtr(nodemap.GetNode("LineMode"))->ToString();
// 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();
// Select GPIO line 3
Pylon.DeviceFeatureFromString(hdev, "LineSelector", "Line3");
// Set the line mode to Input
Pylon.DeviceFeatureFromString(hdev, "LineMode", "Input");
// Get the current line mode
string e = Pylon.DeviceFeatureToString(hdev, "LineMode");
/* 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);
You can also use the pylon Viewer to easily set the parameters.