コンテンツにスキップ

Line Mode#

Line Modeカメラ機能を使用すると、I/Oラインを入力ライン、出力ライン、入出力ラインのいずれとして使用するかを決定または設定できます。

任意の汎用I/Oライン(GPIOライン)のラインモードを設定できます。光結合I/Oラインでは、現在のラインモードのみを決定できます。

機能を使用する#

Line Modeの設定#

ラインモードは、I/Oラインが使用されていない場合にのみ設定してください。そうしないと、カメラが予測不能な動作を示す場合があります。

Set the LineSelector parameter to the desired GPIO line.

Set the LineMode parameter to one of the following values:

  • Input: Configures the GPIO line as an input line.
  • Output: Configures the GPIO line as an output line.
  • InOut: If available, configures the GPIO line as an input-output line. This is used, e.g., for the Two-Wire Interface and the Light Control features.

Line Modeの決定#

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

サンプルコード#

// 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);
# Select GPIO line 3
camera.LineSelector.Value = "Line3"
# Set the line mode to Input
camera.LineMode.Value = "Input"
# Get the current line mode
e = camera.LineMode.Value

pylon Viewerを使用して、パラメーターを簡単に設定することもできます。