◆ StreamingOutputAdd() [4/4]

virtual void StreamingOutputAdd ( RapidCode::IOPoint point,
bool  on,
int32_t  ptPointIndex 
)
pure virtual

Sets the state of the specified IOPoint when the motion reaches the specified streaming point index.

ℹ This function is avaliable in RapidCode and RapidSequencer

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

Description:
Sets the state of the passed IOPoint to high (true) or low (false) once the controller reaches the specified point index.
Parameters
pointThe IOPoint to turn on or off.
onThe value to set the output to. true=>high, false=>low
ptPointIndexThe MotionElementExecutingID at which to set the output. 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.
See also
StreamingOutputsEnableSet, StreamingOutputsClear, StreamingOutputAdd, MotionIdExecutingGet, MotionElementIdExecutingGet, IO, IOPoint