◆ StreamingOutputAdd() [2/4]

virtual void StreamingOutputAdd ( int32_t  onMask,
int32_t  offMask,
uint64_t  address,
int32_t  ptPointIndex 
)
pure virtual

Applies the on and off bitmasks to the controller's memory address when the motion reaches the specified streaming point index. Used to toggle Digital Outputs and/or memory.

ℹ This function is avaliable in RapidCode and RapidSequencer

Part of the Streaming Motion method group. Part of the Streaming Motion method group.

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.
Sample Code:
SingleAxisSyncOutputs
// Constants
const int TOTAL_POINTS = 4; // total number of points
const int EMPTY_CT = -1; // Number of points that remains in the buffer before an e-stop
const int OUTPUT_INDEX = 0; // This is the index of the digital output that will go active when the user limit triggers.
const int NODE_INDEX = 0; // The EtherCAT Node we will be communicating with
double[] positions = { 1.0, 2.0, 3.0, 4.0 }; // These will be the streaming motion 5 positions.
double[] times = { 0.5, 0.1, 0.2, 0.4 }; // These will be the streaming motion 5 positions' time.
int outputEnableID = 2; // The motion element ID at which to set the output
int outputDisableID = 3; // The motion element ID at which to set the output
// Set up the inputs
//IOPoint output0 = IOPoint.CreateDigitalOutput(axis, RSIMotorGeneralIo.RSIMotorGeneralIo16); // Retrieve DOUT 1, Method 1: requires you know the io adress in memory, slightly faster
IOPoint output0 = IOPoint.CreateDigitalOutput(controller.IOGet(NODE_INDEX), OUTPUT_INDEX); // Retrieve DOUT 1 Method 2: only need to know node index
output0.Set(false); // Set the output low
// Set up Sync Outputs
axis.StreamingOutputsEnableSet(true); // Enable streaming output.
// ENABLE the Sync Output(s)
axis.StreamingOutputAdd(output0, true, outputEnableID); // This will turn DOUT1 High when the streaming motion reaches its 3rd motion point.
axis.StreamingOutputAdd(output0, false, outputDisableID); // This will turn DOUT1 Low when the streaming motion reaches its 4th motion point.
// DISABLE the Sync Output(s)
//axis.StreamingOutputAdd(output0, false, outPutEnableID);
axis.MovePT(RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT, false, true); // Start Streaming Motion
while (!axis.MotionDoneGet())
{
if (axis.MotionIdExecutingGet()>outputEnableID && axis.CommandPositionGet()<outputEnableID)
{
Assert.AreEqual(output0.Get(), true, "The output should be triggered");
}
else
{
Assert.AreEqual(output0.Get(), false, "The output should NOT be triggered");
}
}
axis.StreamingOutputsEnableSet(false); // Disable Sync Outputs.
axis.AmpEnableSet(false); // Disable the motor.
Note
The points need to be added sequentially.
See also
StreamingOutputsEnableSet, StreamingOutputsClear, StreamingOutputAdd, MotionIdExecutingGet, MotionElementIdExecutingGet, IO, IOPoint