User Output Value#
This can be useful to control external events or devices, e.g., a light source.
Using the Feature#
Setting the Output Status of an I/O Line#
To set the output status of an I/O line:
- Set the
LineSelector
to the desired output line, e.g.,Line2
. - Set the
LineSource
parameter toUserOutput
. - If multiple User Output line sources are available (e.g., "User Output 1", "User Output 2"), set the
UserOutputSelector
parameter to the corresponding line source.
Example: Assume that you have set the line source of Line 2 toUserOutput1
. To configure the line status of Line 2, set theUserOutputSelector
parameter toUserOutput1
. - If you want to set the line status to high (1), set the
UserOutputValue
parameter totrue
. - If you want to set the line status to low (0), set the
UserOutputValue
parameter tofalse
.
Setting the Output Status of Multiple I/O Lines#
You can configure the status of multiple output lines with the UserOutputValueAll
parameter. The parameter is reported as a 64-bit value.
Certain bits in the value are associated with the output lines. Each bit configures the status of its associated line:
- If a bit is set to 0, the status of the associated line is set to low.
- If a bit is set to 1, the status of the associated line is set to high.
Which bit is associated with which line depends on your camera model.
Sample Code#
// Select Line 2 (output line)
camera.LineSelector.SetValue(LineSelector_Line2);
// Set the source signal to User Output 1
camera.LineSource.SetValue(LineSource_UserOutput1);
// Select the User Output 1 signal
camera.UserOutputSelector.SetValue(UserOutputSelector_UserOutput1);
// Set the User Output Value for the User Output 1 signal to true.
// Because User Output 1 is set as the source signal for Line 2,
// the status of Line 2 is set to high.
camera.UserOutputValue.SetValue(true);
// Set the status of all output values in a single operation
// Assume the camera has two output lines and you want to set both to high
// 0b110 (binary) = 6 (decimal)
camera.UserOutputValueAll.SetValue(6);
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2 (output line)
CEnumerationPtr(nodemap.GetNode("LineSelector"))->FromString("Line2");
// Set the source signal to User Output 1
CEnumerationPtr(nodemap.GetNode("LineSource"))->FromString("UserOutput1");
// Select the User Output 1 signal
CEnumerationPtr(nodemap.GetNode("UserOutputSelector"))->FromString("UserOutput1");
// Set the User Output Value for the User Output 1 signal to true.
// Because User Output 1 is set as the source signal for Line 2,
// the status of Line 2 is set to high.
CBooleanPtr(nodemap.GetNode("UserOutputValue"))->SetValue(true);
// Set the status of all output values in a single operation
// Assume the camera has two output lines and you want to set both to high
// 0b110 (binary) = 6 (decimal)
CIntegerPtr(nodemap.GetNode("UserOutputValueAll"))->SetValue(6);
INodeMap& nodemap = camera.GetNodeMap();
// Select Line 2 (output line)
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
// Set the source signal to User Output 1
CEnumParameter(nodemap, "LineSource").SetValue("UserOutput1");
// Select the User Output 1 signal
CEnumParameter(nodemap, "UserOutputSelector").SetValue("UserOutput1");
// Set the User Output Value for the User Output 1 signal to true.
// Because User Output 1 is set as the source signal for Line 2,
// the status of Line 2 is set to high.
CBooleanParameter(nodemap, "UserOutputValue").SetValue(true);
// Set the status of all output values in a single operation
// Assume the camera has two output lines and you want to set both to high
// 0b110 (binary) = 6 (decimal)
CIntegerParameter(nodemap, "UserOutputValueAll").SetValue(6);
// Select Line 2 (output line)
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
// Set the source signal to User Output 1
camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.UserOutput1);
// Select the User Output 1 signal
camera.Parameters[PLCamera.UserOutputSelector].SetValue(PLCamera.UserOutputSelector.UserOutput1);
// Set the User Output Value for the User Output 1 signal to true.
// Because User Output 1 is set as the source signal for Line 2,
// the status of Line 2 is set to high.
camera.Parameters[PLCamera.UserOutputValue].SetValue(true);
// Set the status of all output values in a single operation
// Assume the camera has two output lines and you want to set both to high
// 0b110 (binary) = 6 (decimal)
camera.Parameters[PLCamera.UserOutputValueAll].SetValue(6);
// Select Line 2 (output line)
Pylon.DeviceFeatureFromString(hdev, "LineSelector", "Line2");
// Set the source signal to User Output 1
Pylon.DeviceFeatureFromString(hdev, "LineSource", "UserOutput1");
// Select the User Output 1 signal
Pylon.DeviceFeatureFromString(hdev, "UserOutputSelector", "UserOutput1");
// Set the User Output Value for the User Output 1 signal to true.
// Because User Output 1 is set as the source signal for Line 2,
// the status of Line 2 is set to high.
Pylon.DeviceSetBooleanFeature(hdev, "UserOutputValue", true);
// Set the status of all output values in a single operation
// Assume the camera has two output lines and you want to set both to high
// 0b110 (binary) = 6 (decimal)
Pylon.DeviceSetIntegerFeature(hdev, "UserOutputValueAll", 6);
/* 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 */
/* Select Line 2 (output line) */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
/* Set the source signal to User Output 1 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSource", "UserOutput1");
CHECK(errRes);
/* Select the User Output 1 signal */
errRes = PylonDeviceFeatureFromString(hdev, "UserOutputSelector", "UserOutput1");
CHECK(errRes);
/* Set the User Output Value for the User Output 1 signal to true. */
/* Because User Output 1 is set as the source signal for Line 2, */
/* the status of Line 2 is set to high. */
errRes = PylonDeviceSetBooleanFeature(hdev, "UserOutputValue", 1);
CHECK(errRes);
/* Set the status of all output values in a single operation */
/* Assume the camera has two output lines and you want to set both to high */
/* 0b110 (binary) = 6 (decimal) */
errRes = PylonDeviceSetIntegerFeature(hdev, "UserOutputValueAll", 6);
CHECK(errRes);
You can also use the pylon Viewer to easily set the parameters.