APIs, concepts, guides, and more

◆ StreamingOutputAdd() [2/4]

void StreamingOutputAdd ( int32_t onMask,
int32_t offMask,
uint64_t address,
int32_t ptPointIndex )
Description:
StreamingOutputAdd will apply the bitmasks "onMask" and "offMask" to the specified address, setting high bits in the on mask to high, and the high bits in the off mask to low. ptPointIndex specified the MotionElementExecutingID at which the masks will be applied.
Parameters
onMaskThe high bits of this bitmask sets the corresponding bits at the address high.
offMaskThe high bits of this bitmask sets the corresponding bits at the address low.
addressThe address at which to toggle bits
ptPointIndexThe MotionElementExecutingID at which to apply the masks. The valid range is from 0 to the last point index of the currently executing streaming move.

Part of the Streaming Motion method group.

Sample Code:
IO: Input & Output
const int TOTAL_POINTS = 4; // total number of points
const int EMPTY_CT = -1; // number of points that remains in buffer before e-stop
const int OUTPUT_INDEX = 0; // digital output index that will be controlled
const int NODE_INDEX = 0; // the EtherCAT Node index
double[] positions = [1.0, 2.0, 3.0, 4.0]; // streaming motion positions
double[] times = [0.5, 0.1, 0.2, 0.4]; // streaming motion times
int outputEnableID = 2; // motion element ID at which to set output HIGH
int outputDisableID = 3; // motion element ID at which to set output LOW
// create IOPoint for digital output
IOPoint output0 = IOPoint.CreateDigitalOutput(controller.NetworkNodeGet(NODE_INDEX), OUTPUT_INDEX);
output0.Set(false); // set output low initially
// enable streaming/sync outputs
// configure sync outputs - turn output HIGH at motion element 2, LOW at motion element 3
axis.StreamingOutputAdd(output0, true, outputEnableID); // turn output HIGH at element ID 2
axis.StreamingOutputAdd(output0, false, outputDisableID); // turn output LOW at element ID 3
Console.WriteLine($"Starting streaming motion with {TOTAL_POINTS} points");
Console.WriteLine($"Output will go HIGH at element ID {outputEnableID}");
Console.WriteLine($"Output will go LOW at element ID {outputDisableID}");
// start streaming motion
axis.MovePT(RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT, false, true);
// monitor motion and output state
while (!axis.MotionDoneGet())
{
int currentElement = axis.MotionIdExecutingGet();
bool outputState = output0.Get();
Console.WriteLine($"Motion Element: {currentElement}, Output State: {outputState}");
Thread.Sleep(50); // small delay to avoid overwhelming console
}
Note
The points need to be added sequentially.
See also
StreamingOutputsEnableSet, StreamingOutputsClear, StreamingOutputAdd, MotionIdExecutingGet, MotionElementIdExecutingGet, IO, IOPoint