MotionWorks IEC Toolboxes Rev 2021
MotionWorks IEC Toolboxes Rev 2021
Toolbox Introduction
Yaskawa has created several IEC-61131 projects for MotionWorks IEC which can be imported for use by another project as a
User Library, or "Toolbox." These toolboxes were designed to save time by providing application code for a wide variety of situ-
ations.
l Cam Toolbox contains functions that increase the power of the PLCopen cam function in the firmware library by provid-
ing extras such as functions for calculating motion profiles, making adjustments based on latch inputs, and EStop
recovery.
l Communications toolbox provides advanced communication protocol function blocks (DNS, SMTP, FTP).
l File Read / Write Toolbox builds upon the basic file manipulation functions available in the ProConOS firmware library to
more quickly read and write application data files.
l Group Toolbox is the successor to Gantry Toolbox and provides enhancements to PLCopen Part 4 for interpolation,
including G Code support. Its GroupCommManager and Pendant_Driver function blocks make it easy to add manual
mode and position teaching support for any group based application.
l Kinematics Toolbox contains forward and inverse kinematics for selected mechanisms.
l Math Toolbox provides compatibility with the built in function that include EN and ENO outputs, and also provides other
tools such as ATAN2, and Floating Point Remainder (REM).
l PackML is both a Template and Toolbox for designing applications to take advantage of the PackML specification. It
emphasizes machine state and transition logic and provides predefined PackML data structures.
l PLCopen Toolbox contains functions that build upon the PLCopen standard functions. It can serve as a starting point
for every project.
l NEW! Winding Toolbox contains functions which perform calculations and other control for various winding applic-
ations.
l Yaskawa Toolbox contains functions that add basic functionality, such as PID Control, or a Moving Average Filter.
A toolbox or user library is just another project. What makes it a user library is the import method. When a project is impor-
ted as a user library, only the functions, function blocks and datatypes are available to the main project. None of the hard-
ware specific information of the user library applies.
Page 1 of 757
Please refer to the document TN.MCD.08.130 on www.yaskawa.com for a comprehensive look at how user libraries can
increase programming efficiency by reducing development time.
See our Youtube channel for video tutorials and examples for MotionWorks IEC and many of our toolboxes.
Page 2 of 757
Common DataTypes
DataType: AXIS_ARRAY
AXIS_ARRAY is a sub structure of the AXES_GROUP_REF structure which identifies the physical motors or virtual axes that par-
ticipate in the group.
Example
Page 3 of 757
PLCopen Help Documentation
Help version created 7/23/2021
AXES_GROUP_REF
An AXES_GROUP_REF identifies a group of axes that work together as a single mechanical unit. AXES_GROUP_REF is used as a
VAR_IN_OUT for PLCopen Part 4 - Interpolation Function Blocks.
Variables of this type are automatically declared in the Global Variables grid when the MotionWorks IEC project is configured
with a Group in the Hardware Configuration. When a group is configured with Mechatrolink axes, the group structure is
mapped to a %M memory area at specific location, and a portion of the contents of the structure is updated by the MPiec firm-
ware at the task interval to which the group I/O is assigned.
Page 4 of 757
* Element Data Type Description Usage
MyAXES_GROUP_REF AXES_GROUP_REF
the Machine
Coordinate Sys-
tem.
C World GROUP_COORD_SYS Structure con- MyAxesGroup.World.CmdPos[1]
taining position,
velocity and accel-
eration data for
the World Coordin-
ate System.
C Part GROUP_COORD_SYS Structure con- MyAxesGroup.Part.CmdPos[1]
taining position,
velocity and accel-
eration data for
the Part Coordin-
ate System.
C Tool GROUP_COORD_SYS Structure con- MyAxesGroup.Tool.CmdPos[1]
taining position,
velocity and accel-
eration data for
the Tool Coordin-
ate System.
C Limits GROUP_LIMITS Position, Velocity, MyAxesGroup.Limits.MachineLimits.MaxVelocity
Acceleration and [1]
Jerk limits for the
Axes, Machine
and Tool Coordin-
ate Systems
C Reserved Reserved Reserved for future ---
expansion.
C Host_ID INT 0 = Group is oper- MyAXES_GROUP_REF.Host_ID
ated locally on the
MPiec via
Mechatrolink. 1 =
group is operated
remotely via
MLX200 gateway.
C Mechanism_ID INT Indicates the type of MyAXES_GROUP_REF.Mechanism_ID
mechanism: 0 =
Gantry, 1 = Scara, 2
= MPP3, custom =
32767
C Interface_ID INT Required when MyAXES_GROUP_REF.Interface_ID
Host_ID = 1. This
identifies on which of
the potentially 8
MLX200 interfaces
in the system the
AxesGroup exists.
C Device_ID INT Robot number MyAXES_GROUP_REF.Device_ID
within the MLX200
Gateway. This value
must be 1.
C MaxLinearVelocity LREAL Maximum linear velo- MyAXES_GROUP_REF.MaxLinearVelocity
city of the TCP
C MaxAngularVelocity LREAL Maximum angular MyAXES_GROUP_REF.MaxAngularVelocity
velocity of the TCP
C MaxLinearAcceleration LREAL Maximum linear MyAXES_GROUP_REF.MaxLinearAcceleration
acceleration of the
TCP
C MaxAngularAcceleration LREAL Maximum angular MyAXES_GROUP_REF.MaxAngularAcceleration
acceleration of the
TCP
C MaxLinearJerk LREAL Maximum linear jerk MyAXES_GROUP_REF.MaxLinearJerk
Page 5 of 757
* Element Data Type Description Usage
MyAXES_GROUP_REF AXES_GROUP_REF
of the TCP
C MaxAngularJerk LREAL Maximum angular MyAXES_GROUP_REF.MaxAngularJerk
jerk of the TCP
C ActiveCoordinateFrame INT ACS, MCS, PCS... MyAXES_GROUP_REF.ActiveCoordinateFrame
C ActiveCoordinateSystem INT Cartesian, Polar, MyAXES_GROUP_REF.ActiveCoordinateSystem
Spherical. (Only
Cartesian is sup-
ported.) Others for
future use.
C ActiveTool INT As entered in the MyAXES_GROUP_REF.ActiveTool
UserApplicationData
structure.
C ActivePartFrame INT As entered in the MyAXES_GROUP_REF.ActivePartFrame
UserApplicationData
structure.
Page 6 of 757
PLCopen Help Documentation
Help version created 7/23/2021
DataType: AXIS_REF
The AXIS_REF data type identifies an axis and thus provides the interface to the hardware or virtual axes. AXIS_REF is ref-
erenced as a VAR_IN_OUT in all function blocks. It is represented as an input and an output connected by a horizontal line in
the graphical representation of a function block.
Example
MyServo.AxisNum:=UINT#3;
Page 7 of 757
PLCopen Help Documentation
Help version created 7/23/2021
AxisParameterStruct
For use with the CamSlave_FeedToLength and CamSlave_WindowCheck function blocks.
Page 8 of 757
PLCopen Help Documentation
Help version created 7/23/2021
DataType: COORD_SYS_LIMITS_6
COORD_SYS_LIMITS_6 is a sub structure of AXES_GROUP_REF.Limits.WorldLimits and PartLimits. This structure is for the
MCS and PCS Coordinate systems.
Page 9 of 757
PLCopen Help Documentation
Help version created 7/23/2021
DataType: GROUP_LIMITS
GROUP_LIMITS is a sub structure of AXES_GROUP_REF and contains the following information.
Page 10 of 757
PLCopen Help Documentation
Help version created 7/23/2021
DataType: GROUP_STATUS
GROUP_STATUS is a sub structure of AXES_GROUP_REF and contains the following information.
Page 11 of 757
PLCopen Help Documentation
Help version created 7/23/2021
DataType: VECTOR
The VECTOR data type specifies a coordinate position for a grouped system. This datatype has other applications also, such as
TransitionParameter.
Example
Consider the following code for a simple XYZ gantry mechanism. MyVector and AnotherVector can be connected directly to the
MC_MoveLinearAbsolute or MC_MoveLinearRelative function blocks "Position" VAR_INPUT.
Page 12 of 757
PLCopen Help Documentation
Help version created 7/23/2021
RTC Struct
This datatype is for use with the Y_SetRTC function block from the Y_Motion firmware library and the RealTimeClock function
block from the Yaskawa Toolbox.
Page 13 of 757
PLCopen Help Documentation
Help version created 7/23/2021
Notes
Prior to firmware 2.5, the TRIGGER_REF.ID element was not used by the MP2000iec controllers and any value would be accep-
ted. In 2.5, the TRIGGER_REF.ID field must be a zero for MP2000iec series controllers. In older help documentation, an
example showed the ID set to 1, and many users set TRIGGER_REF.ID to 1 in their projects, which causes MC_TouchProbe to
output ErrorID 4630 when using firmware 2.5 or higher. The solution is to set MyTriggerRef.ID to zero which will work for all
firmware versions. Only on the MP3000iec controllers can another value be used for the case of multiple latches configured on
the same axis.
The following chart details the correct values for the TRIGGER_REF structure based on the hardware latch to be detected.
Page 14 of 757
Page 15 of 757
PLCopen Help Documentation
Help version created 7/23/2021
Code Example:
Page 16 of 757
PLCopen Help Documentation
Help version created 7/23/2021
1:Y_EngageMethod#Immediate
Y_CamIn does not wait for the master position to reach the
EngagePosition. The EngagePosition and the EngageWindow
inputs are ignored. This mode is intended for use when the mas-
ter is not moving, such as during fault or E-Stop recovery in the
middle of a cam cycle. In this scenario, the slave may be moved
to the equivalent cam position of the master, then the cam can
be re-engaged immediately using MasterRelative:=FALSE to
preserve the original synchronization. If MasterRelative=TRUE,
then CamMasterShift (Parameter 1511) is adjusted so that the
master position at the time YCamIn.Execute changes to TRUE
corresponds to the start of the table domain. This scenario
would change the synchronization between the master and
slave. Immediate Mode is not recommended for application
scenarios where the master is in motion, as a position drift or
phase lag may be introduced.
2:Y_EngageMethod#Linked
The new cam profile will be switched on the fly at the end of the
current cam table. This mode is intended for use when cams
with different Machine Cycles are to be run without stopping.
Use the Linked mode or applications where the product size
must be changed on the fly. Do not use linked mode if Y_
CamShift is used for the same slave axis.
Page 17 of 757
U MasterRelative BOOL Only MasterRelative:=FALSE is supported. MyYEngageData.MasterRelative
U SlaveAbsolute BOOL When SlaveAbsolute:=FALSE, the initial position of the slave will MyYEngageData.SlaveAbsolute
be used as the base offset for the camming operation. For
example, if the cam slave table data goes from 0 to 20, back to
0, but the slave's commanded position when the engage event
occurs is 4.5, the slave will travel from 4.5 to 24.5, and back to
4.5. If SlaveAbsolute:=TRUE for the same scenario, the slave
will jump from 4.5 to 0 when the engage event occurs. (This is
not desirable behavior.) If SlaveAbsolute mode is used, the
application program must ensure that the slave axis is posi-
tioned at the proper position for camming to operate correctly.
RampIn INT Reserved for future use ---
RampInData1 LREAL Reserved for future use ---
RampInData2 LREAL Reserved for future use ---
RampInData3 LREAL Reserved for future use ---
RampInData4 LREAL Reserved for future use ---
Code Example:
MyEngageData.StartMode:=Y_EngageMethod#AtAbsolutePosition;
Page 18 of 757
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to zero, the second to 1, etc. The format for enumerated types is as follows: ENUM:(0, 1, 2...) as displayed in the
example below (MC_BufferMode#Aborting).
The following is an alphabetical listing of the Enumerated Types defined in the MotionBlockTypes file:
MC_Detection_
Pattern 0 Rising_Edge
1 Falling_Edge
MC_Direction
0 Positive_Direction In a rotary application, forces the axis to move in a positive direction.
1 Shortest_Way For use in applications where the Load Type is configured as a rotary or modularized
axis.
2 Negative_Direction In a rotary application, forces the axis to move in a negative direction.
3 Current_Direction For use in applications where the Load Type is configured as a rotary or modularized
axis.
Only applies if an existing move is in progress and another function block such as
MC_MoveAbsolute or MC_MoveRelative is executed. Once the axis is at StandStill,
using MC_Direction_CurrentDirection will default to the positive direction
MC_Exe-
cutionMode 0 Immediately Functionality is immediately valid. May influence ongoing motion, but not the state.
1 Delayed Functionality is valid when the ongoing motion command set Done, Aborted, or
Error outputs.
2 Queued Functionality is valid when ALL previous motion commands set Done, Aborted, or
Error outputs.
Page 19 of 757
Enumerated #INT Enum Value Description
Type Value
MC_PathChoice
0 ClockWise
1 CounterClockWise
MC_SwitchMode
0 On Unsupported
1 Off Unsupported
2 EdgeOn
3 EdgeOff Unsupported
4 EdgeSwitchPositive Unsupported
5 EdgeSwitchNegative Unsupported
MC_Trans-
itionMode 0 TMNone No transition curve inserted. Motion blocks are not modified. The only Trans-
itionMode usable with the "Buffered" BufferMode.
1 TMStartVelocity Transition with given start velocity. Adds a segment to the motion queue unless
motion is tangent.
2 TMConstantVelocity Transition with given constant velocity. Adds a segment to the motion queue unless
motion is tangent.
3 TMCornerDistance Transition with given corner distance. Adds a segment to the motion queue unless
motion is tangent.
4 TMMaxCornerDeviation Geometry limited parabolic transition with the path defined by the programmed tar-
get point to the apex of the parabola. The system will enforce this exact path, but will
adjust the curve if the input segments are too short. Note that the FMK imple-
mentation is logically “ExactCornerDeviation” even though the PLCOpen spec calls
for “MaxCornerDeviation”
10 TMMLXBlend This mode is only user with MotomanSync remote hosted robots controlled by the
YRC1000 series and related controllers. The transition parameter values are 0~8
with 0 defining a motion that stops at the segment end point and 1~8 apply blend
distances defined in the robot controller.
11 TMMaxCornerDeviation Geometry limited parabolic transition with the path defined by specified corner dis-
tance from the start point of the curve to the programmed target point. The blend
will begin no sooner than this distance to the programmed target point and can be
started at any point closer without generating an error. The system is free to pick
any paths that obey this constraint. This will limit the path to a maximum distance
which is useful if there are obstacles in the way. It is also useful for applications that
can tolerate a variable blend radius depending on the speed, motion sequence, or
timing.
Y_AdjustMode
0 MasterDistance The cam adjustment starts immediately, and completes when the master has trav-
elled the specified distance. If MasterDistance is 0.0, then the cam adjustment fin-
ishes in the same scan it starts.
1 ElapsedTime The cam adjustment starts immediately, and completes within the specified time. If
Time=0.0, then the adjustment completes in the same scan it starts.
2 WithinRange The cam adjustment starts when the master is crosses the StartPosition, and com-
pletes when the master reaches the EndPosition. If the master position is already
between StartPosition and EndPosition, then the adjustment starts immediately,
but still completes at the EndPosition, which means that the correction speeds may
be higher.
Page 20 of 757
Enumerated #INT Enum Value Description
Type Value
Y_ControlMode This enumerated type is for use with Y_DirectControl
0 NoControlMode This is not a valid value.
1 PositionMode The ServoPack will be controlled in position mode. A new command target must be
calculated in the controller at a frequency suitable for the application. No accel-
eration or speed profiling is added by the system, except for the command filtering
provided by pn 811/812, or pn 216/217 if using the MP2600iec.
2 VelocityTLMode The ServoPack will be operated in velocity mode. The Torque input of the Y_Dir-
ectControl function block will serve as the torque Limit in this mode.
3 TorqueVLMode The ServoPack will be operated in torque mode. The Velocity input of the Y_Dir-
ectControl function block will serve as the velocity limit in this mode. If the velocity
limit is reached, the servo will apply increased torque if necessary to keep the velo-
city within the limits.
4 PositionTrqFFMode The ServoPack will be operated in position mode. The Torque input of the Y_Dir-
ectControl function block will serve as the torque feed forward value in this mode.
5 VelocityTrqFFMode The ServoPack will be operated in velocity mode. The Torque input of the Y_Dir-
ectControl function block will serve as the torque feed forward value in this mode.
Y_TableType
0 Undefined
1 MasterSlaveArray This is the only TableType supported.
Page 21 of 757
Cam Toolbox
The Cam Toolbox contains function blocks that combine PLCopen blocks like Y_CamIn, Y_CamShift, Y_SlaveOffset, Y_
CamSlave, Y_ReleaseCamTable etc. These toolbox function blocks provide enhanced application level functionality that can be
used for cam applications like random rotary knife, linear flying shear, labeler, bottle filler etc.
Firmware libraries:
User libraries:
The following User Libraries must be listed above the Cam Toolbox and in the following order:
See Yaskawa's Youtube video - Camming Demonstration with Yaskawa MP2300Siec for more info.
Page 22 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Current Version:
2021-07-07 v372 released
2) CamShiftControl FB - Was not reporting all possible internal error conditions. DCR 4992.
3) SetCamMasterCycle FB - If an internal function wasn't allowed to finish (CommandAborted go low), then it would cause
errors with other camming functions. DCR 3371.
Previous Versions:
2020-02-06 v370 released (There were no changes when the December 2020 Toolbox installer was released,
therefore there is no 371 release.)
1) CamGenerator - If an all cubic cam was generated more than once, spline coefficients were incorrect in the subsequent cal-
culations because of improper initialization. DCR 3782.
1) CamGenerator.TableSize code change in v350 was wrong, caused false Error 10041. DCR 2057.
2) CamGenerator FB - Cubic spline calculations limited by the segment CamSegmentStruct index number. Cubic Splines no
longer limited by their placement within the overall CamSegmentStruct. DCR 1740.
1) CAM_Analyzer FB - Did not ouptut correct values for MaximumAcceleration and MaximumJerk. DCR 1266.
2) CamTableManager FB - Fixed bug introduced in last version when making the number of tables configurable. DCR 1629.
3) CamGenerator - Deprecated the use of the TableSize VAR_INPUT, it is no longer referenced in code in favor of using the
UPPER_BOUND function to determine the size of the CamSegment structure. Also removed other hard coded size checks used
for the Spline formula Type. DCR 1969.
1) CamTableManager - Added VAR_INPUT to specify the number of cam tables to keep in memory before removing. DCR 1104 .
Page 23 of 757
2016-09-18 v302 released
1) CamControl FB - Changed CamControl to set ControlData.Shifting based on CamShift.Done instead of Busy. DCR 780.
2) Added EngageWindow to CamSynchStruct. This will help to map user values into Y_CamIn for features like the new
"Labeler" Function Block. DCR 782.
1) CamGenerator - DCR 766, fixed Tangent Blending to blend with non-zero slave starting position. Change also added for Cam
Editor in MotionWorks IEC v3.1
2015-01-31 v300 released. Identical to v206, but recompiled specifically for MotionWorks IEC v3.x.
2) SlaveOffset_Control - Changed equation for first correction. Added manual offset input for adjusting while in motion.
3) CamGenerator - ParabolicVelocityBlend formula - Code added for blending improvement (Lines (132- 138)
4) CamTableUpdate - Changes made to prevent outputs from flickering (Refer to DCR 467)
5) CamControl - Changes made to iActive code to prevent flickering outputs in case of an Error and also
lockup of function if data in CamControl structure changes after function block goes dormant.
6) SlaveRegistrationCheck - Added (DefaultSize * LREAL 1.1) to NextCheckPoint calculation on rising edge of Enable (line 27)
7) SetCamMasterCycle - Improvement by adding Y_CamShift with zero phaseshift to keep prm 1502 updating after this block
executes.
1) CamBlend - Changed EngageData.SlaveAbsolute to FALSE. This is to support changing master cycles without changing the
position scale in the Hardware Configuration.
2) CamBlend - Removed NC CamOutBusy from rung 11. This bit could cause the RampOut bit to fire twice.
3) CamBlend - Changes made to improve RampIn to RampOut transition without entering Running mode. Added NC
RampOutBusy on rung 4. Added ActiveTable_RampIn in rung 11. Added ActiveTable_RampOut on Rung 4 to allow RampOut to
RampIn transition in consecutive cycles. Added NC RampOutBusy and NC RampInBusy on rung 19 to prevent iActive from turn-
ing off prematurely.
4) CamBlend - Removed CamOut FB from CamBlend. Non periodic RampOut is sufficient. This eliminates false error outputs.
5) CamShift_Control - Added new datatype 'SynchPosition'. This is the position in the cam table where the master and slave
become synchronized.
6) CamShift_Control - Simplified the equation for correction for initial shift for modes 1 and 2.
7) SlaveOffset_Control - New FB, similar to CamShift_Control. Buffered offsets on a slave axis can be accomplished by buf-
fering registration marks. New datatype SlaveOffsetStruct accompanies SlaveOffset_Control FB.
8) SetCamMasterCycle - New FB in this version. Sets the cam master cycle the first time to change it from default of 1.0 to the
Master cycle of the cam table to be used. Only necessary for applications that use Y_CamShift before engaging the cam.
Page 24 of 757
9) CamGenerator - CalcSpline formula completely re written with new algorithm.
10) CamGenerator - New Bezier curve added. Bezier segment requires straight segments before and after the Bezier curve.
This is a modified bezier which will never cause reverse motion.
11) CamSlaveFeedToLength - Further improvement based on customer feedback for the change made in v204. TestTrack DCR
7. SlaveRegistrationCheck is completely shut down if no cam is active, this prevents MissedLatchError from occuring.
12) CamControl, CamShift_Control - Added support for Multi Use Latches, which is a new feature of the PLCopen Toolbox v206
ProductBuffer function block.
Starting in Cam Toolbox v204 – All firmware library DataType definitions were moved to a new toolbox called the DataTypes
Toolbox. Formerly, the PLCopen Toolbox contained the MotionInfoTypes and the PLCTaskInfoTypes datatype files. These were
removed and are now included in the DataTypes Toolbox. If upgrading from an older version of Cam Toolbox, you must do the
following:
1) Include the DataTypes Toolbox in the main project.
2) Remove any other Yaskawa supplied datatype files with firmware library definitions such as:
a. ControllInfoTypes
b. YDeviceCommTypes
Note: Compiler issues yielding the message "Error during generating native code" will be experienced under the following com-
bined conditions: 1) Using Cam Toolbox v204 or higher AND using an MP3000iec series controller AND using MotionWorks IEC
v2.x. The remedy is to downgrade to Cam Toolbox v203 or use MotionWorks IEC v3.x.
3) CamGenerator - Corrected mistake with Tangent Match & Tangent Blend formulas introduced in v202 when CamGenerator
was improved to allow blending segments.
4) CamBlend - Added check: If BlendData.Window = 0, then the code defaults the value to 1% of the CamMasterCycle.
5) CamGenerator - Added curve type 32 for Arc profile. Also added radius and direction to CamSegmentStruct
6) Removed references to Math Toolbox functions where possible. Now only the CamShiftControl function block requires the
Math Toolbox.
7) Because of the reintroduction of functions with EN/ENO, the MP2600 requires firmware 2.1.
8) SlaveRegistrationCheck - Added ErrorID 10086 to report if the MaxPosCorrection or MaxNegCorrection are not set correctly.
9) CamSlaveFeedToLength - Added RecordedPosition as output. Also included interlock to prevent adjustments from occur-
ring if the slave is not engaged.
10) CamGenerator - Added Parabolic with blended velocity as formula code 33. (for multi segment)
11) CamShift_Control - Consolidated Rotary Knife and Linear Flying shear math.
2) CamGenerator - Added TableShift support into the CamSegmentStruct. Initial shifts can be applied to the cam data without
using the Y_CamShift function block.
Page 25 of 757
2012-11-19 v203 created using 2.3.0 firmware
1) CamGenerator - Improved support for wrap around cubic spline segments at the beginning and the end of the cam.
2) CamGenerator - Added TableShift support into the CamSegmentStruct for CamGenerator. Initial shifts can be applied to the
data
2) CamGenerator - Improved for blending of Cubic Spline segments to other segment types.
3) SlaveRegistrationCheck - Changed 'Missed Latch Error' to occur when the missed latch counter is >= the MissedLatchLimit.
Previously it was not causing error until the MissedLatchLimit was exceeded.
4) CamBlend - Added DisengageData to CamBlend's Y_CamOut for compatibility on MP2600iec and MP3200iec
2) Added input 'ExecuteStandstill' to CamBlend. This input causes the running cam to engage immediately, which enhances
the E-Stop recovery capability of CamBlend.
when done is high. (Also to comply with firmware change made for 1.2.3.)
Page 26 of 757
2) Reworked PathGenerator to support any variety of arcs beyond just simple 0,90,180,270 quadrants.
3) Removed spaces from project file name for improved usage with MotionWorks IEC 2.0.
5) Included YMotion firmware library in ZWT, required for CamSlaveFeedToLength2 function block.
NOTE: This toolbox will work with 1.2.3 firmware unless CamSlaveFeedToLength2 is used, which requires firmware 1.2.4.
Step 5 had 1520, it is changed to 1512. Also streamlined the code to only include one check for Halfway instead of two.
2) Added CamSlaveFeedToLength2, which incorporates Y_ProbeContinuous from the Y_Motion firmware library and
requires firmware 1.2.4 or higher. NOTE: After the 2.0 product release, Y_ProbeContinuous will be available in
1) Increased flexibility of CamSlave_FeedToLength / SlaveRegistrationCheck by making Max Positive and Negative Correction
2) Added CamShift_Control FB for 'Rotary' and 'Out and Back' cam motions.
4) Added Cam_Control FB which works with the Product Buffer for slaves that must stop when no product is coming.
1) Merged code changes with Doug Meyer, for CamSlavePullToLength and CamSlaveFeedToLength for MaxCorrection
and Time based correction. NOTE: Function block interface changed for these functions.
3) Moved window logic into the main Enable section of SlaveRegistrationCheck to allow on the fly updates.
Page 27 of 757
2010-03-15 v003beta created
1) Fixed mistake in case statement to allow Simple Harmonic as one of the Valid Curve Types. Was 4, should be 3.
3) Changed CamSlave_FeedToLength to use Stair Step method of latch lookup in cam table. Original method used an
5) Changed the second and third Y_CamIn functions inside CamBlend to use StartMode = Absolute to eliminate drifting
6) Added NOT(Error) contact to prevent the CamSlave_FeedToLength function from running if there was an error.
7) Added PathGenerator and MovePath for creating XY paths with straight line and circular interpolation.
2) Initial version would ignore resolution and just use beginning and end points for straight line.
3) Improved CamGenerator. It was recalculating the entire profile over and over each scan while execute was held high.
Changed to F_TRIG to let initialize section run on the first scan, and the cam calcs on the second.
4) Improved CamBlend Output behavior. (Some bits remained on when both execute inputs were off.
1) CamBlend
2) CamMaster_Lookup
3) CamSlave_FeedToLength
4) CamSlave_WindowCheck
5) CamGenerator
6) CamTableUpdate
7) SlaveRegistrationCheck
8) SlaveIndex_Lookup
Page 28 of 757
Cam DataTypes
Page 29 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 30 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Supporting structure for CamSegmentStruct. For use with the CamGenerator func-
tion block.
Page 31 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Supporting structure for CamSegmentStruct. For use with the CamGenerator function block.
Notes:
This is an internal sub structure for CamSegmentStruct and is not intended to be referenced directly by the user.
Page 32 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 33 of 757
Data Type Declaration
Page 34 of 757
* Element Data Type Description Usage
MyCamSegmentStruct CamSegmentStruct
Page 35 of 757
* Element Data Type Description Usage
U CamParameters CamSegmentArray
Page 36 of 757
* Element Data Type Description Usage
U MasterEnd LREAL Location of the mas- MyCamSegmentStruct.CamParameters
ter at the end of the [x].MasterEnd
current segment
U SlaveEnd LREAL Location of the slave MyCamSegmentStruct.CamParameters
at the end of the cur- [x].SlaveEnd
rent segment
U CurveType INT Formula code to MyCamSegmentStruct.CamParameters
indicate the motion [x].CurveType
profile for this seg-
ment
U Resolution REAL Determines how MyCamSegmentStruct.CamParameters
many data points [x].Resolution
are calculated along
this segment
U ArcRadius LREAL If CurveType = Arc, MyCamSegmentStruct.ArcRadius
this element
describes the
radius. Not used for
any other
CurveTypes.
U ArcDirection INT If CurveType = Arc, MyCamSegmentStruct.ArcDirection
(1=ccw, -1=cw).
Not used for any
other CurveTypes.
U SplineStartSlope LREAL If the first Segment MyCamSegmentStruct.SplineStartSlope
is CurveType =
CubicSpline, this
value is the pos-
itional slope of the
profile as the cam
begins. Typically
this value is zero
unless the cam is
blended with other
cams, and the slope
cannot be auto-
matically determ-
ined by the
CamGenerator.
U SplineEndSlope LREAL If the last Segment MyCamSegmentStruct.SplineEndSlope
is CurveType =
CubicSpline, this
value is the pos-
itional slope of the
profile as the cam
completes. Typically
this is zero unless
the cam is blended
with other cams,
and the slope can-
not be automatically
determined by the
CamGenerator.
U TableShift LREAL If non zero, this MyCamSegmentStruct.TableShift
value represents
the amount of initial
shift in the master
slave values that is
applied to the table
data.
U LastSegment INT Informs the MyCamSegmentStruct.LastSegment
CamGenerator
which element of
the CamSeg-
mentStruct con-
Page 37 of 757
* Element Data Type Description Usage
tains the last seg-
ment of cam data to
be applied.
C OutAndBackCam BOOL Flag which indicates MyCamSegmentStruct.OutAndBackCam
if the first and last
slave position are
the same (out and
back.) If they are dif-
ferent, the cam is
reciprocating, and
the slave will move
away from the initial
start position with
each passing cycle.
U UseSplineSlope BOOL Flag to indicate to MyCamSegmentStruct.UseSplineSlope
use the SplineSlope
parameters in this
structure.
Example
RampInCam.LastSegment:=INT#2;
RampInCam.CamParameters[1].CurveType:=TB_CurveType#TangentBlending;
RampInCam.CamParameters[1].MasterEnd:=LREAL#0.9;
RampInCam.CamParameters[1].Resolution:=REAL#0.01;
RampInCam.CamParameters[2].CurveType:=TB_CurveType#StraightLine;
RampInCam.CamParameters[2].MasterEnd:=LREAL#1.0;
RampInCam.CamParameters[2].SlaveEnd:=LREAL#1.0;
RampInCam.CamParameters[2].Resolution:=REAL#0.01;
Page 38 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 39 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 40 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 41 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 42 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 43 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Page 44 of 757
Toolbox Help Documentation
Help version created 7/23/2021
This data type is for use with the Y_CamStructSelect, Y_ReadCamTable, and Y_WriteCamTable function blocks. Y_MS_CAM_
STRUCT consists of the sub-structures found below. Refer to the Internally Created Cam Data diagram in the Cam Data Man-
agement section.
Notes
MS_Data[x].Master and MS_Data[x].Slave can be set be either the user or a function block depending on whether this data-
type is used with Y_ReadCamTable or Y_WriteCamTable in the PLCopen Plus firmware library.
Code Example
Page 45 of 757
Toolbox Help Documentation
Help version created 7/23/2021
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant)
representing a value which will configure the operation of the function block. Enu-
merated types are equivalent to a zero-based integer (INT) list.
Page 46 of 757
Enumerated
#INT Value Enum Value Description
Type
Indicates the Cam formula to be applied between to positions.
0 n/a Not a valid CurveType
1 StraightLine
2 Parabolic
3 SimpleHarmonic
4 Cycloidal
5 ModifiedTrapezoid
6 ModifiedSine
7 ModifiedConstVelocity
8 AsymmetricalCycloidal
9 AsymmetricalModifiedTrapezoid
10 Trapecloid
11 OneDwellCycloidal_1
12 OneDwellCycloidal_2_3
13 OneDwellTrapezoid_1
14 OneDwellTrapezoid
15 OneDwellTrapezoid_2_3
16 OneDwellModifiedSine
17 OneDwellTrapecloid
TB_CurveType
18 NoDwellSimpleHarmonic
19 NoDwellModifiedTrapezoid
20 NoDwellModifiedConstVelocity
21 NC2Curve
22 TangentMatching
23 ReverseTrapecloid
24 DoubleHarmonic
25 ReverseDoubleHarmonic
26 TangentBlending
27 Unsupported27 Unsupported
28 Unsupported28 Unsupported
29 UserModifiedConstVelocity User specifies the accel / decel distances
5th order polynomial with C3 = 10, C4 = -15,
30 Polynomial345
C5 = 6
31 CubicSpline Cubic spline interpolation
32 Arc
33 ParabolicVelocityBlend Parabolic curve with velocity blending
Non reversing profile between two straight
34 Bezier
lines.
Page 47 of 757
Cam FBs
Cam_Analyzer
The Cam_Analyzer function block provides the slaves maximum velocity, acceleration, deceleration and jerk values for a spe-
cific cam profile based on a maximum expected master velocity.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B CamTable Y_MS_ This structure contains the resulting master/slave information for each data point
CAM_ and can be downloaded to the motion engine using Y_CamStructSelect.
STRUCT
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the value
and re-trigger the execute input.
V MasterVelocity LREAL Master axis maximum velocity (in master LREAL#0.0
user units/sec.)
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another
block takes control before the action is completed, the Done output will not be set.
Page 48 of 757
This output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable
input, a Busy output indicates the function is operating, but not ready to provide
Valid information. (No Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
V MaximumVelocity LREAL Peak slave velocity for the given cam profile at the maximum master velocity.
V MaximumAcceleration LREAL Peak slave acceleration for the given cam profile at the maximum master velocity.
V MaximumJerk LREAL Peak slave jerk for the given cam profile at the maximum master velocity.
Error Description
See the Function Block ErrorID list.
Example
Consider a linear flying shear application. The maximum slave velocity of the profile is in the speed matching region. The mas-
ter maximum velocity was given as 24 units/sec and the maximum velocity output of the CamAnalyzer is 24.
Page 49 of 757
Page 50 of 757
Page 51 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamBlend
This function block was designed for applications that require a one way cam profile, and the slave must be able to engage or
disengage smoothly from a moving master. It requires three separate cam tables with a portion of equivalent slave data, so an
on-the-fly changeover from one table to the next can occur. This function block uses three Y_CamIn functions blocks and one
Y_CamOut function block.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Master AXIS_REF A logical reference to the master axis.
B Slave AXIS_REF A logical reference to the slave axis.
V BlendData BlendStruct Structure containing the information required for engaging, disengaging, ramping
in, and ramping out.
VAR_INPUT Default
V ExecuteRampIn BOOL Upon the rising edge, this function block will pre- FALSE
pare to engage the RampIn cam profile at the
master position specified in the BlendData struc-
ture.
V ExecuteRampOut BOOL Upon the rising edge, this function block will pre- FALSE
pare to switch to the RampOut cam profile at the
Page 52 of 757
SwitchOver position specified in the BlendData
structure.
V ExecuteStandStill BOOL Upon the rising edge, this function block will pre- FALSE
pare to engage the slave to the Running cam pro-
file at the StandstillEngage position (calculated
after an E-Stop recovery routine) in the
BlendData structure
VAR_OUTPUT
E InSync BOOL Set high when the axis or group is synchronized with the axis or group it is com-
manded to follow. Synchronized means that the two are position locked, any trans-
itional period required to achieve synchronization has been completed.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input,
a Busy output indicates the function is operating, but not ready to provide Valid
information. (No Error)
B Active BOOL For buffered modes, this output is set high at the moment the block takes control
of the axis. For non buffered modes, the outputs Busy and Active have the same
value.
B CommandAborted BOOL Set high if motion is aborted by another motion command or MC_Stop. This output
is cleared with the same behavior as the Done output.
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
V BlendStatus UINT Outputs a value of 1 to indicate the RampIn Cam is Active, 2 indicates the Running
cam is Active, and 3 indicates the RampOut cam is Active. Refer to the slaves
CamState parameter [1540] to determine the state the active cam.
E EndOfProfile BOOL Pulsed output signaling the cyclic end of a CAM Profile
Notes
l Typically the RampInSwitchOverPos and the RampOutSwitchOverPos will be fixed at some predetermined position suit-
able for the application. Typically the RampInSwitchOverPos will occur very late in the cycle, and the
RampOutSwitchOverPos will occur very early in the cycle. This will provide for the optimum performance by allowing
the maximum possible time for the slave to accelerate up to the master's velocity and decelerate back to zero.
l If using the ExecuteStandStill mode, use the CamMaster_Lookup and CamSlave_Recover function blocks to determine
the master position that corresponds to the current slave position, and set BlendData.StandStillEngagePos accordingly
to preserve synchronization. The ExecuteStandStill mode was added to provide the capability of re-synchronizing after
an E-Stop.
Error Description
See the Function Block ErrorID list.
Page 53 of 757
Example 1
Timing Diagram
Page 54 of 757
Application Example
Timing Diagram
The speed matching, or normal running cam is designated as Profile #2. Profile #1 and Profile #3 will only run once, but Pro-
file #2 will run indefinitely. A simple straight line profile for Profile #2 is not required, and reasonable motion can be used if
the application requires it, keeping in mind that CamBlend was designed for one way slave motion that never stops while in nor-
mal operation, thus making it difficult to synchronize with the master smoothly without blending from one profile to another.
Page 55 of 757
Page 56 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamControl
The CamControl function makes decisions regarding Engage and Disengage logic for applications where products are buffered
and processed at random intervals. This function block requires the ProductBuffer function block from the PLCopen Toolbox
and the CamShift_Control block from the Cam Toolbox. The main inputs that feed the CamControl block are RegistrationData
and ControlData. This function block was designed for applications such as a Linear Flying Shear, Random Rotary Placer, Knife,
Drill, etc.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in
the Hardware Configuration (logical axis number).
V RegistrationData ProductBufferStruct Structure containing all information for the circular buffer to operate.
V ControlData CamSyncStruct Structure containing all information to allow both the CamControl and
CamShiftControl to make decisions to run the cam function effectively.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable FALSE
is held high and there are no errors.
V Action INT Designates this instance of this function block as one of the INT#0
several activities to occur based on the registration sensor.
For applications that have only one action, such as a cut or a
stamp, this input can be left unconnected. This input is
required for applications that have more than one action asso-
ciated with a sensor input, such as pick and place.
Page 57 of 757
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the func-
tion are valid.
V Engage BOOL Set high when the externally located Y_Cam_In function block(s) must be
executed.
V Disengage BOOL Set high when the externally located Y_Cam_Out function block(s) must be
executed.
B Error BOOL Set high if an error has occurred during the execution of the function block.
This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
Notes
• The Engage output is to be used with a Y_CamIn function block placed external to this function block. This design allows for
one or more cam slaves to be operated via the logic provided.
• The Disengage output is to be used with a Y_CamOut function block placed external to this function block. This design
allows for one or more cam slaves to be operated via the logic provided.
• This function block is designed to work with the CamShift_Control function block. It waits for an initial Camshift will occur
before the first Engage event should take place. If the application requires the slave to become synchronized with the master
without a Camshift, simply use an R_TRIG of the CamControl.Valid to cause the CamData.Shifting bit to go high and low.
Error Description
See the Function Block ErrorID list.
Example
The operation of CamControl in deciding when to engage and disengage a cam is shown in the logic analyzer illustration below.
The rising edge of the CamControl.Shifting variable denotes the "first" product to be processed. First product in this imple-
mentation means the cam is disengaged, the ProductBuffer was empty, and a product arrived. Shifting starts immediately if it
is the first product in the ProductBuffer. CamControl waits for the falling edge of the Shifting bit to set the CamControl.Engage
output. While the cam is engaged, the CamControl block continues to monitor the product buffer for new products. When the
ProductBuffer indicates that no products have arrived and the cam cycle has past the ‘Decision Position,’ the CamCon-
trol.Disengage output is turned on.
Page 58 of 757
Page 59 of 757
Application Example
This example illustrates how the CamControl block can be applied in a linear flying shear application. In this application, the
items to be cut are defective areas (knots) in a piece of wood. The code shown here performs the following actions:
1. The ProductBuffer stores the position of each defect where a cut must be made.
2. The CamShift_Control synchronizes the master (conveyor moving the wood) and slave (saw).
3. The CamControl.Engage output must be connected to Y_CamIn.Execute. (Other logic requirements may be included if
necessary.)
4. Key Point: When defects are close together, the goal is to remain engaged, and use the CamShift function during the
Page 60 of 757
slave (saw) retraction stroke while not in contact with the wood to re-synchronize with the next defect (or knot) to be
cut.
5. The CamControl.Disengage output must be connected to Y_CamOutExecute. In this application, it will cause the slave
(saw) to disengage when the ProductBuffer indicates that there are no more defects to be cut.
Page 61 of 757
Page 62 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamGenerator
This function calculates positions required for various master / slave motion profiles. It was designed to replicate the formulas
available in Yaskawa’s CamTool & Cam Editor Windows software and includes additional curve types. The CamData input is a
structure of key data points required by the application, including a formula code for generating a pair of master / slave data
points at the resolution specified. The output CamTable is a Y_MS_CAM_STRUCT which can be downloaded to the Motion
Engine using the Y_CamStructSelect function block.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V CamData CamSegmentStruct This structure must be populated with the key datapoints required for the cam
profile.
V CamTable Y_MS_CAM_ Cam data structure. Can be downloaded to the motion engine using Y_
STRUCT CamStructSelect.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the
value and re-trigger the execute input.
V TableSize UDINT This has been deprecated in v350. The Calculated using UPPER_BOUND
function will now determine the TableSize function.
Page 63 of 757
using the UPPER_BOUND function. There is
no need to connect a variable.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another
block takes control before the action is completed, the Done output will not be set.
This output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable
input, a Busy output indicates the function is operating, but not ready to provide
Valid information. (No Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
Notes
• In MotionWorks IEC, array sizes must be hard coded at design time. The default size of the CamSegmentArray DataType can
be changed if more segments are required. Edit the Cam Toolbox’s DataType definition if necessary. The practical limit on the
number of segments, however also depends on teh size allocate for Y_MS_PAIR.
MS_Array_Type:ARRAY[0..2880] OF Y_MS_PAIR.
If the application requires more than 2880 master / slave pairs, this value can be increased by editing the DataTypes Toolbox
> DataTypes > MotionBlockTypes definition.
l The resolution specified for each point in the CamData STRUCT is resolution of the master. For example, if MasterEnd
= 100.0, and the previous segment's MasterEnd = 80.0, and the Resolution = 1.0, then 20 data points will be cal-
culated along the CurveType specified.
l See the Cam Curve Types for further details about creating cam profiles.
Error Description
See the Function Block ErrorID list.
Examples
Structured text to load a CamSegmentStruct:
Page 64 of 757
Example 1
Page 65 of 757
Example 2
Page 66 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamMaster_Lookup
This function block provides the master position given a slave position by searching the referenced CamTable. If there may be
two or more master positions for the slave, as in the case of out and back slave motion, a range of slave positions can be spe-
cified to limit the search for the corresponding master position. This function block is useful for E-Stop recovery routines.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B CamTable Y_MS_ Cam data structure
CAM_
STRUCT
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
V SlaveMin LREAL The smallest slave position to include when LREAL#0.0
searching for the master.
V SlavePosition LREAL The current slave position. LREAL#0.0
B SlaveMax LREAL The largest slave position to include when LREAL#0.0
searching for the master.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
Page 67 of 757
control before the action is completed, the Done output will not be set. This output is reset
when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a Busy
output indicates the function is operating, but not ready to provide Valid information. (No
Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
B MasterPosition LREAL The master position which corresponds to the SlavePosition.
Notes
This function provide the exact master position that corresponds to the SlavePostion input by interpolating the CamTable. Con-
sider the following CamTable:
M S
0 0
10 0
20 5
30 10
40 20
Error Description
See the Function Block ErrorID list.
Page 68 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamShift_Control
The CamShift_Control block manages cam shifting for applications that buffer random products such as Linear Flying Shear or
Random Rotary Placer/Knife/Drill, etc. The purpose is to re-synchronize the slave for each item or product arriving on the mas-
ter axis.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Master AXIS_REF A logical reference to the master axis
B Slave AXIS_REF A logical reference to the slave axis
V RegistrationData ProductBufferStruct Structure containing all information for the circular buffer to operate.
V ControlData CamSyncStruct Structure containing all information about the cam profile that will be used
to calculate and implement cam shifts
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable FALSE
is held high and there are no errors.
V UpdateUsePointer BOOL RegistrationData.UsePointer will be updated when a product FALSE
has been processed only if this input is TRUE. If more than
one slave follow the master, only the last slave must update
the UsePointer.
V Action INT Designates this instance of this function block as one of the INT#1
several activities to occur based on the registration sensor.
Page 69 of 757
For applications that have only one action, such as a cut or a
stamp, this input can be left unconnected. This input is
required for applications that have more than one action asso-
ciated with a sensor input, such as pick and place.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
V Shifting BOOL Set high if the function block is active and Y_CamShift is Busy.
V ItemsProcessed UDINT Provides a count of the number of products processed since this function
was enabled.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Notes
l This function block includes a Y_CamShift block, and will execute shifts at the appropriate position based on data
provided by the user via the ControlData structure.
l The shifted master position is available by reading slave axis parameter 1502.
l This function block requires the ProductBuffer function block from the PLCopen Toolbox and the CamControl block from
the Cam Toolbox. These three blocks work together to provide cam engage/disengage control as well as cam shifting
(synchronization) logic.
l The CamShift_Control block uses data from RegistrationData and ControlData to make decisions on when to shift the
master position and by how much to shift the position. The user must provide valid data in the RegistrationData and
ControlData structures.
l In cases where multiple slaves are synchronized to a single master, the slaves can share the same ProductBuffer. Set
the last slave (last CamShift_Control function block) to update the UsePointer for the ProductBuffer.
Error Description
See the Function Block ErrorID list.
Code Example
The role of CamShift_Control in master / slave synchronization for each product is illustrated below.
Page 70 of 757
Page 71 of 757
Application Example
This example illustrates how the CamControl block can be applied in a linear flying shear application. In this application, the
items to be cut are defective areas (knots) in a piece of wood. The code shown here performs the following actions:
1. The ProductBuffer stores the position of each defect where a cut must be made.
2. The CamShift_Control synchronizes the master (conveyor moving the wood) and slave (saw).
3. The CamControl.Engage output must be connected to Y_CamIn.Execute. (Other logic requirements may be included if
necessary.)
4. Key Point: When defects are close together, the goal is to remain engaged, and use the CamShift function during the
slave (saw) retraction stroke while not in contact with the wood to re-synchronize with the next defect (or knot) to be
cut.
5. The CamControl.Disengage output must be connected to Y_CamOutExecute. In this application, it will cause the slave
(saw) to disengage when the ProductBuffer indicates that there are no more defects to be cut.
Page 72 of 757
Page 73 of 757
Page 74 of 757
Page 75 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamSlave_FeedToLength
CamSlave_FeedToLength was designed for use with camming applications that index a slave axis forward in one direction, and
require on the fly adjustments of the actual index length based on a sensor input that occurs while the slave is moving. The
sensor input is on the slave axis.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Master AXIS_REF A logical reference to the master axis.
B Slave AXIS_REF A logical reference to the slave axis.
V SlavePrms AxisParameterStruct User Defined DataType declared in the PLCopen Toolbox.
E TriggerData TRIGGER_REF Reference to the trigger signal source.. Refer to the PLCopen Plus
Function Block Manual for more details.
Page 76 of 757
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V ProductSize LREAL This value must be the same as the total one way LREAL#0.0
index of the cam profile for this slave.
V DistanceAfterLatch LREAL The desired additional travel distance after the LREAL#0.0
registration mark is detected
V MaxPosCorrection LREAL Limits the amount of positive correction that can be
applied.
V MaxNegCorrection LREAL Limits the amount of negative correction that can
be applied.
V AdjustMode INT An ENUM for TIME or range of master correction,
with the following values:
V MasterDistance LREAL Relative amount the master will travel (in cam mas-
ter units) from when the function block first
executes until the correction is complete. Only
used if AdjustMode = Y_AdjustMode#Master-
Distance.
V Duration LREAL Time of the correction used if AdjustMode is set for
TIME mode
V StartCorrection LREAL Earliest master position where the correction can LREAL#0.0
begin.
V FinishCorrection LREAL Latest master position where the correction must LREAL#0.0
be completed.
V SensorMinimum LREAL The earliest slave position where a sensor position LREAL#0.0
is valid for correction.
V SensorMaximum LREAL The latest slave position where a sensor position is LREAL#0.0
valid for correction. (function block
defaults to Pro-
ductSize if
unconnected.)
V MissedLatchLimit UINT The number of consecutive DefaultDistances UINT#0 (inter-
allowed to occur without seeing a registration mark preted as infin-
in the window, and not cause an Error. Valid regis- ite)
tration marks will reset the internal counter.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
the function are valid.
V ActualSize LREAL The actual indexed distance.
V LatchPosition LREAL The slave's position in the CamTable when the latch occurred.
B RecordedPosition LREAL The slaves latch position as reported by MC_TouchProbe.
V LimitedPosCorrection BOOL Indicates that the MaxPosCorrection is limiting the required cor-
rection.
V LimitedNegCorrection BOOL Indicates that the MaxNegCorrection is limiting the required cor-
rection.
V Adjusting BOOL Indicates that an adjustment is currently taking place (Busy output of
Y_SlaveOffset)
V MissedLatch BOOL Indicates that a latch was detected, but it was outside of the window
parameters specified.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Page 77 of 757
Notes
l This function block requires that the ReadAxisParameters function block from the PLCopen toolbox is also running,
preferably in the same task as CamSlaveFeedToLength.
l This function block does not support buffering of products. It is recommended to place the sensor less than 1 part
length away from where the correction must happen.
l Functionality differences between the CamSlave_FeedToLength and SlaveOffset_Control are given in the table shown
below.
CamSlave_ SlaveOffset_
FeedToLength Control
1) It will report an ErrorID 10021 if the user enters a non zero value for the MissedLatchLimit and a consecutive number of
latches are not counted. (To detect a hardware failure or other problem with system such as a sensor blockage.)
2) If latches are detected, but are outside of the SensorMinimum and SensorMaximum range, it is not considered a missed
latch in terms of counting up to the MissedLatchLimit. In this condition, the function block will pulse the MissedLatch output to
indicate that no correction will be made because the latch is not in the specified area. The user can track the MissedLatch out-
put pulses to make adjustments to the machine, or open the window for first time synchronization of the master and slave.
In Cam Toolbox v204, this function block was modified to report the RecordedPosition as a new output so that applications can
use this information to re position or re home the axis after a manual operation without adding a separate MC_TouchProbe func-
tion block in the application. The function was also modified to prohibit its internal Y_SlaveOffset from executing if no cam is
engaged.
Error Description
See the Function Block ErrorID list.
Applications
l Label Feeder
l Punch Press
Page 78 of 757
Overview of Supporting Function Blocks
Page 79 of 757
Application Example
Consider a form fill and seal application as shown below. Feed belts control payout of film for the form fill and seal machine.
Distance After Latch is set to align the end of bag with the cutter/punch
Page 80 of 757
The film drive belt is the slave to a constantly running master. The nominal cam table is shown below. The master cycle is 0 - 1
units and the slave cycle is also between 0 and 1 units.
Page 81 of 757
A sample screen shot of data that must be entered for the system described above is shown in the figure below. Care should
be taken to ensure that the input parameters will generate motion that is physically achievable by the slave axis.
In the screen shot of the CamSlave_FeedToLength block shown below, the sensor detects a registration mark at 0.36201 units
of the slave cycle. Assuming that the previous registration mark was captured at 0.5 units of the slave cycle, the distance
between two successive registrations is 0.86201 units (0.5 + 0.36201). The actual bag length in this case is 0.86201 units.
Page 82 of 757
The calculation for the adjustment required by the slave axis (film feed) to place the film exactly at the cutter/pinch location is
explained below:
Correction = Nominal part size (1.0) Actual bag length (0.86201)= -0.1379
This will be the offset added/subtracted (for this cycle) to any previous offsets in the slave position.
A continuous sequence of short, long, short bag lengths is illustrated in the logic analyzer plots below.
The first occurrence of TouchProbe.Done triggers a calculation that results in a short bag. A small negative offset is calculated
and can be seen by the dip to negative velocity at the end of the first master cycle. The registration mark in the middle of the
Page 83 of 757
second master cycle triggers a calculation that results in a long bag and a positive offset. Notice the spike in slave velocity
between 0.65 and 0.86 units of the master cycle. The last registration mark in the middle of the third master cycle triggers a
calculation that results in a short bag and a negative offset. Notice the dip in slave velocity between 0.65 and 0.86 units of the
master cycle.
Page 84 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamSlave_FeedToLength2
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Master AXIS_REF A logical reference to the master axis.
B Slave AXIS_REF A logical reference to the slave axis.
Page 85 of 757
V SlavePrms AxisParameterStruct User Defined DataType declared in the PLCopen Toolbox.
E TriggerData TRIGGER_REF Reference to the trigger signal source.. Refer to PLCopen Plus Func-
tion Block Manual for more details.
V Buffer CONTINUOUS_REF
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V ProductSize LREAL This value must be the same as the total one way LREAL#0.0
index of the cam profile for this slave.
V DistanceAfterLatch LREAL The desired additional travel distance after the LREAL#0.0
registration mark is detected
V MaxPosCorrection LREAL Limits the amount of positive correction that can
be applied.
V MaxNegCorrection LREAL Limits the amount of negative correction that can
be applied.
V AdjustMode INT An ENUM for TIME or range of master correction,
with the following values:
V MasterDistance LREAL Relative amount the master will travel (in cam mas-
ter units) from when the function block first
executes until the correction is complete. Only
used if AdjustMode = Y_AdjustMode#Master-
Distance.
V Duration LREAL Time of the correction used if AdjustMode is set
for TIME mode
V StartCorrection LREAL Earliest master position where the correction can LREAL#0.0
begin.
V FinishCorrection LREAL Latest master position where the correction must LREAL#0.0
be completed.
V SensorMinimum LREAL The earliest slave position where a sensor position LREAL#0.0
is valid for correction.
V SensorMaximum LREAL The latest slave position where a sensor position is LREAL#0.0 (func-
valid for correction. tion block
defaults to Pro-
ductSize if left
unconnected.)
V MissedLatchLimit UINT The number of consecutive DefaultDistances UINT#0 (inter-
allowed to occur without seeing a registration preted as infinite)
mark in the window, and not cause an Error. Valid
registration marks will reset the internal counter.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
the function are valid.
V ActualSize LREAL The actual indexed distance.
V LatchPosition LREAL The slave's position in the CamTable when the latch occurred.
V LimitedPosCorrection BOOL Indicates that the MaxPosCorrection is limiting the required cor-
rection.
V LimitedNegCorrection BOOL Indicates that the MaxNegCorrection is limiting the required cor-
rection.
V Adjusting BOOL Indicates that an adjustment is currently taking place (Busy output of
Y_SlaveOffset)
V MissedLatch BOOL Indicates that a latch was detected, but it was outside of the window
parameters specified.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Page 86 of 757
Notes
The slave axis must be Sigma-5 or Sigma-7 servo amplifier when using this function block.
Error Description
See the Function Block ErrorID list.
Applications
l Label Feeder
l Punch Press
Page 87 of 757
Overview of Supporting Function Blocks
Page 88 of 757
Page 89 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamSlave_Lookup
This function block returns the slave position corresponding to the given master position. This function block is used by
CamSlave_Recover.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B CamTable Y_MS_ Cam data structure.
CAM_
STRUCT
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
V MasterPosition LREAL The position of the master axis for which the cor- LREAL#0.0
responding slave position is required.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
control before the action is completed, the Done output will not be set. This output is reset
when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a Busy
output indicates the function is operating, but not ready to provide Valid information. (No
Page 90 of 757
Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
V SlavePosition LREAL The slave position that relates to the master as described in the CamTable.
Notes
This function provides the exact slave position that corresponds to the MasterPostion input by interpolating the CamTable. Con-
sider the following CamTable:
M S
0 0
10 0
20 5
30 10
40 20
If the MasterPosition is 15, the corresponding SlavePosition is 2.5. (50% of the value between two master points is used to
determine the value 50% between the corresponding slave points.)
This function determines the equivalent slave position by looking in the CamTable only, It does not include any other cam
adjustments that may have been applied using any of the Y_CamAdjust function blocks.
Error Description
See the Function Block ErrorID list.
Example
In the example shown below, the slave position corresponding to a master position of 10.0 is calculated. It can be seen that the
slave position from the cam profile is 9.9196950.
Page 91 of 757
Page 92 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamSlave_PullToLength
CamSlave_PullToLength was designed for applications where the slave mechanism pulls material forward but the mechanism
has a reciprocating stroke. This function block incorporates the ability to capture a registration mark on the material being
pulled, and make on-the-fly adjustments to the stroke length by executing a Y_CamScale function block. This block has the
same basic core operation as CamSlaveFeedToLength, which was designed for slaves that move in one direction but have the
same requirement.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Master AXIS_REF A logical reference to the master axis.
B Slave AXIS_REF A logical reference to the slave axis.
V SlavePrms AxisParameterStruct User Defined DataType declared in the PLCopen Toolbox.
Page 93 of 757
E TriggerData TRIGGER_REF Reference to the trigger signal source.. Refer to PLCopen Plus Func-
tion Block Manual for more details.
VAR_INPUT Default
B Enable BOOL The function will continue to execute FALSE
every scan while Enable is held high
and there are no errors.
V ProductSize LREAL This value must be the same as the LREAL#0.0
total one way index of the cam profile
for this slave.
V DistanceAfterLatch LREAL The desired additional travel distance LREAL#0.0
after the registration mark is detected
V MaxPosCorrection LREAL Limits the amount of positive cor- LREAL#0.0
rection that can be applied.
V MaxNegCorrection LREAL Limits the amount of negative cor- LREAL#0.0
rection that can be applied.
V AdjustMode INT An ENUM for TIME or range of master INT#0
correction, with the following values: (Y_AdjustMode#Master-
Distance)
Y_AdjustMode#MasterDistance: The
adjustment starts immediately and
completes when the master has trav-
elled the specified MasterDistance.
Y_AdjustMode#ElapsedTime: The
adjustment starts immediately and
completes within the specified Time.
Y_AdjustMode#WithinRange: The
adjustment starts when the master
first crosses the StartPosition and
completes when the master reaches
the EndPosition.
V MasterDistance LREAL Relative amount the master will travel LREAL#0.0
(in cam master units) from when the
function block first executes until the
correction is complete. Only used if
AdjustMode = Y_AdjustMode#Master-
Distance.
V Duration LREAL Time of the correction used if LREAL#0.0
AdjustMode is set for TIME mode
V StartCorrection LREAL Earliest master position where the cor- LREAL#0.0
rection can begin.
V FinishCorrection LREAL Latest master position where the cor- LREAL#0.0
rection must be completed.
V SensorMinimum LREAL The earliest slave position where a LREAL#0.0
sensor position is valid for correction.
V SensorMaximum LREAL The latest slave position where a LREAL#0.0 (function block
sensor position is valid for correction. SensorMaxium to ProductSize
if unconnected or set to
zero.)
V MissedLatchLimit UINT The number of consecutive UINT#0 (interpreted as infin-
DefaultDistances allowed to occur ite)
without seeing a registration mark in
the window, and not cause an Error.
Valid registration marks will reset the
internal counter.
Page 94 of 757
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
the function are valid.
V ActualSize LREAL The actual indexed distance.
V LatchPosition LREAL The slave's position in the CamTable when the latch occurred.
V LimitedPosCorrection BOOL Indicates that the MaxPosCorrection is limiting the required cor-
rection.
V LimitedNegCorrection BOOL Indicates that the MaxNegCorrection is limiting the required cor-
rection.
V Adjusting BOOL Indicates that an adjustment is currently taking place (Busy output of
Y_SlaveOffset)
V MissedLatch BOOL Indicates that a latch was detected, but it was outside of the window
parameters specified.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Notes
This function block is an adaptation of CamSlave_FeedToLength. The main difference is that this function is designed for recip-
rocating slave motion, and uses the Y_CamScale function block instead of the Y_SlaveOffset function block.
Error Description
See the Function Block ErrorID list.
Page 95 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamSlave_Recover
The CamSlave_Recover block moves a Slave back into sync with the master axis after camming was interrupted unexpectedly,
such as E-Stop conditions, or alarms that disable the servo. This function block is particularly useful when resuming the cam
motion from the position where it was interrupted is necessary to avoid wasting products in process, or if machine char-
acteristics demand it, or if homing and re-starting the cycle is not feasible. The CamSlave_Recover function block can be used
to bring the slave axis to the position in the cam table that corresponds to the current master axis position. Linear interpolation
is performed for accuracy in case of coarse resolution between points in the cam table. Once CamSlave_Recover is Done, the
camming motion can resume. This function block contains an MC_MoveAbsolute function.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B SlaveAxis AXIS_ A logical reference to the slave axis.
REF
B CamTable Y_MS_ Cam data structure. Can be downloaded to the motion engine using Y_
CAM_ CamStructSelect.
STRUCT
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
Page 96 of 757
B MasterPosition LREAL Master axis’ current position. The CamSlave_ LREAL#0.0
Recover function block will command the slave
axis to move to the slave position cor-
responding to this MasterPosition value.
B Velocity LREAL Velocity with which the slave axis recovers and LREAL#0.0
moves to the position from the cam table cor-
responding to the master axis position
B Acceleration LREAL Acceleration with which the slave axis recovers LREAL#0.0
and moves to the position from the cam table
corresponding to the master axis position
B Deceleration LREAL Deceleration with which the slave axis recovers LREAL#0.0
and moves to the position from the cam table
corresponding to the master axis position
E Jerk LREAL Not supported; reserved for future use. Value LREAL#0.0
of the jerk in [user units / second^3].
B Direction MC_Dir- The position of the slave axis for which the cor- LREAL#0.0
ection responding master position is required.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This out-
put is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a
Busy output indicates the function is operating, but not ready to provide Valid inform-
ation. (No Error)
B Active BOOL For buffered modes, this output is set high at the moment the block takes control of
the axis. For non buffered modes, the outputs busy and active have the same value
B CommandAborted BOOL Set high if motion is aborted by another motion command or MC_Stop. This output is
cleared with the same behavior as the Done output.
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
or 'Enable' goes low.
V SlavePosition LREAL Slave position in the cam profile that corresponds to the MasterPosition input to the
function block
Notes
After CamSlave_Recover is Done, in most cases, the slave will be at a position different from the home position or dwell pos-
ition. Care should be taken before re-engaging the slave to the master axis. Engage Position and Engage Data inputs on the Y_
CamIn block should be verified to make sure that they are set correctly. Incorrect engage position and or engage method can
cause abrupt motion on the slave axis.
3) Verify the MasterPosition input is the position of the master axis to where the slave must to move to re-synchronize the cam
operation.
4) Once CamSlave_Recover.Done is TRUE, the slave is in position to continue the cam motion immediately.
5) Change the Y_CamIn.EngagePosition to the current master position. Set Y_CamIn.EngageData.SlaveAbsolute:= TRUE.
6) Execute Y_Camin. The cam will engage and when the master axis starts motion, the slave will move in synchronization with
the master.
Page 97 of 757
Error Description
See the Function Block ErrorID list.
Example
E-Stops can result in the instantaneous loss of control of the axes. Manually clearing debris or scrap from the machine and
adjustments after E-Stops and alarms can cause a change in motor position, all resulting in a de synchronization of the master
and slave.
The example given below illustrates how the CamSlave_Recover block can solve E-Stop recovery issues. The logic analyzer
plot shows the axes when the E-Stop occurred. At this point, the Y_CamIn outputs InSync and Busy change to FALSE. A slight
drift in the master axis position can be seen after the E-Stop. This can be due to axis inertia, or because of adjustments made
to the machine. The CamSlave_Recover block is executed to physically move the slave to the position that corresponds to the
master’s current position as determined by looking in the CamTable.
The distance that the slave axis traverses in this process can be seen in the illustration. Once the CamSlave_Recover is Done,
the slave can be re-engaged with the master using Y_Camin.
Important: In this recovery condition, the ‘EngagePosition’ must be set to the master axis’ current position and the
EngageData.SlaveAbsolute=TRUE must be applied.
Page 98 of 757
Page 99 of 757
Page 100 of 757
Toolbox Help Documentation
Help version created 7/23/2021
CamSlave_WindowCheck
This function block is used by the CamSlave_FeedToLength function blocks to determine when the MC_TouchProbe output is
valid and should be used for correction. It compares the CamTableOutput parameter 1520 to the SensorMinimum and
SensorMaximum, not the actual slave feedback.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V Prms AxisParameterStruct User Defined DataType declared in the PLCopen Toolbox.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there
are no errors.
V ProductSize LREAL This value must be the same as the total LREAL#0.0
one way index of the cam profile for this
slave.
V SensorMinimum LREAL The earliest slave position where a sensor LREAL#0.0
position is valid for correction.
V SensorMaximum LREAL The latest slave position where a sensor LREAL#0.0
position is valid for correction.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
V InWindow BOOL Indicates the slave output.
Notes
If SensorMinimum and SensorMaximum are both zero, this function does not check for a window and reports InWindow as
TRUE.
For the most accurate WindowCheck, this function block must be executed in a fast CYCLIC task. Since this function is used by
CamSlave_WindowCheck, that block also should be executed in a fast CYCLIC task.
Error Description
See the Function Block ErrorID list.
CamTableManager
This function block serves as a FIFO buffer for CamTableIDs. Each time a new CamTableID is created, it will delete the cam
memory allocated to the oldest CamTable by using the Y_RemoveCamTable function block from the PLCopenPlus firmware lib-
rary. This function block cleans up cam memory for applications which routinely build new cam tables on the fly. A circular buf-
fer of four cam tables is maintained in the CamTableManager. When the function block is executed a fifth time, it releases the
memory area of the oldest cam table ID. Memory managed is that of the motion engine, not the PLC application.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trigger
the execute input.
V CamTableID UINT The most recent CamTableID create by Y_ UINT#0
CamFileSelect or Y_CamStructSelect.
V TableLimit UINT The number of cam tables to leave in memory UINT#5
before they are removed.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes con-
trol before the action is completed, the Done output will not be set. This output is reset when
Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, CommandAborted,
or Error is true. In the case of a function block with an Enable input, a Busy output indicates
the function is operating, but not ready to provide Valid information. (No Error)
Notes
l This function block is unnecessary in applications which use a single, static cam table, or when there are several cams
but once created, they are used permanently and not recalculated. There is capacity in the controller memory for
dozens of cam tables. CamTableManager prevents the situation where a machine has been continuously running for
weeks and enough cams were created that the memory becomes exhausted.
l Even though the memory for cam tables has been released, the Y_CamStructSelect function block will continue to alloc-
ate a new (increasing) CamTableID.
Error Description
See the Function Block ErrorID list.
Example 1
An example of using the CamTableManager is shown below. On the fifth execute of the CamTableManager block, the memory
for the oldest CamTable ID gets released. In the example shown below, the memory for CamID 1 gets released. The next exe-
cution of the CamTableManager will release the memory for CamID 2.
CamTableUpdate
This function block aids with cam file management when on the fly changes to the table data are required. It supports two
tables: one which may be actively running in the motion engine, and one that may be recalculated and transferred to the
motion engine. It contains the Y_CamStructSelect and Y_WriteCamTable function blocks.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Slave AXIS_REF A logical reference to the slave axis.
B CamTable Y_MS_CAM_ Cam data structure. Can be downloaded to the motion engine using Y_
STRUCT CamStructSelect.
V TableIDs TableIDStruct Contains an Active and Inactive TableID
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trigger
the execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has been completed successfully. If another
Notes
• If both TableIDs in the TableIDs input are zero, then this block automatically uses Y_CamStructSelect to send the first CamT-
able and obtain the CamTableID.
• If the event causing the cam tables to update is fired too frequently, this block limits the cam table transfer and swap by hold-
ing in a Busy state while the previous table transferred is still waiting to become the active table. In this way, it helps to stage
the table swapping so that the application does not resort to writing over an active table, which can cause the slave to jump.
Error Description
See the Function Block ErrorID list.
Example 1:
In this example, assume that some event has occurred which triggers the need for a new cam table to be generated using
CamGeneator. CamGenerator in turn fires CamTableUpdate to send the new CamTable to the motion engine. CamTableUpdate
manages the active and inactive TableIDs, which can then be used with Y_CamIn. The Table.Active variable will contain the
TableID of the last table transferred, so the next time the rising edge of Y_CamIn is triggered, the new table will be used. This
can be done while camming is currently engaged.
MasterIndex_Lookup
This function block returns the array index value corresponding to the given master position.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B CamTable Y_MS_ Cam data structure. Can be downloaded to the motion engine using Y_CamStructSelect.
CAM_
STRUCT
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
V MasterPosition LREAL The position of the master axis for which the LREAL#0.0
index in the cam table is required.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
control before the action is completed, the Done output will not be set. This output is reset
when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a Busy
output indicates the function is operating, but not ready to provide Valid information. (No
Notes
• The MasterPosition input should be a value between the maximum and minimum values of the master’s position profile for
the index value to be valid.
Error Description
See the Function Block ErrorID list.
SetCamMasterCycle
This function block prepares the motion engine with the cam table data so that cam adjustments involving blocks like Y_
CamShift can be executed before Y_CamIn is executed. This is necessary for applications where calculations that involve the
cam master cycle (parameter 1512) or cam master shifted cyclic position (parameter 1502) must be made before the Y_
CamIn function block is executed.
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Master AXIS_ A logical reference to the master axis.
REF
B Slave AXIS_ A logical reference to the slave axis.
REF
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated.
To modify an input, change the value and re-
trigger the execute input.
B CamTableID UINT A reference to the cam memory in the motion UINT#0
engine.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This out-
put is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a
Busy output indicates the function is operating, but not ready to provide Valid inform-
ation. (No Error)
B CommandAborted BOOL Set high if motion is aborted by another motion command or MC_Stop. This output is
cleared with the same behavior as the Done output.
Notes
1) Although there will be no slave motion, the slave axis must be enabled using MC_Power before executing this function
block.
Error Description
See the Function Block ErrorID list.
SlaveIndex_Lookup
This function block returns the array index value corresponding to the given slave position. This function block is used by
CamMasterLookup to determine the equivalent master location for a given slave position.
Library
Cam Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B CamTable Y_MS_ Cam data structure. Can be downloaded to the motion engine using Y_CamStructSelect.
CAM_
STRUCT
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trigger
the execute input.
V SlavePosition LREAL The position of the slave axis for which the cor- LREAL#0.0
responding master position is required.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
control before the action is completed, the Done output will not be set. This output is reset
when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
Notes
• The SlavePosition input should be a value between the maximum and minimum values of the slave’s position profile for the
index value to be valid.
• If the SlavePosition input is a value between two slave positions in the cam table, the SlaveIndex will return the lower index.
Error Description
See the Function Block ErrorID list.
SlaveOffset_Control
This function block makes corrections on a cammed slave axis for applications that require adjustments while the axis is in
motion. Some applications, such as labeling, require on the fly adjustments based on sensor input that occurs while the label
is moving. The actual pitch between consecutive labels may be different from the nominal pitch. The correction amount is the
difference between the nominal part size and the actual part size measured by the sensor. In this type of application, the
sensor input is wired to the slave axis.
The SlaveOffset_Control block is similar to CamSlave_FeedToLength in functionality. Both function blocks make corrections on
a cammed slave axis based on sensor input. Both function blocks make corrections while the slave axis is in motion. The dif-
ference between the two blocks is that SlaveOffset_Control makes use of the ProductBuffer block while the CamSlave_
FeedToLength does not. This allows the SlaveOffset_Control to buffer latched registration data. This can be used in applic-
ations where the sensor is more than one part length away from the point of action (SensorDistance > 1 part length). SlaveOff-
set_Control lacks the window check feature, correction limit feature and missed latch limit feature available in the CamSlave_
FeedToLength block.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Master AXIS_REF A logical reference to the master axis
B Slave AXIS_REF A logical reference to the slave axis
V RegistrationData ProductBufferStruct Structure containing all information for the circular buffer
to operate.
Notes
l This function block includes the Y_SlaveOffset function block, and will execute Offsets at the appropriate position
based on data provided by the user via the SlaveOffsetStruct structure.
l In cases where multiple slaves are synchronized to a single master, the slaves can share the same ProductBuffer . Set
the last slave (last SlaveOffset_Control function block) to update the UsePointer for the ProductBuffer.
Successive triggers > 2 part lengths Reports missed latch Makes large correction
Error Description
See the Function Block ErrorID list.
Application Example 1
Consider a rotary disc cammed to a master conveyor running a one way cam in the clockwise direction as shown. The home
position is defined as shown below. Product length (nominal distance between parts ) on the slave is 71 degrees. The nominal
cam slave travel is 71 degrees. Position 0 (bottom dead center) is the position that needs to be synchronized with the master.
The sensor distance is 90 units. If the first part is at 35.5 units and if the parts are exactly at the specified nominal lengths,
then the second part (first part captured by the sensor) will be at 106.5. However, the actual registered position of this part
may not be 106.5. In this case, the second product will not get synchronized with the master if it runs the nominal cam of 71
units. If the second product were at 105.5 units, an offset of 1 unit will have to be made for the synchronization to be effective.
SlaveRegistrationCheck
This function block was designed for use by the CamSlave_FeedToLength, CamSlave_FeedToLength2, and CamSlave_
PullToLength function blocks. It monitors variables related to a cam slave index and fires the output “MakeCorrection" which
can be connected to Y_SlaveOffset along with the AbsoluteCorrection output. The function also provides the interpolated value
of the cam table output when the latch was detected.
Library
Cam Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Con-
figuration tab in the Hardware Configuration (logical axis number).
B AxisPrm AxisParameterStruct Structure containing all parameters available for the Slave. Populate
this structure using the ReadAxisParameters function block.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
V DefaultSize LREAL Default length of the product in user units. LREAL#0.0
l This function block also monitors the travel distance of the slave, and if the slave traveled 10% more than the Pro-
ductDistance and no valid latch was detected, a missed mark is counted. If the number of consecutive missed marks
equals the MissedLatchLimit input variable, ErrorID UINT#10021 is output.
l Separate correction limits are provided for positive and negative to account for applications where it is not possible to
make such corrections. For example, negative corrections typically cannot be applied to labeling applications because
the material will become loose (slack).
Error Description
See the Function Block ErrorID list.
Cam Curve does not mean a shape curve which expresses a cam profile, but rather a ”motion curve” of the follower moved by
the cam. A motion curve is generally shown with time on the horizontal axis and displacement on the vertical axis. The purpose
of a cam is to move an object smoothly in a minimum time, without vibration and with minimum power. For this purpose, vari-
ous motion curves have been developed. These curves are not only used for cam mechanisms but can also be applied to vari-
ous other motions. The maximum non dimensional values such as Vm, Am, and Jm are called the characteristic values of the
cam curve. From these characteristic values and from the shapes of the acceleration curves, the general properties of the cam
curves can be known.
Curve Selection
The procedure for selecting a curve is as follows:
Arc
The CamSegmentStruct elements ArcRadius and ArcDirection must be declared for proper usage of this curve type.
Asymmetrical Cycloidal
Bezier
The Bezier curve type generates a non reversing bezier profile between two straight lines.
Cubic Spline
In this example, the left or beginning portion of a motion profile was created using the cubic spline formula. The right or end
portion of the cycle includes two modified sine motions.
seg:=INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#StraightLine;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#15.0;
Profile4.CamParameters[Seg].Resolution:=REAL#0.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#17.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#43.9614;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#25.5;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#40.3036;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#34.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#30.4425;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#42.5;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#19.6003;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#43.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#19.0;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#51.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#10.0305;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#3.5477;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#68.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#0.6464;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#76.5;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#0.005;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#CubicSpline;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#85.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#0.0;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#StraightLine;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#220.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#0.0;
Profile4.CamParameters[Seg].Resolution:=REAL#0.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#ModifiedSine;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#250.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#14.7;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#StraightLine;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#310.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#14.7;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#348.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#44.0;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
seg:=Seg + INT#1;
Profile4.CamParameters[Seg].CurveType:=TB_CurveType#ModifiedSine;
Profile4.CamParameters[Seg].MasterEnd:=LREAL#360.0;
Profile4.CamParameters[Seg].SlaveEnd:=LREAL#44.0;
Profile4.CamParameters[Seg].Resolution:=REAL#1.0;
Profile4.LastSegment:=Seg;
Cycloidal
Double Harmonic
Modified Sine
Modified Trapezoid
NC2 Curve
Notes: Deceleration is twice as long as acceleration, which provides the effect of restricting vibration.
Parabolic
Designed for use as the only segment in the motion profile when a axis must be indexed. This curve has the feature that the
non dimensional maximum acceleration Am is the minimum (Am=4) among all curves. Downside – Can cause vibration. Modi-
fied Trapezoid is better.
ParabolicVelocityBlend
Reverse Trapecloid
Simple Harmonic
This curve is also one of the discontinuous curves that easily causes vibration, but since it has smooth and good (low) prop-
erties, it can be used for low speed applications. When this curve is used for no-dwell applications, (out & back) the dis-
continuity of acceleration at the starting and end points is not a factor and then this curve is regarded as the best curve for no-
dwell use. The modified sine curve is considered an improvement over the simple harmonic.
Tangent Blending
Provides the same profile as Tangent Matching, but designed for use with the CamBlend function block. The difference
between this and Tangent Matching is how the matching velocity is determined. For this formula type, two segments are
required: a straight line and a tangent blend. Which segment comes first dictates whether a “blend in” or “blend out” profile
is created.
Tangent Matching
Provides a speed matched profile to minimize jerk between segments. Matches to the previous and next segment. In the case
of the Tangent match segment coming first or last, a wraparound match is calculated. A straight line segment is required
before and after the tangent match segment.
Trapecloid
Firmware libraries:
l YDeviceComm
l PROCONOS
User libraries:
The following User Libraries must be listed above the Communications Toolbox:
Current Version:
2021-04-27 v372 released
Previous Versions:
2020-11-23 v371 released
1) GetCommand FB - HOTFIX! Can errantly increment the UsePointer PAST the StorePointer when CR is the last character
received, AND the CircularByteBuffer has a LF as the next char from the previous circulation of chars. DCR 4403.
3) FTP_SendFile / (dns_translate_response FB) causing compile errors in MP2600iec and MP3000iec controller types. DCR
2338.
1) GetCommand - White spaces (extra CRLF) in G-Code files caused next line to be ignored. DCR 1525.
2) ReName_UserComm - New function block added to send / receive application specific structure via socket communication
with a host via UserComm.DLL
1) CommunicationChannel - Improved operation by not causing any errors when the host application closes the socket. DCR
1206.
2) GetCommand FB - DCR 701 Bug fix when buffer ends with partial command.
3) CommunicationChannel - DCR 1028, added explicit setting of TCP read Buffer, added 'CopyBusy' flag to throttle Y_
ReadDevice DB
4) InputBufferManager - DCR 1029, FB was not making sure there was enough room for the entire copy from InputBuffer to Cir-
cularByteBuffer before starting to copy. Only a big problem (corrupted data) if heavy data streaming pushed the buffering
capacity to its limits.
5) CommandProcessor - DCR 816 - Changed WHILE LOOP to IF block to eliminate the risk of watchdog if a partial command was
sent, or if many many commands are sent. If necessary, performance can be increased by going back to the WHILE loop
strategy, but checks must be in place to safeguard against watchdog faults.
Created from v202, but recompiled specifically for MotionWorks IEC v3.x.
1) CircularBufferStruct DataType: Added BufferedCount and BufferedPercent in preparation for support of a host PC which
streams part data and must monitor the buffer levels.
2) CommunicationChannel - Changed CommConfig from VAR_INPUT to VAR_IN_OUT. This allows the RemoteIPAddress to be
added to the structure, and shared with other parts of the program to open additional sockets to the remote host.
2014-05-02: v202 released. Requires firmware 2.2.0 and the YDeviceComm firmware library
1) Improved capability by switching from a STRING of 512 character to a BYTE array of 2048 characters for Command Stream-
ing lower level functions. This change REQUIRES users who are upgrading from an older toolbox verison to CHANGE the data-
type of the CommandString variable in CommandProcessor function blocks in your main project from YTB_STRING512 to CTB_
CommandStruct.
2) GetCommand - Changed DataType of CommandString from YTB_STRING512 to CTB_CommandStruct. This allows the func-
tions to work on the data as a byte array instead of a string, which reduces scan time (fewer STRING operations) and allows for
longer command strings to be processed. Previous limit was 512 characters, now it is 2048 per line (between delimiters).
4) CircularByteBuffer.PrmDelimiter - changed data type from YTB_STRING1 to BYTE. Related to improvements listed above.
5) GetParameter - Added DecimalDetected output. This can be used to prevent string conversion errors when using STRING_
TO_INT or similar conversions.
Data Structure used to manage a circular buffer of data used by several function blocks in the Communications Toolbox.
For use with the GetCommand and GetParameter function block. Contains information about the communication interface used.
For use with CommunicationChannel function block. Contains information about the communication interface used.
Supporting data structure for CommStruct, contains information about Ethernet interface configuration.
Code Example
ftpdata.LocalIP := '192.168.1.1';
ftpdata.FTPDomain := 'ftp.example.com';
ftpdata.DNSIP := '8.8.8.8';
ftpdata.Username := 'mp2300';
ftpdata.Password := 'securepassword';
If more than 10 recipients are needed then the declaration of RecipientArray must be changed to reflect that.
END_TYPE
Supporting data structure for CommStruct, contains information about Serial interface configuration.
Code Example
smtpdata.LocalIP := '192.168.1.1';
smtpdata.SMTPDomain := 'smtp.example.com';
smtpdata.Domain := 'example.com';
smtpdata.Sender := '[email protected]';
smtpdata.RcptArray[0].email := '[email protected]';
smtpdata.NumRcpt := 1;
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to zero, the second to 1, etc. The format for enumerated types is as follows: ENUM:(0, 1, 2...) as displayed in the
example below (MC_BufferMode#Aborting).
CommunicationChannel
The CommunicationChannel function block is designed to manage an input stream of data from either a serial or TCP socket
communication interface. It collects portions of data from Y_ReadDevice each time that function’s Done output goes high, and
adds it to a circular buffer for further analysis. The CommConfig structure must be initialized by the user to configure the
necessary communication parameters.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V CircularByteBuffer CircularBufferStruct Structure containing a data buffer and other operational information
required to manage the CircularByteBuffer.
V CommConfig CommStruct Structure containing information to be used in
establishing socket or serial communication.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no
errors.
V ClearBuffer BOOL Resets the StorePointer and UsePointer, which FALSE
logically clears the contents of the circular buf-
V BytesReceived UINT Total bytes received since this function was enabled.
Error Description
See the Function Block ErrorID list.
Setup
Follow these steps to initialize the CommConfig structure. Steps 1 & 2 show an optional easy way for the IEC application to
automatically obtain its own IP Address. One of the inputs required for the Y_DeviceComm basic functions is the MPiec con-
trollers own IP Address. This is necessary because the MPiec controller may have more than one physical Ethernet connector /
MAC address, and the YDeviceComm functions need to know which interface to use. Steps 1 & 2 show a way to automatically
obtain the IP address so the user will not be required to manually enter the controller's IP address for each system deployed.
It is also possibly to simply initialize the IPAddress as a sting such as IPAddress:='129.168.207.115';
1. Add a variable of type CONTROLLER_INFO to Global Variables as shown below. The Address must be %MD3.66560.
2. Add the following code to the initialize routine to obtain controller’s IP address. The variable IPAddress is a STRING.
The BUF_TO_STRING function block is located in the PROCONOS firmware library. As shown below, we are using it to
3. Initialize variable of data type CommStruct as shown below. Set .LocalPort to the desired connection port number that
you choose to use in your application. If multiple sockets will be used, ensure they each have a unique port number.
DNS_LookUp
This function block performs a DNS lookup for a provided domain name (Address) using a specified DNS IP and port and
returns the number of answers, the resolved IPV4 address and the Time To Live of the returned IP.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all inputs are read and the DNS lookup FALSE
is performed. To perform a lookup on a different address or
perform the same lookup again, change the value and re-trig-
ger the execute input.
V LocalIP YC_ The IP address of the controller on the local network. STRING#''
STRING16
V Address YC_ The domain name to perform the look-up on (not an IPV4 STRING#''
STRING128 address).
V DNSIP YC_ The IP address of the DNS server to perform the lookup STRING#''
STRING16 through.
Notes
l 'Address' must be a domain name (i.e. www.yaskawa.com), not an IPV4 address. Passing an IPV4 address is referred
to as a "reverse DNS lookup" and is not supported by this function.
l The DNS server(s) the MPiec controller has access to depends on the network configuration. If there is no access to a
local DNS server (see "Setup" below) talk to your IT professional about DNS server options.
l The main purpose of this block is for use in other Communications blocks, such as FTP and SMTP.
Setup
To perform a DNS lookup, a connection to a DNS server must be established. The easiest way to determine what DNS server to
use is to open up the Windows command prompt (Windows Key + R -> "cmd" -> Enter) and type "ipconfig /all" and under
"DNS Servers" in the Ethernet LAN section you will find the DNS server(s) that the computer is configured to use.
DWORD_OF_BYTE
This function combines four bytes into a DWORD. BYTE1 is the least significant portion of the resulting DWORD.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B EN BOOL Enables the function. FALSE
V BYTE1 BYTE The least significant byte of the DWORD to be assembled. BYTE#0
V BYTE2 BYTE BYTE#0
V BYTE3 BYTE BYTE#0
V BYTE4 BYTE The most significant byte of the DWORD to be assembled. BYTE#0
VAR_OUTPUT
B ENO BOOL High if the function is executing normally.
FTP_SendFile
This function block uses the FTP (File Transfer Protocol) to write a file to a specified FTP server. The File must already exist on
the MPiec Controller's Flash or ramdisk for this function block to read and transfer data to the Destination FTP server. The File
must be created by some other method, or refer to ReName_FTP_SendData which doesn’t require a pre existing file.
Library
Comm Toolbox
Parameters
Parameter Data Type Description
*
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
V File YTB_ The full file name and location on the controller, STRING#''
STRING128 e.g. '/flash/user/data/example.csv'.
V FTPData FTP_Data The input structure that configures the FTP All zeros in structure
transfer such as FTP server address, port, etc.
V Destination YTB_ The full file name and destination on the FTP STRING#''
STRING64 server, e.g. 'metrics/example.csv'.
V Append BOOL To select whether an existing the file on the FALSE
server should be deleted and rewritten or the
new data should be appended to the existing
data.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
Notes
l This block utilizes FTP, not SFTP because SSL is not supported by the MPiec firmware. As a result, all FTP traffic sent
and received (e.g. username, password, file data) is sent unencrypted in plain text and is visible to anyone with access
to the network. This should not be a problem if the data being sent is not of a sensitive matter and the FTP server
account is CHROOT'd properly (talk to your IT professional about using FTP).
l The FTP server should either have an internal/external domain name or use a static IP address because if the address
changes, it will prevent the function from transferring files. See "Setup" for more details.
l The FTP user account must have "Write" privileges to successfully write files to the server. Optionally, the account may
also have "Append" privileges. If files already exists and the FTP account only has "Write" privileges, then the file will
be overwritten. If the file exists and the user account has "Append" privileges, then the file contents transferred will be
appended to the existing file.
Error Description
See the Function Block ErrorID list.
Here is the code in the "Initialize" ST program which configures the file data and the FTP structure. The FTP server is hosted
on a local computer and does not have a domain name. Therefore, FTPIP was used and FTPPort was left blank as the local FTP
server is configured to use the default port of 21. The LocalIP is set to the controllers IP and the username/password com-
bination are set.
This program creates a file via the PROCONOS FILE_OPEN, STRING_TO_BUF, FILE_WRITE and FILE_CLOSE functions. The con-
tents of the file in "sample_file_data" is converted from a YC_STRING128 to YC_BYTE128 via the "SAMPLE_TO_BUF" block.
Once the file is created, the destination file name is prepared and the FTP function sends the file to the server.
The PrepareFile contact is set true as is the Execute contact. Once both contacts are TRUE, the FTP_SendFile block sends the
newly created file.
The contents of the file match the "sample_file_data" string and the file can be seen in the explorer. In the FTP server log all of
the commands sent can be viewed and it can be seen that the file was transferred properly and successfully.
The same data configuration structure was used but there is no preset message for the file as it will be created dynamically.
In addition to the Communications Toolbox, two additional Yaskawa toolboxes are used: File_RW_Toolbox and PLCOpen_Tool-
box. The File_RW_Toolbox is used to create the CSV file that is uploaded to the FTP server and the PLCOpen_Toolbox is used to
control the single servo used in this example.
Controlling this example is very simple. The servo is turned on by "ServoEnable" which then in turn starts the jog at a constant
velocity. The rest of the example is controlled in the main program:
The results of this example can be monitored by exploring the target upload directory and examining the FTP server log:
GetCommand
The GetCommand function block is a supporting function block for the ReName_CommandProcessor function block. It
extracts a CommandString from the CircularByteBuffer as identified by the CmdDelimiter specified in the CircularByteBuffer
structure.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V CircularByteBuffer CircularBufferStruct Structure containing a data buffer and other operational information
required to manage the CircularByteBuffer.
V CommandString CTB_Com- Input string containing at least two bytes of command characters and any
mandStruct optional parameters separated by a PrmDelimiter.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there
are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
V CommandCreated BOOL Indicates that the CommandString VAR_IN_OUT contains a new Com-
mandString.
V CommandCode INT Integer value corresponding to the first two ASCII characters of the Com-
mandString.
Error Description
See the Function Block ErrorID list.
GetParameter
The GetParameter function block provides a single parameter Value extracted from the CommandString. This is supporting
function block for use within the CommandProcessor function block.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V CommandString CTB_Com- Input string containing parameters separated by delimiters. such as MV;1.0;-
mandStruct 10.5;3.007
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V Method Method Determines method used to retrieve variable from data Method#Parameter
buffer. Method#Parameter uses the input Number to
determine the parameter number within the string to out-
put. Method#Character uses the number input as the
index in the byte array to start looking for the next valid
parameter.
V Delimiter YTB_STRING1 String value of the character separating parameters BYTE#44 (",")
within the CommandString.
V Number INT Depending on Method input, either the number of the INT#0
parameter value to be found.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function
are valid.
Notes
l There are two methods available with this function block; Values can be fetched via Parameter (Delimiter) count or by
StartCharacter. The Parameter method always counts delimiters from the beginning of the CommandString to explicitly
return the correct Value. If this Function block is executed in WHILE loop situation, it is more efficient to specify the
next StartCharacter as the Number Input by feed the previous EndChar back into the function block.
l If Method = Method#Parameter, GetParameter will search through the command string to find the parameter cor-
responding to the Number input. This method is useful for commands with fewer parameters or when parameters are
being read non-sequentially.
l If Method = Method#Character, GetParameter will search the command string for the next parameter starting at the
character location equal to the Number input. The EndChar output can be used as feedback to the Number input to
find the next parameter. This method is useful when parameters are being read sequentially and provides a large per-
formance increase when parsing a CommandString with a large number of parameters.
Error Description
See the Function Block ErrorID list.
InputBufferManager
The InputBufferManager function block manages a circular buffer of incoming data. It is a supporting function block for the
CommunicationChannel function block. A user should not need to access this function directly.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V InputBuffer YTB_ByteArray2048 Byte array containing data to be copied into the CircularByteBuffer.
V CircularByteBuffer CircularBufferStruct Structure containing a data buffer and other operational information
required to manage the CircularByteBuffer.
VAR_INPUT Default
B Enable BOOL The function will continue to execute FALSE
every scan while Enable is held high
and there are no errors.
V Execute BOOL Upon the rising edge, all other function INT#0
block inputs are read and the function
is initiated. To modify an input, change
the value and re-trigger the execute
input.
V BytesRead UDINT Number of bytes to be copied from UDINT#0
InputBuffer to CircularByteBuffer.
V ClearBuffer BOOL Resets the StorePointer and UsePointer, INT#0
Notes
This is a hybrid function block that incorporates both PLCopen specified behaviors: Enable and Execute. This was mainly done
to separate two types of initialization: one that occurs when the Enable goes high, and another that occurs only when the
Execute goes high.
Error Description
See the Function Block ErrorID list.
ReName_CommandProcessor
The ReName_CommandProcessor function block is a user customizable function block that parses data from a circular buffer
and copies it into a user defined structure of data to operate the machine. To use this function, copy and paste it into the main
project, rename it, and customize it and the MachinaData structure. It's designed to identify variable length commands in the
CircularByteBuffer and process them on a case by case basis.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V CircularByteBuffer CircularBufferStruct A string of characters such as MV;1.0;-10.5;3.007
V MachineData User Defined Create a user defined type which suits the needs of the application.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there
are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
V CommandCount UDINT Reports the number of commands processed since Enable was set high.
Error Description
See the Function Block ErrorID list.
Customization Steps
1. Copy this Function block from the Comm Toolbox, paste it into your project, and rename with a different (but similar)
name.
2. Data type MyMachineStruct (VAR_IN_OUT ‘MachineData’) is only an example structure. A custom structure must be
designed to uniquely match the needs of the application. An example is shown below.
1. a. CmdDelimiters are used to mark the end of a complete command. Up to four characters can be specified.
Typically, <cr>, which is BYTE#13 or <cr><lf>, which is BYTE#13 BYTE#10 are used. If CmdDelimiters not
specified, will default functionality will automatically accept Carriage Return or Carriage Return & Line Feed.
2. b. PrmDelimiter specifies the character that separates individual parameters within a command. If PrmDe-
limiter is not specified, the function will automatically default to a comma, (BYTE#44).
3. c. Size must represent the defined size of the DataType definition for the CircularBufferStruct’s “Data? Element.
If Size not specified, it will default to zero and the InputBufferManager function block will cause an error.
Normally, this value is 8192 as the structure definition is in the Comm Toolbox itself. If this must be increased
for any reason, modify the Comm Toolbox DataType definition and set the Size input accordingly.
5. Locate the comments “Customize the code below" and “Customize the code above"
6. Remove example commands to avoid potential errors in operation.
Rename_FTP_RecordData
This function works in combination with ReName_FTP_SendData. Both functions must be copied and pasted into the main pro-
ject and slightly customized for use. This function is designed to continuously record data using two databanks. Together,
ReName_FTP_RecordData and ReName_FTP_SendData handshake and synchronize operations such that Recording takes
place in one databank while the FTP transfer takes place using the other databank. Files of nearly unlimited size can be created
on an FTP Server. Customization consists of creating an application specific structure similar to "ReName_RecordedUserData"
in the main project which contains the specific data required by the application. This technique writes binary data to the file
and therefore requires a program to read and interpret the same data structure. The data is non ASCII, unless converted to
ASCII as part of the MotionWorks IEC customization using LREAL_TO_STRING and similar functions. Converting the data to
ASCII on the MPiec is not recommended, especially if high speed recording is desired. ReName_FTP_RecordData typically
executes in a faster task, even as fast as the Mecahtrolink update rate if necessary, recording up to 1000 samples of data in
each "DataBank." There are two Databanks; one which is being written to by FTP_RecordData, and the other which contains
data being uploaded to the FTP server. Rename_FTPSendData can typically execute in a slower task or the DEFAULT task.
Library
Comm Toolbox
Parameters
Parameter Data Type Description
*
VAR_IN_OUT
V RecordedData ReName_Recor- User customizable structure containg the data to be recorded. See examples
dedUserData below.
V NewSample ReName_Recor- A single element of the many samples in one of the databanks. All the data in one
dedSample sample is collected in one time slice.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
Notes
l This block utilizes FTP, not SFTP because SSL is not supported by the MPiec firmware. As a result, all FTP traffic sent
and received (e.g. username, password, file data) is sent unencrypted in plain text and is visible to anyone with access
to the network. This should not be a problem if the data being sent is not of a sensitive matter and the FTP server
account is CHROOT'd properly (talk to your IT professional about using FTP).
l The FTP server should either have an internal/external domain name or use a static IP address because if the address
changes, it will prevent the function from transferring files. See "Setup" for more details.
l The FTP user account must have "Write" privileges to successfully write files to the server. Optionally, the account may
also have "Append" privileges. If files already exists and the FTP account only has "Write" privileges, then the file will
be overwritten. If the file exists and the user account has "Append" privileges, then the file contents transferred will be
appended to the existing file.
Error Description
See the Function Block ErrorID list.
Example
(It is assumed that an FTP server is configured and access is possible.)
DataTypes
Create a datatype which describes the information to be recorded. The four datatypes shown below make up "MyRe-
cordedUserData" which must be connected to the function blocks. Customize the detailed information to be recorded as shown
on lines 5 through 11. Add or subtract as many variables are required. All code shown here was copied and pasted from the
Initialization
ReName_FTP_SendData
This function works in combination with ReName_FTP_RecordData. Both functions must be copied and pasted into the main
project and slightly customized for use. This function is designed to continuously record data using two databanks. Together,
ReName_FTP_RecordData and ReName_FTP_SendData handshake and synchronize operations such that Recording takes
place in one databank while the FTP transfer takes place using the other databank. Files of nearly unlimited size can be created
on the FTP Server. Customization consists of creating an application specific structure similar to "ReName_RecordedUserData"
in the main project which contains the specific data required by the application. This technique writes binary data to the file
and therefore requires a program to read and interpret the same data structure. The data is non ASCII, unless converted to
ASCII as part of the MotionWorks IEC customization using LREAL_TO_STRING and similar functions. Converting the data to
ASCII on the MPiec is not recommended, especially if high speed recording is desired. ReName_FTP_RecordData typically
executes in a faster task, even as fast as the Mecahtrolink update rate if necessary, recording up to 1000 samples of data in
each "DataBank." There are two Databanks; one which is being written to by FTP_RecordData, and the other which contains
data being uploaded to the FTP server. Rename_FTPSendData can typically execute in a slower task or the DEFAULT task.
Library
Comm Toolbox
Parameters
Parameter Data Type Description
*
VAR_IN_OUT
V RecordedData ReName_ Rename and customzie this structure based on the needs of the application.
RecordedData
VAR_INPUT Default
B Enable BOOL The function will continue to execute FALSE
every scan while Enable is held high and
there are no errors.
V File YC_ The full file name and location on the con- STRING#''
Notes
l This block utilizes FTP, not SFTP because SSL is not supported by the MPiec firmware. As a result, all FTP traffic sent
and received (e.g. username, password, file data) is sent unencrypted in plain text and is visible to anyone with access
to the network. This should not be a problem if the data being sent is not of a sensitive matter and the FTP server
account is CHROOT'd properly (talk to your IT professional about using FTP).
l The FTP server should either have an internal/external domain name or use a static IP address because if the address
changes, it will prevent the function from transferring files. See "Setup" for more details.
l The FTP user account must have "Write" privileges to successfully write files to the server. Optionally, the account may
also have "Append" privileges. If files already exists and the FTP account only has "Write" privileges, then the file will
be overwritten. If the file exists and the user account has "Append" privileges, then the file contents transferred will be
appended to the existing file.
l There is a handshake system in place between ReName_FTP_RecordData and ReName_FTP_SendData so that if there is
a timing problem and ReName_FTP_RecordData must switch to the other DataBank but ReName_FTP_SendData is still
busy, and Error will occur. Timing issues could be based on the tasks in which both function blocks are executing, and
if further customization has been performed, such as by modifying the number of samples in each DataBank.
Error Description
See the Function Block ErrorID list.
Example Customization
(It is assumed that an FTP server is configured and access is possible.)
DataTypes
Create a datatype which describes the information to be recorded. The four datatypes shown below make up "MyRe-
cordedUserData" which must be connected to the function blocks. Customize the detailed information to be recorded as shown
on lines 5 through 11. Add or subtract as many variables are required. All code shown here was copied and pasted from the
Comm Toolbox, then all instances of "ReName_" were changed to "My." Change to anything meaningful and appropriate. The
only datatype which does not require modification and can remain in the Comm Toolbox is RecordStatusData.
Initialization
Rename_UserComm
The ReName_UserComm function block is designed to facilitate simple data exchange with another device by opening a socket
and sending /receiving raw binary data. The function must be copied and pasted into the main project and slightly customized
for use. The overall design includes a C# DLL which must also be customized.
Library
Comm Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
V UserData ReName_ During customization, define and create any structure as required for the application.
UserStruct
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
V CommConfig BOOL Resets the StorePointer and UsePointer, FALSE
which logically clears the contents of the cir-
cular buffer, but any existing data is not
actually cleared.
V TimeOut TIME TIME FALSE
V BytesReceived UDINT Total bytes received since this function was enabled.
Error Description
See the Function Block ErrorID list.
Example
1. Open your project.
2. Open the Comm Toolbox in a second copy of MotionWorks IEC.
3. In the second copy (Comm Toolbox) Project Tree Window, select ReName_FTP_SendFile and ReName_FTP_RecordData
and Copy.
4. In the main project, Project Tree Window, right click on Logical POUs and select Paste.
5. For both of the new function blocks in your project, right click on them to access the properties page and rename the
function blocks.
SendEmail
This function block sends an e-mail via SMTP commands (Simple Mail Transfer Protocol) through a specified SMTP server. The
output is highly configurable including multiple recipients, any message body structure, specified sender e-mail and name
and other features listed below.
Library
Comm Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V MessageData SMTP_Data A user customized data structure for configuring the e-mail block.
V MessageBody YTB_ The e-mail body as a 4096 element byte array. If a larger body is required, this declar-
BYTE4096 ation can be changed and the library recompiled.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
V BodyLength UDINT The length (number of bytes) of the e-mail body that will be UDINT#0
sent. While not necessary it is highly suggested, see notes
below.
VAR_OUTPUT
B Done BOOL Set high upon successfully sending an e-mail.
B Busy BOOL Set high upon the start of communications with the SMTP server and low when 'Done'
V ErrorString YTB_ If 'Error' is true and it is an SMTP response code related error then this output contains
STRING256 the response string from the SMTP server.
Notes
l The MPiec series controllers do not support SSL SMTP servers and therefore will most likely only work with local net-
work SMTP servers. Talk with your IT professional about connecting to a local SMTP server from an MPiec Series Con-
troller (see "Setup" below for more details about the required configuration).
l The "BodyLength" input is optional but highly suggested to reduce the packet size and the potential for large amounts
of padding ("0") bytes on the recipients side. All examples include this Input and demonstrate how to get the correct
length.
Error Description
See the Function Block ErrorID list.
Example
As this is a complicated function, additional examples are provided in separate help files listed under "Additional Examples"
and prefixed with "SMTP_". The example shown here sets up the block, creates a message body and sends an e-mail to
external Gmail account.
The variable EmailBodyString is of type YC_STRING256. Below is the configuration of the SMTP_Data structure:
The most basic form of sending an e-mail is simply converting a string to a byte array via the STRING_TO_BUF function block
provided in the PROCONOS firmware library. With the data structure shown above and this STRING_TO_BUF block, the email is
configured and ready for use.
Firmware libraries:
l PROCONOS
User libraries:
The following User Libraries must be listed above the File Read Write Toolbox:
The File Read / Write Toolbox contains some functions must be customized for use in every application.
l Write_CSV_File
l Read_CSV_File
To use these functions, they must be copied and pasted into your main project as a function block with a different (but similar)
name. To do this, copy and paste the structured text and the variable definitions grid from the toolbox version. These four
main functions refer to other sub functions in the File Read Write toolbox, which do not require customization and can remain
in the File Read Write Toolbox. There is no need to move the following function blocks:
l Read_Buffer
l Read_Line
l Read_Value
More detailed customization information and examples are provided for the help for each of the functions blocks mentioned
above.
See Yaskawa's Youtube Webinar - CSV File Transfer with the File_RW Template.
Current Version:
2021-07-07 v372 released
1) ReadValue FB - G-Code Override commands with trailing spaces caused GCode_Processor to hangup. DCR 5199.
2) ReadValue FB - No longer outputs the comma delimiter with desired value (in Non GCode mode.) DCR 5416.
3) HC_WriteParameter FB - Error logic was not correct, could cause the function to hang busy in some cases. DCR 5520.
5) HC_WriteParameter / Set_XML_Data FB - Was not detecting servo or external axistype to determine need to write legacy
parameters. DCR 5518.
Previous Versions:
2020-11-30 v371 released.
1) ReadValue FB - added support to ignore comments added to G-Code % preamble. DCR 4697.
2) HC_WriteParameter - Fixed bug preventing the Hardware Configuration from detecting that parameters had been changed
via this function block. DCR 4808.
1) Homing via Group Toolbox GroupToHome FB did not execute more than once when using the v352 Toolbox Installer version.
DCR 2985.
1) ReadValue - Failure when CRLF falls exactly on a ReadBuffer boundary. (CR and end of buffer, LF at next beginning. DCR
2110.
2) ReadValue, Read_CSV_File - Increase size of STRING DataTypes from 80 to 128 chars. DCR 2111.
3) G-Code - lines containing both variables and comments allowed Comments to be passed through to G-Code parser. DCR
2228.
5) ReadValue - G-Code lines containing IF statements containing no spaces allowed conditional statements be copied into com-
mand buffer with extra character. DCR 2254.
6) ReadValue G-Code lines (with comments like this) were leaking a CR character into the command buffer. DCR 2349.
2) Data logging FBs - Improvement to programatically check array sizes (non hard coded) DCR 1722.
3) CreateFilePath - New function block to concatenate path filename and extension. DCR 1773.
1) GetTagName FB - New in v340. For example, <HeightZ>164</HeightZ> will return HeightZ. DCR 1066.
4) HC_WriteParameter - Writing Prm 1833 did not update Axis.XML to change MachineCycle. DCR 1194.
5) ByteBufferStruct - Changed datatype for FilePosition from DINT TO UDINT. DCR 1225.
6) ReadValue - Now detects special statements in G-Code data for expressions and formulas. DCR 1241.
7) ReadValue - Was filtering out space characters, now includes in the output. DCR 1294.
2016-09-15 v301 released. Created using 3.2.0 firmware, but not necessary
1) ReadLine & ReadValue functions - Removed VAR_INPUT StartChar and VAR_OUTPUT EndChar, the function blocks now man-
age this data in the databuffer directly.
2) HC_WriteParameter - new function block added. Writes configuration parameters which are not available with MC_
WriteParameter.
3) ReadBuffer - Improved ReadBuffer to report when no data was read from file.
4) Read_CSV_File - The performance of this template POU was improved by using a two scan WHILE loop technique.
5) ReadValue - Improved automatic handling for files with CRLF, CR, or just LF.
2) DataLogCompareLive - Known issue: Setting Periodic to TRUE on the function block will only work when if log file has more
than 1000 entries in the log file otherwise the function block will error.
3) ReadValue - Added VAR_INPUT GCodeMode to support detection of numeric to alpha transitions as delimiters in G-Code.
1) ReadValue - Fixed bug introduced in v203 to auto detect CRLF, CR, or LF as line delimiters. A file with CRLF was being pop-
ulated into every other array index because the first character in the read after a new line was BYTE#10.
3) ReadValue - Added VAR_INPUT GCodeMode to support detection of numeric to alpha transitions as delimiters in G-Code.
4) Known Issue - When reading CSV files, the last line must contain the same line delimiter, CR or CRLF as all other lines in the
file, or the last line will not be read into the structure.
1) Added support for files that only use line feed (BYTE#10) as a line delimiter instead of carriage return (BYTE#13).
1) ReadValue - Added "OR (x = DataBuffer.Length)" to cause EOF flag even if the <CR> is not the last byte in a line
2) Read_CSV_File & Write_CSV_File - Added PreStringError 10017 to detect if the controller already has a String Conversion
alarm
1) Improved reading of very last portion of buffer. (partial buffer read when EOF occurred)
3) Added Write_CSV_File ErrorID 10119 to stop execution if the Row or Column data in the User Structure are zero.
4) Improved handling of ErrorID=22 by forcing a FILE_CLOSE if there was an error opening a file.
1) First official release version with documentation provided for Read_CSV_File. (See Toolbox manual.)
1) Added ReadBuffer function block for use by Read_CSV_File to increase the efficiency of the file read operation.
Previously, logic was searching for one line of bytes at a time, and it took 6 scans to process each line. With the ReadBuffer FB,
Read_CSV_File can process a given buffersize in 6 scans. Default is 2048 bytes, settable by user.
For use with the ReadBuffer, ReadLine, and ReadValue function blocks. These block are designed to share the same data.
DataBuffer is the largest piece of data, read directly from a file using the FILE_READ function block from the ProConOS firm-
ware library, ReadLine returns a line of ASCII data from the DataBuffer, and ReadValue returns a single value found between
two delimiters.
Supporting array for ChannelStruct. For use with the DataLogCompare function block.
Structure containing parameters for recording and writing general purpose data. This structure is used with the DataLo-
gRecord and DataLogWrite function blocks.
Supporting structure for CompareStruct. For use with the DataLogCompare function block.
Supporting array for LoggedValuesStruct. For use with the DataLogRecord and DataLogWrite function blocks.
Supporting structure for DataLoggingStruct. For use with the DataLogRecord and DataLogWrite function blocks.
Supporting structure for LoggedValuesArray. Used with the DataLogRecord and DataLogWrite function blocks.
Supporting structure for DataLoggingStruct. For use with the DataLogRecord and DataLogWrite function blocks.
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to 0, the second to 1, etc.
Percentage
PercentOfAverage
DataLogCompare
This function block compares two files and reports the PercentMatching within the
user specified allowable PercentDeviation, SampleDeviation and OfffsetDeviation.
Library
FileRW Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
V ReferenceFile STRING The name of the file on the controller that is presumed to STRING#''
have good data.
V ComparisonFile STRING The name of the file on the controller to be compared to the STRING#''
ReferenceFile.
V FileLocation FTB_FileLoca- Dictates whether the Comparison file is stored in ram- FTB_FileLoca-
tion disk/user/data (#Ram) or flash/user/data (#Flash) on the tion#Ram
controller.
V PercentDeviation YTB_LREALAr- Percentage by which a given sample in the ComparisonFile LREAL#0.0
ray8 can differ from the ReferenceFile and still be considered a
Notes
l Three function blocks work together in this solution: DataLogRecord, DataLogWrite, and DataLogCompare.
l Start and Stop the DataLogRecord function in conjunction with an event signifying when the data should be recorded.
This is intended to be a single event, not a series of intermittent events. At some time after DataLogRecord is Valid,
Execute the DataLogWrite function, typically in a slower task than DataLogRecord. Typical usage includes DataLo-
gRecord in a task as fast as the Mechatrolink rate if necessary, DataLogWrite in a 32 to 64 mSec task, and DataLo-
gCompare in a 32 to 64 mSec task.
l These functions use a double buffer technique, swapping from one to other. DataLogRecord accesses one buffer while
DataLogWrite accesses the other. The two activities should never interfere with each other, error will be generated if
there is a timing conflict when trying to switch buffers. If this occurs, it is possible that DataLogWrite must be
executed at a faster interval.
l The comparison algorithm first checks for a match within the offset specified. If the data does not match, then it will
check within the allowed percentage. If still a match cannot be determined, the process repeats by iterating through
the number of samples before and after the equivalent time sample. If a SampleDeviation of 20 is provided, the process
will check up to 20 samples before and 20 after the sample in question.
Error Description
Example:
Initialize these structures for each item to be recorded by DataLogRecord. Each data set may require a different set of match-
ing criteria.
DataLogRecord
This function block records data on up to 6 channels every scan and stores the data in
DataLogPrms.Data[0] and DataLogPrms.Data[1] structures. The data could be down-
loaded and analyzed in Excel or other software, but the intention is to re-record at
some future time under the same conditions, and use the DataLogCompare function
block to analyze the two files for significant differences.
Library
FileRW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V DataLogPrms DataLoggingStruct Structure containing the parameters for recording the data.
VAR_INPUT Default
B Enable BOOL [[[Undefined variable Primary.ParameterDescription_Enablee]]] FALSE
V Channel1 LREAL The value of Channel 1 data to be recorded every scan. LREAL#0.0
V Channel2 LREAL The value of Channel 2 data to be recorded every scan. LREAL#0.0
Notes
l Three function blocks work together in this solution: DataLogRecord, DataLogWrite, and DataLogCompare.
l Start and Stop the DataLogRecord function in conjunction with an event signifying when the data should be recorded.
This is intended to be a single event, not a series of intermittent events. At some time after DataLogRecord is Valid,
Execute the DataLogWrite function, typically in a slower task than DataLogRecord. Typical usage includes DataLo-
gRecord in a task as fast as the Mechatrolink rate if necessary, DataLogWrite in a 32 to 64 mSec task, and DataLo-
gCompare in a 32 to 64 mSec task.
l These functions use a double buffer technique, swapping from one to other. DataLogRecord accesses one buffer while
DataLogWrite accesses the other. The two activities should never interfere with each other, error will be generated if
there is a timing conflict when trying to switch buffers. If this occurs, it is possible that DataLogWrite must be
executed at a faster interval.
l The comparison algorithm first checks for a match within the offset specified. If the data does not match, then it will
check within the allowed percentage. If still a match cannot be determined, the process repeats by iterating through
the number of samples before and after the equivalent time sample. If a SampleDeviation of 20 is provided, the process
will check up to 20 samples before and 20 after the sample in question.
Error Description
Example:
DataLogWrite
This function block writes data recorded by DataLogRecord to a CSV file on the con-
troller.
Library
FileRW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V DataLogPrms DataLoggingStruct Structure containing the parameters for writing the data to a CSV file.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs FALSE
are read and the function is initiated. To modify an
input, change the value and re-trigger the execute
input.
V Abort BOOL Cancel writing data to the file. CommandAborted out- FALSE
put will be true once the function block successfully
aborts.
V FileName STRING The name of the file being written. Typically 'Refer- N/A
ence' or 'Comparison'. Cannot be left blank
V FileLocation FTB_FileLocation Denote whether to store the file in flash/user/data FTB_FileLoca-
(#Flash) or ramdisk/user/data (#Ram). Cannot be left tion#Ram
blank.
V Precision INT The number of decimal places to write (0 - 15). INT#0
Notes
l Three function blocks work together in this solution: DataLogRecord, DataLogWrite, and DataLogCompare.
l Start and Stop the DataLogRecord function in conjunction with an event signifying when the data should be recorded.
This is intended to be a single event, not a series of intermittent events. At some time after DataLogRecord is Valid,
Execute the DataLogWrite function, typically in a slower task than DataLogRecord. Typical usage includes DataLo-
gRecord in a task as fast as the Mechatrolink rate if necessary, DataLogWrite in a 32 to 64 mSec task, and DataLo-
gCompare in a 32 to 64 mSec task.
l These functions use a double buffer technique, swapping from one to other. DataLogRecord accesses one buffer while
DataLogWrite accesses the other. The two activities should never interfere with each other, error will be generated if
there is a timing conflict when trying to switch buffers. If this occurs, it is possible that DataLogWrite must be
executed at a faster interval.
l The comparison algorithm first checks for a match within the offset specified. If the data does not match, then it will
check within the allowed percentage. If still a match cannot be determined, the process repeats by iterating through
the number of samples before and after the equivalent time sample. If a SampleDeviation of 20 is provided, the process
will check up to 20 samples before and 20 after the sample in question.
Error Description
Example:
HC_ReadParameter
This Function Block is an extension of MC_ReadParameter from the PLCopenPlus_2_2a firmware library and reads con-
figuration specific parameters from the appropriate XML configuration file(s). See the table below for the parameters sup-
ported by this function.
Parameters
* Parameter Data Description
type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated.
To modify an input, change the value and re-
trigger the execute input.
B ParameterNumber UINT Hardware Configuration parameter number. UINT#0
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This out-
put is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a
Busy output indicates the function is operating, but not ready to provide Valid inform-
ation. (No Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
Supported Parameters
Name Parameter R/W Default Min Max Comments
PositionScale 999 Write 1.0 1.0 1.0
External Encoder Res- 1047 Read/Write 1.0 10 16777216
olution
Load Type 1807 Read/Write 1.0 0 1 Rotary or lin-
ear
FeedConstant 1808 Read/Write 1.0 0.001 1000000000000
OutputRatio 1815 Read/Write 1.0 1 2147483647
MachineCycle 1833 Read/Write 1.0 0.001 1000000000000
InputRatio 1834 Read/Write 1.0 1 2147483647
User Units 1813 Read/Write 0.0 0 5 0=inches,
1=mm,
um=2,
3=pulses,
4=degrees,
5=revolutions
Notes
l This function block includes some very large datatypes. On the MP2600iec controller, the memory can be exceeded
when including this function. When using an MP2600iec, it may be required to edit the File R/W library's datatype file
by modifying the size of XMLLines: ARRAY[0..9999] OF STRING; to 0..500.
l Another recommendation when using this function is to reuse the same instance if several parameter reads are
required. This will save considerable memory, important for all controller platforms.
l Finally, consider executing this function in the DEFAULT task to avoid the risk of a PLC watchdog, or execute it in a
CYCLE task of 100 mSec.
Error Description
See the Function Block ErrorID list.
HC_WriteParameter
This Function Block is an extension of MC_WriteParameter from the PLCopenPlus_2_2a firmware library and writes con-
figuration specific parameters to the appropriate XML configuration file(s). See the table below for the parameters supported
by this function. Changes to parameters written by this function requires controller power cycle or reboot to take effect.
Parameters
* Parameter Data Description
type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated.
To modify an input, change the value and re-
trigger the execute input.
B ParameterNumber UINT Hardware Configuration parameter number. UINT#0
B Value LREAL Value of the parameter to be updated. LREAL#0.0
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This out-
put is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a
Busy output indicates the function is operating, but not ready to provide Valid inform-
ation. (No Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
or 'Enable' goes low.
Notes
l This function block includes some very large datatypes. On the MP2600iec controller, the memory can be exceeded
when including this function. When using an MP2600iec, it may be required to edit the File R/W library's datatype file
by modifying the size of XMLLines: ARRAY[0..9999] OF STRING; to 0..500.
l Another recommendation when using this function is to reuse the same instance if several parameter writes are
required. This will save considerable memory, important for all controller platforms.
l Finally, consider executing this function in the DEFAULT task to avoid the risk of a PLC watchdog, or execute it in a
CYCLE task of 100 mSec.
Error Description
See the Function Block ErrorID list.
Example
Read_CSV_File
This function block will read CSV (ASCII) data from a file on the controllers flash or ram disk. The raw file data will be parsed
and copied into a user defined data structure. This function block requires customization to accommodate application specific
data requirements. Any variety of rows and columns and datatypes can be specified. Read_CSV_File must be customized to
accommodate the application specific data. See the example customization below.
Library
File RW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V Data MyDataStruct A user customized data structure containing the definition of the rows and columns of
data to be processed.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
V FileName STRING The file to be read. Example STRING#'/- STRING#''
flash/user/data/mydata.csv'
V Separators SeparatorList Optional. If unconnected, the default separator is a comma Comma (BYTE#44)
(BYTE#44) to detect each value column by column. If a dif-
ferent or multiple characters must be treated as a value sep-
arator, populate the SeparatorList with up to four byte
Notes
l Don't forget to include the ProConOS firmware library in the project. It is required for this function block.
l The filename must conform to 8.3 format, but is not case sensitive.
l Any separator can be specified provided it is an ASCII byte, and will not be confused with the actual data.
l Header rows are not required to contain the same number of separators as the data content. (Separators are not
checked in the header rows.)
l It takes 6 scans per processing of each BufferSize of data. If a file has 20480 bytes, and the BufferSize is 2048, and
the function block is placed in a 100mSec scan, then the total time to process the file will be 60 scans, or 6 seconds.
(20480/2048 * 6 * 100) = 6000 mSec.
l See Yaskawa's Youtube Webinar - CSV File Transfer with the File_RW Template.
Error Description
See the Function Block ErrorID list.
1) Copy & paste the MyDataStruct and associated datatypes into the main project, and rename them to avoid conflict with
MyDataStruct in the File_RW_Template.
2) Modify the "MyData" dataType definition shown above such that it represents the number of columns and the relevant data-
types. An example follows:
The 15 columns of data defined above relate to the data shown in the following Excel file. Notice that the data has three header
rows before the actual data begins. In this case, set the HeaderRows function block input correctly at UINT#3, otherwise, the
data will not be read properly.
4) Copy & paste the Read_CSV_File function block into the main project so it can be customized. This will allow you to retain
the original function in the template for future reference. Rename the function to avoid name conflict with Read_CSV_File in
the Toolbox.
5) To customize the function block, go to the variables grid and rename the datatype used as the VAR_IN_OUT to the datatype
you customized in step 2 above (Use the name as modified from ST code line 23 above).
6) Locate the comments near the middle of the Read_CSV_File function indicating the area to be customized. Modify the lines
that convert the STRING data from the file into the MyDataStruct structure.
The function has the capability to read multiple versions of the same file. For example, assume that initially, the design
requires a data file to contain 4 columns of data to be used as INT. Later, after some machines are in the field, a design
change requires that the data file must now contain 5 columns of DINT. If a version code is applied as the first row, the func-
tion block can determine how to read the file for any number of variations. That may come later. This will allow the use of
older data files as well as newer formats.
2. The first line of the data file must contain a version code. The version code does NOT count as a header row. See the
graphics above showing original and modified file specification
Original DataType:
Modified DataType:
3) Customize the Read-CSV_File function block to determine if the version code detected is supported.
Original code:
Modified code:
Original code:
NOTE: The capability of the function block to read multiple file versions is limited by the changes that can be made to the
DataType Definition. It is not practical to use the version code to read completely different data formats. Make two copies of
the Read_CSV_File and customize accordingly.
ReadBuffer
This function block will read an ASCII value from the DataBuffer. It determines where to locate the value by referencing inform-
ation in the DataBuffer. It determines the end of a line by looking for a CR (BYTE#13) or LF (BYTE#10) or both.
Library
File RW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V DataBuffer ByteBufferStruct Structure containing a character buffer and other information for managing parsing
operations.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there
are no errors.
V FileHandle UINT The FileHandle as output from the FILE_ UINT#0
OPEN function block from the ProConOS
firmware library. The file must be opened
before calling ReadBuffer.
V BufferSize UDINT Specify the portion of the file to read dur- UDINT#2048
ing each task interval.
VAR_OUTPUT
B Done BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
Error Description
See the Function Block ErrorID list.
Example
See the Read_CSV_File function block to learn more about how ReadBuffer can be utilized.
ReadLine
This function block will read an ASCII value from the DataBuffer. It determines where to locate the value by referencing inform-
ation in the DataBuffer. It determines the end of a line by looking for a CR (BYTE#13) or LF (BYTE#10) or both.
Library
File RW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V DataBuffer ByteBufferStruct Structure containing a character buffer and other information for managing parsing
operations.
V LineBuffer ByteBufferStruct Structure containing a character buffer and other information for managing parsing
operations. This is a subset of the data in DataBuffer; it will contain one line of data
based on the DataBuffer.CharPointer when the function is executed.
VAR_INPUT Default
B Enable BOOL The function will continue to execute FALSE
every scan while Enable is held high and
there are no errors.
VAR_OUTPUT
E Valid BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V EOL BOOL EOL = End of Line. This bit will be set if one or both of the ASCII characters CR LF
(bytes 13 and 10 Hex) were found while searching for Separators.
Error Description
See the Function Block ErrorID list.
Example
This ST code snippet assumes that the ReadBuffer function block was previously executed, which copied file contents into
DataBuffer.
ReadValue
This function block will read an ASCII value from the DataBuffer. It determines where to locate the value by referencing inform-
ation in the DataBuffer and the Separators VAR_INPUT.
Library
File RW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V DataBuffer ByteBufferStruct Structure containing a character buffer and other information for managing parsing
operations.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V Separators SeparatorList Optional. If unconnected, the default separator is a comma Comma
(BYTE#44) to detect each value column by column. If a different (BYTE#44)
or multiple characters must be treated as a value separator, pop-
ulate the SeparatorList with up to four byte values equating to the
ASCII separators.
V GCodeMode BOOL If set, it causes the function to interpret space characters or a UINT#0
change from numeric to alpha as a delimiter. For example, when
ReadValue is passed a DataBuffer containing "G1X10Y15" it will
return "G1" on the first call, "X10" on the second call, and "Y15"
on the third.
Notes
Error Description
See the Function Block ErrorID list.
Example
This ST code snippet assumes that the ReadBuffer function block was previously executed, which copied file contents into
DataBuffer.
See the Read_CSV_File function block to learn more about how ReadBuffer can be utilized. In that function, "ReadVersion"
and "ReadColumn" are ReadValue function blocks.
Write_CSV_File
This function block will format and write a CSV (ASCII) file to the controllers flash or ram disk. The original data is a user spe-
cified structure. This function block requires customization to accommodate application specific data requirements. Any vari-
ety of rows and columns and datatypes can be customized. See the example customization below.
Library
File RW Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Data MyDataStruct A user customized data structure containing the information (possibly still in binary
format) to be written to a CSV file.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, this function block will prepare to FALSE
engage the RampIn cam profile at the master position spe-
cified in the BlendData structure.
V FileName BOOL The file to be written. Example: STRING#'ram- STRING#''
disk/user/data/mydata.csv'
V Append BOOL This flag indicates whether to delete an existing file and FALSE
create new data, or add to an existing file. If Append-
d=TRUE, data will be appended. Data.MaxRecords must be
Notes
l Do not reference this function block from your project. Follow the customization examples below to make a renamed
copy of it and add it to your project.
l Don't forget to include the ProConOS firmware library in the project. It is required for this function block.
l It is strongly recommended to write files only to the Ramdisk portion of memory, not flash. Ramdisk is a temporary stor-
age location, so the file should be read by another device using an HTTP file get command.
l See Yaskawa's Youtube Webinar - CSV File Transfer with the File_RW Template.
Error Description
See the Function Block ErrorID list.
Customization Example 1
Write_CSV_File must be customized to accommodate your data. Some supporting functions used by Write_CSV_File
(ReadBuffer and ReadValue) do not require customization and can remain in the File_RW_Toolbox. Two locations requiring cus-
tomization are identified in the function block by several rows of comments indicating the need to customize. To effectively
use this function, follow these steps:
2) Modify the "MyData" dataType definition shown above such that it represents the data to be written. An example follows
which shows a customized datatype:
3) Initialize the data required for "MyDataStruct" as shown below. Most importantly, set Columns and MaxRecords. MaxRe-
cords indicates how may lines of data are to be written to the file. In the case of Append mode =TRUE, set MaxRecords to the
number of lines from the MyDataStruct to be appended. Appending always starts from the first line (array element 0) of the
structure and adds data to the end of the file. It is not necessary to initialize (clear) the other data elements beyond MaxRe-
cords that may be from a previous use.
4) Copy & paste the Write_CSV_File function block into your main project so it can be customized. This will allow you to retain
the original function in the template for future reference. Rename the function to avoid name conflict with Write_CSV_File in
the Toolbox. To copy & paste the function block, open a second copy of MotionWorks IEC, and open the File_Read_Write tool-
box as a project. From the second MotionWorks IEC, copy & paste the function block into your project.
5) To customize the function block, go to the variables grid and rename the datatype used as the VAR_IN_OUT to the datatype
you customized in step 2 above (Use the name as modified from ST code line 23 above).
6) Locate the comments near the middle of the Write_CSV_File function indicating the area to be customized. Modify the lines
that convert binary data from the MyDataStruct structure to STRING data for the file.
The function has the capability to write multiple versions of the same structure. For example, a portion of the data from the
structure can be written to one file, and a different set of data can be written to another file.
1) Set the 'Version' function block input to a unique value (Non zero).
Original DataType:
Modified DataType:
3) Customize the Write_CSV_File function block to determine if a specific version if the file should be written.
Original code:
Original code:
Modified code:
Application Example
Set MyBuffer.MaxRecords to the number of items to be written to the file.
To use the Group Toolbox, the main project must also contain the following:
Firmware libraries:
l YMotion
l YCoordinatedMotion
l PROCONOS
l Y_DeviceComm - if using Read_GCode_Stream, or GroupCommManager.
User libraries:
The following User Libraries must be listed above the Group Toolbox and in the following order:
It is strongly recommended to use the latest version of all supporting libraries, even though in some cases older versions are
acceptable.
l DataTypes_Toolbox
l Math_Toolbox
l Yaskawa Toolbox
l PLCopen_Toolbox
l PLCopenPart4
l FileRW Toolbox - if using G-Code function blocks.
l Comm Toolbox - if using Read_GCode_Stream or GroupCommManager.
3) Implementing an MPiec solution for G-Code Applications. Document number AN.MPIEC.27. The link includes a project tem-
plate.
The G-Code operation is divided into two main activities; data processing and motion processing.
Data Processing
This toolbox contains support for reading G-Codes in two different ways; use either the Read_GCode_File or Read_GCode_
Stream function blocks to prepare the data for motion on the mechanism. For the best performance, Yaskawa recommends
executing either of these functions in the DEFAULT task with its Watchdog disabled. See the examples in the function block
pages which demonstrate how to link the two activities (Data Processing and Motion Processing) together. The data link
between the data processing and motion is the MC_PATH_DATA_REF structure.
Data is managed in a circular buffer, meaning the path length can be virtually infinite. The default size of MC_PATH_DATA_REF
is 500 instructions. Contact Yaskawa for applications that may require a larger buffer.
Tool Compensation (G41, G42) is calculated in the data processing section. If a different tool is selected from a source other
than the G-Code data itself (some other PLC code writes to ToolStruct to change the tool), changes will not take effect until
Read_GCode_File or Read_GCode_Stream have processed the data again.
File Method:
G-Code data must be loaded onto the Flash or ramdisk file system of the MPiec controller. This can be accomplished using the
web sever, or if an automated method is required, files can be sent to the MPiec controller using the HTTP FILE POST method.
Click here for C Sharp application notes on www.yaskawa.com for transferring files. Please note that www.yaskawa.com
requires a login to access these documents. Writing files to flash is only recommended if the same part file will be used for an
extended period of time. (Frequent flash writes are not recommended.) Otherwise, consider writing files to ramdisk, or stream
the data via an Ethernet socket.
If the path is small such that the entire contents can fit into MC_PATH_DATA_REF at once, the Path can be re executed over
and over by re executing MC_MovePath. There is no need to re read the data with Read_GCode_File.
The following image is the MPiec controller's web interface showing the "/Flash/User/Data" directory.
This solution requires a PC application program such as Yaskawa Compass to communicate with the MPiec controller.
The Read_GCode_Stream function block will listen for data on the user specified port to receive the incoming byte stream of G-
Code instructions.
When using this method, the MPiec controller sends status information (StreamStruct) via UDP packets back to the PC applic-
ation at 50 mSec intervals. The packet contains position, buffer status data, and other info. Buffer status information is import-
ant for the PC application to throttle the G-Code stream effectively. The data buffers must not be overloaded nor should they be
starved. If the data stops and all motion becomes completed, MC_MovePath will remain Busy, waiting for new commands. This
is a possible under-run condition, or a normal pause between motion sequences that may be intended.
A DLL is available for use when creating a custom PC application. See AN.MPIEC.24 on www.yaskawa.com.
Motion Processing
The MC_MovePath function block executes all motion and other sequence related activities. It is typically executed in a rel-
atively fast task (~4 to 20 mSec), although this is only necessary if discrete input and output data must be read and set in a
critical time period. For applications which require smooth motion with many short segments, more than one motion instruc-
tion can be loaded into the firmware motion buffer during one IEC application task scan. See the MachineStruct for details on
configuring this feature.
G and M codes not recognized by the G-Code solution from Yaskawa can be added to special function blocks in the User project
without modification to the Group Toolbox.
Overview
The overview graphic shows two halves of the G-Code solution divided into left (Processing) and right (Motion.) The colors
Red, Blue and Green depict data flow from G or M Codes to the MotionWorks IEC user application. There are two special func-
tion blocks required to customize the solution. Custom_Code_Processor and Custom_Code_Execute. The help for these blocks
contains detailed instructions for customization. A key point of this customization technique is the ability to add any data struc-
tures necessary to the Custom_Code_Execute function block as VAR EXTERNAL, which gives the solution the ability to link G-
Code instructions and parameters to application specific data which is unique to the equipment. See the examples included for
each of the Custom function blocks.
Customizable Features
l Read / Write values into the MachineStruct.
l Read / Write G-Code 'VarData.'
l Reference the InputFlags.
l Read / Write values into a user defined data structure.
l Wait for specific conditions to be met
Once the data is copied into the user defined data structure, the MotionWorks IEC application has full access to the data and
can be programmed to use the information with the relevant components, such as a SLIO remote I/O, LIO card, third party Eth-
ernet/IP device, etc.
Overview
G-Codes supported by the Group Toolbox can be configured to pass execution of the command to user customizable code
rather than executing code prepared by Yaskawa for a particular feature. A very common override is the T command for a tool
changer. The build in T command simply assigns the new active tool number. If the machine requires the operation of a tool
changer, this motion logic must be created by the OEM.
Overrides are declared by editing the OverrideList function block. Once the Overrides are declared, the process of handling
overrides is nearly identical to the process of adding custom G and M codes. Two special function blocks are required to cus-
tomize the solution. Custom_Code_Processor and Custom_Code_Execute. The help for these blocks contains detailed instruc-
tions for customization. A key point of this customization technique is the ability to add any data structures necessary to the
Custom_Code_Execute function block as VAR EXTERNAL, which gives the solution the ability to link G-Code instructions and
parameters to application specific data which is unique to the equipment. See the examples included for each of the Custom
function blocks.
Customizable Features
l Read / Write values into the MachineStruct.
l Read / Write G-Code 'VarData.'
l Reference the InputFlags.
l Read / Write values into a user defined data structure.
l Wait for specific conditions to be met
Once the data is copied into the user defined data structure, the MotionWorks IEC application has full access to the data and
can be programmed to use the information with the relevant components, such as a SLIO remote I/O, LIO card, third party Eth-
ernet/IP device, etc.
b) Select “Set all outputs off” when PLC stops. This is required for the safe operation of groups.
c) IO Task Assignment - Set the four server blocks to the task in which the pendant driver function block will run.
3) Four Modbus groups will automatically be created in the Global variables worksheet upon saving. Create variables under
the FC16 and FC04 groups with the data types and addresses as shown in the figure below. The variable created in the FC16
group transmits data FROM the pendant TO the MPiec controller. The variable created in the FC04 group sends data FROM the
MPiec TO the pendant.
Note: The FS100 pendant with the Indusoft runtime uses a 7500 register offset from the base address for Holding Registers
and Input Registers. This is to minimize the chances that MotionWorks IEC projects using Modbus TCP for other functionality
in the 4x and 3x memory areas will not conflict with the pendant.
4) Add a variable of type UserApplicationData in the Global variables worksheet. This variable does not require an Address,
but set the 'retained' checkbox.
UserApplicationData can store 20 teach point lists with 50 points in each job, 24 part frames, 24 tools etc.
The Y_GroupInputs block monitors machine safety flags like E-Stop, pendant liveman, guard circuit, safety circuit etc.
Yaskawa recommends that the user supplies these externally managed inputs to the function block such that these flags can
be referenced by various motion function blocks. The Y_GroupInputs function block does not play a part in satisfying the
safety requirements of the machine or group. If external safety devices are not used, the inputs can be left unconnected.
When using the pendant to control a remotely hosted group (MLX, DX, YRC, UC), add the MLX_Driver or MS_Driver
function block (from the relevant user library, see the PLCopenPlus function block help for details.
7)Add the Pendant_Driver function block to the main project. A 50 mSec CYCLIC task is recommended. Connect the variables
described in Steps 3 and 4.
8) When the Pendant_Driver block is enabled, it checks for a heartbeat signal from the pendant. If the heartbeat is updating,
the Valid output is set to TRUE.
9) The second check is to confirm the Group name entered on the pendant matches the Group name of AxesGroup connected
to the function block. If the Group name entered on the pendant matches the AxesGroup's configured name, the GroupSelec-
ted output will be set TRUE. This is the indication that the pendant is ready to operate the Group..
If the group mechanism has a joint which is operated by two or more servos, they must have the exact same commanded pos-
ition before the group can be enabled using MC_GroupEnable.
Group Toolbox includes ReAlignPrimeAxes and GroupReAlignPrimeAxes function blocks which make enabling a group with sec-
ondary axes easier. Functions such as GroupCommManager, Pendant_Driver and GroupToHome execute those function blocks
if necessary to re-align the axes prior to executing MC_GroupEnable. This will prevent error 8966 from occurring.
For the alignment procedure to complete successfully, a Prime Axes Allowance must be specified. There are several ways in
which the functions in Group Toolbox can be applied; the following graphics explain each usage scenario and indicate the
required initialization.
When using the GroupToHome function block in the MotionWorks IEC pro-
ject directly
(Without using GroupComm.DLL or a Pendant)
You must provide a value which represents the maximum safe expected motion the mechanism can tolerate.
The presumption is that the mechanism has previously been physically aligned and all motors operating the
joint have been set to the same position using MC_SetPosition. GroupReAlignPrimeAxes is only intended to per-
form small realignment motion to account for small position changes that may occur when the system is
powered off.
For example, a mechanism has two motors without brakes operating the Z axis. The mechanical rigidity of the system is not
perfect which allows both sides of the axis to settle due to gravity by differing amounts. In this example, assume that the axes
fell out of alignment by approximately 6 user units. In this situation, setting User-
ApplicationData.PrimeAlignment.Tolerance:=LREAL#10.0 will permit the GroupReAlignPrimeAxes function block to move the Z
prime axis to the same commanded position as the main Z axis. If the initial commanded positions differ by more than 10 user
units, error 10138 will be generated. Determine why the axes are so far out of alignment.
It is unsafe to set the PrimeAlignment variable to an arbitrarily large value to get around the ErrorID 10138.
If the commanded positions of each motor differ by an unexpected, significant amount (such as during com-
missioning or after an absolute encoder battery failure), mechanical damage could occur while the axes are
attempting to realign themselves to a mechanically impossible position. Instead, check the system, re-align
the servos and reset the Positions if necessary.
If the group does not contain joints with prime axes, the PrimeAxesTolerance parameter will never be referenced, and no pre-
alignment motion will be attempted.
The default is no emulation mode selected (MyMachine.Emulation:=GTB_Emulation#na). Only a single mode can be selected.
Emulation modes alter the behavior of G-Code solution in the following ways:
Mode1
Feature Behavior
Interpret E register as positive values for acceleration and negative values for decel-
E Register
eration in units/sec2 .
Mode2
Feature Behavior
Feedrates for XY, Z, and rotational motion can be specified separately using axes letters as para-
meters. For example:
F 300 XY
F 50 Z
F
Feedrates will be checked such that the limit for a each axis is not exceeded. For example if the Z
feedrate has been set at 50 units/min, and a command such as G1 X40 Y200 Z12 F600 is
executed, the overall velocity of the command may be reduced to less than 600 if the Z component
of the move would require it to exceed 50.
G53 If executed by with no axes specified, the Z axis will be moved to MachineData.Origin[3].
Home Preset commands can be used with G1. For example G1 H#3 will move the
H
machine to the pre determined location identified as Home #3.
L30 / L31 Commands are recognized and support Tangent mode. See G-Code Support.
Additional spindles can be controlled using the parameter suffix M3.1 or M3.2 and like-
M3 / M4 / M5
wise for the spindle reverse and stop command.
Current Version:
2020-07-19 v372 released. fw 3.7.1 or higher recommended
1) G-Code - GCode_Procesor, Provide constant acceleration for feedrate overrides with a responsiveness of approximately 500
msec. DCR 5328.
2) SyncGroupToGroup / Pendant_Driver FBs - Report SecondaryGroup Power/ Enable status when secondary group is con-
figured in PendantData for better reflection of true machine state at the GUI level. DCR 6467.
3) Add Feature select bits as DWORD to MachineStruct. This allows for turning on/off various things such as constant accel
feedrate override. DCR 5178.
4) G-Code - Added support for G73 and G83 - chip break drilling cycle. DCR 5398.
5) G-Code - Added support for G80 - Cancel modal motion. DCR 1096.
6) Add provision to change an Overridden G-Code command's PostGCode STRING upon completion of the override. DCR 5568.
Changes:
1) G-Code - G0 rapid, if "F" is supplied, use the feedrate provided instead of MachineData.MaxDirectVelocity. DCR 5029.
2) G-Code - Change M104/M109 to not change the selected extruder. DCR 5111.
4) Tool Length compensation (G43) not to be applied until next Z command is included in G-Code. DCR 5698.
6) Don't set Spindle directions to 0 (off) when in MDI (M30 is auto appended, which shuts off spindles). DCR 5531.
Bug Fixes:
1) Pendant_Driver jogging did not use UserData.Config.JogSpeed.Orientation when jogging Rx, Ry, Rz. DCR 5408.
2) Lookahead FB - Change var 'ContiguousMotionSegments' from UINT to UDINT to prevent failure when there are more than
65536 contiguous segments. DCR 5395.
3) Lookahead FB - Fix treatment of long segments when not using application layer feedrate override. DCR 5327.
4) Custom_Code_Execute FB -added an iActive bit so that it can be busy with Enable false.
5) G-Code - G02 Arc went counterclockwise when an arc greater than 180 degrees was specified. DCR 5268.
6) G-Code - Use of registers A B C is now OK when used with a G92 command even if not a -ER controller. DCR 5264.
(7) G-Code - Motion (G1 / G2 / G3) intermixed with custom or overrides was not taking the user setting 'ExactStopCheck-
k=FALSE' to provide custom codes synced with path motion. DCR 5256.
9) Compass Terminal MDI - G92 E0 followed by a G1 E move gives ExtruderOffsetInvalid. DCR 5211.
10) G-Code - Tangent disable G79 and L31 get stuck (tangent axis stuck in Stopping state). This was actually due to a firm-
ware bug introduced in v3.7.0. A workaround solution was applied in this Toolbox as well. DCR 5131.
12) G-Code Variables did not work with S Register. DCR 5011.
13) G-Code - Home Presets (G0 H3) not executing full sequence specification. DCR 4980.
14) ReadJointMap FB - Sometimes reported 10126 (no data) ErrorID after successfully reading XML file. DCR 4216.
15) Lookahead not considering arcs which would exceed centripetal acceleration. DCR 5709.
16) When changing from MCS to PCS or vice versa, update PreviousMotion position to be representative of new Coordinate Sys-
tem. DCR 5704.
17) DetermineFeedrate RotationalOnly move feedrate is not always correct. DCR 5607.
18) G92 E0 commands following a Tool change command (with tool offsets) sets local zero offset on non-specified axis. DCR
5602.
19) Compass may not handle conditional M30 before or at the end of file. DCR 5536.
Previous Versions:
2020-11-30 v371 released. fw 3.7.1 or higher recommended
1) G-Code - Add support for M82 / M83 command - Extruder Only Absolute / Relative Mode. DCR 3254.
2) Add Separate jog speed Z vs. XY as part of Pendant_Driver FB / Compass solution. DCR 3808.
3) G-Code - Add support for G1 H3 (Home Presets) under Mode 2 emulation. DCR 4020.
4) Pendant_Driver / Compass - allow jog keys to jog more than one axis simultaneously. DCR 4067.
5) G-Code - Added support for 'Set Chamber / Enclosure Temperature' codes M141 / M191. DCR 4153.
6) G-Code Processor - Implement Lookahead algorithm that integrates with StreamParser function block. DCR 4361.
7) MachineType = 3D printer can use separate Z velocities when MachineData.Emulation is set to Mode2 emulation. DCR 4388.
8) Pendant_Driver / Compass solution - added option to suppress soft overtravel alarms when jogging. DCR 4486.
9) G-Code - Added support for multiple spindles via M143 / M144 / M145 / M153 / M154 / M155. M3.1/ M5.1 DCR 4633.
10) GroupReAlignPrime Axes FB - Increased support for Multiple prime axes to 6. DCR 4701.
11) PendantData structure - Added status bits to indicate software limits exceeded. DCR 4721.
Changes:
12) Custom_Code_Processor stub FB - Added PrmSuffix as VAR_INPUT. Existing implementations of this function block must
add the new VAR_INPUT to the main project. DCR 4230.
Bug Fixes:
13) G-Code spindle - Make spindle speed go to zero when Feed Hold, system now waits for spindle to resume previous speed
before continuing path. DCR 4277.
14) G-Code - Local zero offsets were not accounting for PCS offsets when using G92 command. DCR 4366.
15) G-Code - T commands could cause CPU exception (invalid array index) if Tool number is out of bounds of the ToolData.Tool
array. DCR 4374.
16) CheckColinearity FB - was errantly assuming Colinearity if the previous segment had ExactStopCheck flag set. DCR 4512.
17) G-Code spindle - If Spindle was on before a Feed Hold, and part canceled during hold, previous spindle speed must be
cleared. DCR 4513.
18) MC_MovePath FB - Velocity & Accel were not limit checked properly - need to consider the feedrate override scaler in
effect. DCR 4518.
20) MC_MovePath - G92 / set PCS / Segment type 17 was not working with MotomanSync groups. DCR 4746.
21) G-Code - Tool height offsets compounded if commands issued with no Z element. DCR 4781.
23) Tool Height offsets were not being properly displayed, retained. DCR 4853.
24) Compass - Extruder positions were not updated until MC_MovePath has been executed. DCR 4681.
25) StramPaser FB - Initialize DataBuffer.BufferRead on FB startup to prevent G-Code lines with multiple bad commands from
causing additional errors. DCR 4925.
26) G0 commands now set to explicitly stop at the end of each segment, there were cases where blending G0 commands may
have been applied.
2) GroupToHome - More efficient / faster by using previously populated JointMap as VAR_IN_OUT. DCR 1914.
3) GroupComm support for PLCi communication mode for Compass Software. DCR 2977.
4) G-Code - Support M190. (Wait for bed temperature to reach target temp.) DCR 2290.
5) PendantDriver did not respond to servo power toggle unless in manual mode. Now OK in Auto or manual when used with
Compass. DCR 2372.
6) PendantDriver / TeachPendant - Added ability for user customizable acceleration rates for jogging. DCR 2472.
7) PlaneMeasurement/GridMeasurement - Change the point from where the offsets are normalized. DCR 2692.
8) G-Code - Added recognition of % character for start of G Code file comment. DCR 2715.
9) MC_MovePath - Limit check velocities and accelerations differently when a MotomanSync robot is used. DCR 2739.
10) 3D-Printing - Extruder Jog now possible when set as an auxiliary axis in the group config. DCR 2901.
12) GridMeasurement - Changed path from "scanning" to "zig zag" to save time. DCR 2976.
15) MC_MovePath - Allow infinite repeat mode when streaming. DCR 3104.
17) G-Code - Support Local Zeros (LZ) via G92. DCR 3186.
18) G-Code - CalcToolComp (G41, G42) reduction in Tolerance strictness. DCR 3256.
19) G-Code - Add support for more than one spindle in MachineStruct. DCR 3261.
20) G-Code - Add support for configuration of G-Code overrides (Macros). DCR 3262.
21) GridControl - Implement new function block to consolidate GridLookup and SyncGroupToGroup. DCR 3273
22) Pendant_Driver - Turn servos off when heartbeat with host is lost. DCR 3410.
23) MC_MovePath - Auto set Colinearity parameter 2111 to 10.0 degrees if left at firmware default. DCR 3414.
24) GroupToHome - Improve logic to handle servos being shut off in the middle of homing. DCR 3455.
26) G-Code - Add support for G43, G44, G49 for Tool Length Offset. DCR 3478.
27) Pendant_Driver - If no name is specified for Tool File, User Frame or Teach Point List file, use a default name. DCR 3484
28) Pendant_Driver - (Compass) Reset Feed Hold when TriggerReset (Reset) is pressed. DCR 3500.
31) GroupReAlignPrimeAxes - Improve support for multi (3) prime joints. DCR 3585.
32) G-Code - Repurpose items in PathStatusStruct to provide GUI with byte offsets for Errors from Processing and MC_
MovePath. DCR 3586.
33) G-Code - Provided way to run G-Code commands (coming from Compass buttons) while in manual mode. DCR 3587.
34) ReadJointMap FB - Increase performance to execute in very fast task w/o causing watchdog. DCR 3631.
35) G-Code - Allow G92 offsets for all axes (Previously only E axis for 3D printer extruder allowed). DCR 3640.
36) G-Code - Added support for inclusion of additional G-Codes before and after a G-Code override is executed. DCR 3663.
37) G-Code - Added support for Tangent knife operation under emulation mode2. DCR 3668.
39) Add support for Mode2 B feedrate for rotational axes. DCR 3867.
Changes:
40) G-Code - Support G53 as described by the G-Code standard. DCR 3260.
41) 3D Printing - Added Definition for number of configured temp sensors to PrinterStruct. DCR 3420.
42) Pendant_Driver / GroupCommManager - Clearing alarms from Compass should be allowed in Auto/Manual/MDI.DCR 3512.
43) G-Code - No longer initialize G-Code registers (GCodeData strcuture) when Read_GCode_Stream / Read_GCodeFile starts
up or when ClearBuffer. DCR 3571.
44) Revert GetGroupDOF FB to rely on AxesGroup info for MotomanSync groups - (SCR 12547 is completed). DCR 3604.
Bug Fixes:
45) M30 failed to stop MC_MovePath from processing additional segments when there were motion segments in the firmware
buffer. DCR 2807.
46) G-Code - Support multiple actionable G-Code segments on a single line. DCR 2489.
47) PlaneMeasurement: Rotational axes spin back to zero (often causing overspeed) when block is executed. DCR 1787.
48) MC_MovePath - Velocity spike if ExactStopCheck = FALSE for segment before StandStill segment. DCR 2124.
50) G-Code - MachineData.Printer.ActiveExtruder did not indicate which extruder is Active. DCR 2292.
51) G-Code - Machinedata.Spindle.RPM did not get updated every time the 'S' G-Code parameter was issued. DCR 2327.
52) ReadJointMap - Information was incorrect if more than one Mechatrolink group was configured. DCR 2500.
53) 3D Printing - The velocity should not change if a M104 or M106 command is executed in the middle of motion commands.
DCR 2557.
54) G-Code - Fix Custom Code execution / path incrementation for scenario like [motion motion motion custom dwell other].
DCR 2688.
55) 3D Printing - Fix Extruder printer extruder offsets so as not to repeatedly add an offset for unspecified axes. DCR 2694.
56) MC_MovePath / LoadPositions FB - UnconfiguredExtruderError caught, but not preventing an array index out of bounds
crash. DCR 2781.
57) MC_MovePath - Spindle had potential for divide by zero exception. DCR 2971.
58) MC_MovePath - Make Spindle commands M3 M4 M5 G97 sync with other motion. DCR 2981.
60) MC_MovePath - InputFlagsRequired was not getting reset after abort/done/error. DCR 3095.
61) Pendant_Driver - ReadPartFrameFile function block only worked once. DCR 3228.
62) GroupStatus - Now EXITs if MC_ReadAxisError is ever Busy to avoid watchdog. DCR 3253.
64) Read_GCode_Stream / Read_GCode_File - ErrorRow output was off by one depending on when Error occured. DCR 3266.
65) G-Code - G2 and G3 commands switching between R and IJK mode not using IJK parameters. DCR 3304.
66) Pendant_Driver - Errors when setting a tool not being caught in error handling. DCR 3322.
67) MC_MovePath - Tangent Axis Pre-alignment Velocity was referencing Rotational Acceleration instead of Velocity. DCR 3569.
68) GroupControl FB / MC_GroupReset was unable to clear group alarms while AxesGroup.Status.Active = TRUE. DCR 3602.
69) 3D Printing / MC_MovePath - Fixed infinite velocity error 8978 when executing a Tool Change. DCR 3653.
70) MC_MovePath / MotomanSync - Motion sequencing froze when also using conveyor tracking. DCR 3665.
71) Support G00 / G01 with no axes as just a mode setting, no motion should occur. DCR 3832.
1) Updated StreamStatus struct and GCodeComm DLL to structure version 20190127. When using Group Toolbox v352 with
GCodeComm.DLL, version 3.4.2.0 of the DLL is required.
2) Updated MachineStruct to new structure version 0120190110.When using Group Toolbox v352 with GroupComm.DLL, ver-
sion 1.0.3.1 of the DLL is required.
3) ExternalExtruderControl - New function block added for controlling an extruder mounted to a MotomanSync robot. DCR
2614.
4) Custom_Code_Processor and Custom_Code_Execute - New function blocks created for custom G & M Codes as user cus-
tomizable FBs. DCR 2073.
5) Custom_Code_Execute - Provide mechanism for custom G & M codes to select execution synchronized with motion that does
not stop. DCR 2355.
6) Support unique Transition modes for each segment rather than just a single setting from MachineStruct.Prms. DCR 2026.
7) GetGroupDOF - Updated FB to support auxiliary axes (support coming in MotionWorks IEC 3.6) DCR 2198.
8) G Code - Improved validation for numeric parameters, and allow special cases like #var assignments to pass. DCR 2243.
9) G Code - Add Special SegmentType for G10 - to change Work Coordinate System Offset. DCR 2247.
10) PendantDriver - Changed to execute MC_GroupDisable when the PowerStateReq request is FALSE. DCR 2255.
12) G Code - M2 / M30 End of Program commands - If more than one, first one encountered in program flow prevails. DCR
2268.
12) MC_MovePath - Added SegmentType to indicate the end of the sequence. DCR 2271. Related to DCR 2268.
13) MC_MovePath - Improve determination of positions to apply that were not specified in the Segment data. DCR 2273.
16) PathStruct.InUse flag - Improvement for CNCWorks Cancel behavior. DCR 2341.
17) G Code -Added support for Block Skip Mode. DCR 2181.
19) MachineStruct to GroupComm DLL - changed MachineData.Torque[] to report all axes torque including prime axes.
(Change MCS labeling.) DCR 2448.
20) StreamStatus to GCodeComm DLL - Added ToGoDistance fields to the StreamStatus structure for use by GUI applications.
DCR 2450. Requires GroupComm DLL version 1.0.3.1.
21) StreamStatus to GCodeComm DLL - Added G and M code Active code status for each G and M code as published in the CNC
Programmer Handbook.
22) GetTorques - New function block added to read the actual torque for all axes in a group including secondary axes.
DCR 2494.
23) Pendant_Driver - MC_GroupSetOverride should only be effective in auto mode. DCR 2217.
25) Read_GCode_Stream no longer sets the Error / ErrorID outputs for unrecognized commands, but still requires
'ClearBuffer' to acknowledge and reset. This improvement means the connection is no longer shut down for bad commands.
DCR 2934.
26) MachineStruct.Printer.Extruder[] - Changed MinTargetTemp to TempTolerance so M109 can support waiting for tem-
perature decrease.
Bug Fixes
27) Variable assignment to registers should be persistent for future blocks / Segments until a constant is given again. DCR
1469.
28) G10 should only update offsets in MachineStruct, G54 ~ 59 actually applies specified offsets. DCR 1604.
29) PlaneMeasurement/GridMeasurement: Checking for ToleranceTooWideError was broken since change of TouchDirection
definition. DCR 1835.
30) MC_MovePath - Reporting error 10623 incorrectly when OperationMode = GT_OperationMode#InfiniteRepeat. DCR 2066.
31) MC_MovePath - If VelocityScaler input = 0, first segment was still executed before Error output. DCR 2115.
32) MC_MovePath - StandStill segments are not counted in ExecutedTotal/ProcessedTotal. DCR 2117.
33) GroupReAlignPrimeAxes - Improved for multiple sets of prime axes in a group. DCR 2161.
34) MC_MovePath - Fix Rotational Move acc/decel limit to properly limit to MyMachine.Prms.MaxRotationalAcceleration. DCR
2162.
35) MC_MovePath - Improved update of ProcesedTotal and ExecutedTotal outputs for non motion segments. DCR 2183.
36) G Code Processing - Expression evaluator not accepting decimal point or the negative of another variable in a variable
assignment. DCR 2185.
37) GetDOFIndex - Rectify issue with GroupToHome / GetDOFIndex. (wrong implementation to find axes in AxesGroup.) DCR
2215.
38) Machine_Driver - Not propagating Errors to be caught by Pendant_Driver / GroupCommDLL. When invoked via
GroupComm DLL, GroupToHome could silently Error. DCR 2216.
39) G Code - Feedrate for Rotational moves must not have ScaleFactor applied. DCR 2223.
40) G Code - IF statements with equal to condition incorrectly sets variable equal to the value being checked. DCR 2224.
41) MC_MovePath - Limit check feedrate based on move type (linear, Rotary, direct) DCR 2226.
43) G Code - G4 with X parameter sets SegmentType 1 (linear move) instead of a dwell. DCR 2259.
44) G Code - Improve IF logic to throw error if jump-to line number not found. DCR 2272.
45) G Code - M109 is not updating specified minimum temperature. DCR 2291.
46) MachineData.Printer.ActiveExtruder did not indicate which extruder is running. DCR 2292.
47) MC_MovePath - Velocity limit checking must take into account the current MC_GroupSetOverride. DCR 2324.
48) G Code - Dont increment PathData.Buffer.StorePointer if there was an Error in the PathStruct Update code. DCR 2348.
49) G Code - CNCWorks MDI mode causes re execution of all segments in PathData each time MDI command is sent. DCR 2365.
50) MC_MovePath - Output labels / ExectutedTotals incorrect in SingleStep mode for non motion segments. DCR 2417.
51) GroupControl - Changed so GroupStatus output does not flicker. DCR 2077.
52) MC_MovePath - Force a delay when setting OutputFlags if SegmentType is a motion type but Group Prm 2201 reports 0.
Maybe motion not started yet, especially for MotoManSync groups. DCR 2080.
53) G Code Processor / Tool Compensation - code refactoring for the v340 release broke Tool Compensation. DCR 2118.
54) MC_Movepath - SetTangent SegmentType not setting Acceleration and Velocity.DCR 2126.
56) GroupCommManager / Pendant_Driver -Servo power could not be toggled in some cases after a communication loss and
recovery. DCR 2372.
57) MC_MovePath - In ExecutionMode=SingleStep, Output Labels / ExecutedTotals were not accurate for non motion seg-
ments. DCR 2417.
58) Read_GCode_File / Read_GCode_Stream - improved checking of string lengths to avoid causing "Error on String Con-
version" Error. DCR 2455
59) Pendant_Driver - change behavior so servos for Mechatrolink group disable if there is a Comm watchdog Error. DCR 2616.
1) GroupCommManager - New function block added to support GroupComm.DLL and CNCWorks PC application.
2) Merged Pendant Toolbox into Group Toolbox, first official release of Pendant features. DCR 1570.
6) 3D Printing - Added support for multiple filament / pellet extruders. DCR 1704.
7) 3D Printing - Added support for M109: Set Extruder Temperature and Wait.
8) MC_PATH_DATA_REF - Added support for stream byte offset referencing. DCR 1299.
9) Read_GCode_Stream - Allow Errors to be reset without dropping socket connection. DCR 1464. DCR 2394.
10) G Code parsing - Added support for G93 - Inverse Time mode. DCR 1609.
11) Pendant Driver - Using Memory map version 3.5.0.7. DCR 1631 / 1953.
13) Pendant_Driver - 'TriggerReset' bit now clears controller, group, and axes alarms if present. DCR 1750.
14) Machine_Driver FB - Added support for Group_To_Home FB via Memory Map interface. DCR 1448.
18) WriteGridFile & ReadGridFile - New Function blocks added. DCR 1745.
20) Added support for G Codes G28, M82 and M84. DCR 1779.
21) Provide method to specify PrimeAllowance for the GroupReAlignPrimeAxes FB inside Pendant_Driver. DCR 1807.
22) GroupReAlignPrimeAxes - more efficient / faster, now uses previously populated JointMap as VAR_IN_OUT. DCR 1908.
Changes:
23) Repurposed *.JOB file output to *.TPL (Teach Point List) DCR 1419.
24) Pendant_Driver - Refactored VAR_IN_OUTs 4 separate structures into one structure (PendantData) DCR 1478.
26) PlaneMeassurement - Output changed to provide MC_CARTESIAN_REF for use with Y_GroupSetFrameOffset. DCR 1873.
27) GroupReAlignPrimesAxes and AlignPrimeAxes renamed to GroupReAlignPrimes etc. in prep for future function. DCR 2034
*)
28) MC_MovePath - Improved JoinMode / PathMode determination for first segment. DCR 1205.
29) MC_MovePath - Improved determination of RotationalOnly Motion for specific CoordinateSystem. DCR 1273.
30) MC_MovePath - MC_MovePath.Abort was causing group to get stuck in Stopping state. DCR 1461.
31) Fixed G Code variable support for Feedrate to apply conversion from per/in to per/sec and scalefactor. DCR 1484.
32) G Code parsing - (CheckColinearity FB) - TangentAngle should never be negative. DCR 1485.
33) Improved CheckColinearity FB to also check for Rotational combinations that would cause blend Errors. DCR 1506.
34) G Code parsing - Fix reporting of FileByteOffset to support resuming jobs in progress. DCR 1545.
35) G Code parsing - G10 should only update offsets in MachineStruct, G54 ~ 59 should only apply specified offsets.
36) Pendant Driver - Fix reading of group name, use ChangeCase and GetGroupName. DCR 1727.
37) MC_MovePath - Rotational velocity was only taken from MachineStruct, ignoring Pathstruct.Segment.Feedrate. DCR 1770.
38) GroupReAlignPrimeAxes - Improved for groups with multiple sets of joints with prime servos. DCR 1793.
39) MC_MovePath - Improved synchronization of outputs to queued motion segments. DCR 1926.
5) GroupControl - Added ability to execute MC_Reset on all axes configured in Group. DCR 1080 / 1090.
6) MC_MovePath - Improved handling of non colinear segments to avoid ErorrID 9000,9001,9002,9003. DCR 1012
7) MC_MovePath - Improved Segment tracking so path outputs can be operated accurately. DCR 1083.
10) Read_GCode_File - Improve scan time stability. Improvements to minimize scan time spikes caused when the function pro-
cesses bytes into the PathStruct. DCR 1222.
11) MachineStruct.EmulationMode - Support for alternate way of setting vel and accel in units/sec.
12) MC_PATH_DATA_REF.StreamStatus - Added support for byte offset referencing for G Code so host can determine the live
motion segment. DCR 1224.
15) G-Code - Added support for mathematical expressions and subprograms. DCR 1240.
Changes:
16) MC_MovePath - Some Outputs changed for clarity. Now label and segment are identified as 'Processed' and 'Executed'.
DCR 1092.
17) MC_MovePath - changed VAR_INPUT VelocityOverride to VelocityScaler to differentiate from new MC_GroupSetOverride
released in firmware v3.4.0. DCR 1238.
Bug Fixes:
19) G-Code processing - Bug fix in ColinearityCheck for Line to Arc, Arc to Line cases. DCR 1283.
20) G-Code - Processing of I,J,K registers for circle definition was not being properly scaled if required. DCR 1305.
21 G-Code G04 was interpreting the P parameter in seconds but the G Code RS 274 specification indicates milliseconds. Now
the P parameter is milliseconds, and the X parameter can be used to specify seconds. DCR 1382.
G Code Support
G-Codes
Command Description Support Comment
G00 Rapid positioning. Yes G0 moves reference MachineData.Prms.MaxDirectVelocity,
MachineData.Prms.DirectAcceleration, and MachineData.Prm-
s.DirectDeceleration. If the F register is supplied on the same
line as the G0, F will be used instead of MaxDirectVelocity
unless it exceeds MaxDirectVelocity.
G01 Linear interpolation Yes G1 G2 G3 moves reference the F register for feedrate. If the F
register is zero, then MachineData.Prms.MaxVelocity is
applied. MachineData.Prms.Acceleration and MachineData.Prm-
s.Deceleration are also referenced.
G02 CW circular interpolation Yes Provide R for radius mode or I,J,K for circle center mode.
G03 CCW circular interpolation Yes Provide R for radius mode or I,J,K for circle center mode.
G04 Dwell Yes Provide the dwell time as milliseconds with the P parameter or
as seconds with X.
G05 High-precision contour con- No Uses a deep look-ahead buffer and simulation processing to
trol (HPCC). provide better axis movement acceleration and deceleration
during contour milling.
G06 Non uniform rational B No Uses a deep look-ahead buffer and simulation processing to
Spline machining. provide better axis movement acceleration and deceleration
during contour milling.
G07 Imaginary axis designation No Uses a deep look-ahead buffer and simulation processing to
provide better axis movement acceleration and deceleration
during contour milling.
G09 Exact Stop, non-modal. Yes Forces the move to come to a complete stop rather than blend-
ing with the next move if there is another motion command fol-
lowing. Modal version is G61.
G10 Select work coordinate and No Not supported.
tool offsets.
Parameters
Command Description Support Comment
A Absolute or incremental pos- No This is a Rotational position. (Rx) Actual implementation
ition of A axis (rotational axis handled in firmware based on Hardware Configuration sup-
around X axis) port for selected mechanisms, or must implement custom kin-
ematics in the application layer of the MotionWorks IEC
project.
B Absolute or incremental pos- No This is a Rotational position. (Ry) Actual implementation
ition of B axis (rotational axis handled in firmware based on Hardware Configuration sup-
around Y axis) port for selected mechanisms, or must implement custom kin-
ematics in the application layer of the MotionWorks IEC
project.
C Absolute or incremental pos- Yes This is a Rotational position. (Rz) Actual implementation
ition of C axis (rotational axis handled in firmware based on Hardware Configuration sup-
l When using logical statements (M98 or IF command), the entire G-Code file contents must be loaded into MyPath.Seg-
ment[]. The MyPath.Buffer.Overwritten flag must not have been set TRUE by the G-Code Processor. This is because the
function blocks can only reference data already processed and in the PLC memory area; they cannot search for data in
the G-Code file on the controller flash file system, and if the file is being streamed, they have no way to randomly
access data which may already be overwritten by the circular buffer, or may not have been sent to the MPiec controller
yet.
l Only simple assignments are supported. No nested parenthesis or math equations involving more than one operator
are supported.
l Nested subroutines can be called with a maximum depth of 16, otherwise MC_MovePath will output the ErrorID 10626
- Stack Overflow.
l Up to 255 variables assignments or expressions can exist in one G-Code file.
Link to video
3D Printing
A 3D Printer Template project and documentation is available on www.yaskawa.com. Search for '3D printer' or document num-
ber AN.MPIEC.27.
Configure the extruder [E0] as the Rz axis. Also consider the FeedConstant value for the Extruder on the Configuration tab for
the Extruder axis. The user units for the Extruders must be the same as for the Cartesian (XYZ) axes. Two additional
Extruders can also be configured. See the Extruder Mapping Chart that follows.
Configure the Extruders as additional axes to a 3D or nD gantry. This is the preferred method, although the older method is
still supported and there is no need to change an existing configuration when upgrading. Extruders configured as additional
axes can be observed in AxesGroup.Machine[7] [8] and [9] or AxesGroup.Part[7] [8] and [9].
Additional
E1 T1 Ry Ry or Add Axis
Extruder
Additional
E2 T2 Rx Rx or Add Axis
Extruder
MyMachine.MachineType:=GTB_MachineType#Printer;
There are several other initializations which should be considered. See the Application Note AN.MPIEC.27.
Tangent Mode
As it applies to a G Code solution, Tangent mode operates a theta axis tangent to the path and can be activated / deactivated
using specially designated G codes G78 and G79, or if using Emulation Mode2, L30 and L31.
Important: Configure the Theta axis' LoadType as rotary (prm 1807 above) otherwise it will generate function block ErrorID
61713 when moved.
Add secondary axes as necessary. The tangent axis is operated externally to the group; do not include it in the Group con-
figuration.
In the AxesGroup variable, determine the next available array index beyond the basic group axes and manually add Theta's
information. In this example, the GantryDemo group has 4 servos, so the fifth array index is populated with Thetas Axis_Ref.
Although the Theta axis is not officially part of the Group, by manually adding Theta's AXIS_REF to the AxesGroup.AxisRef
structure as shown below on line 5, the Y_GroupPower / GroupControl function blocks will also power on / off the Theta axis.
The functions that manage servo power iterate through the list until finding an invalid AXIS_REF (zero value).
The absolute positions of the Theta are based on the 'unit circle' concept. When looking down at the workspace, with X positive
to the right, and Y positive upward, the positions around the unit circle start where 0 degrees = the 3 O’clock position, and
increase counterclockwise.
Spindle Support
Up to three spindles can be operated via the standard commands M3, M4, M5 and the S register. There is minimal built-in sup-
port for spindles in the Group Toolbox. Support is limited to recognizing the spindle commands, and managing data in
MachineData.Spindle[] structure. The user must add the necessary PLC code to the project to operate spindles based on this
information.
Note: The system will wait for acknowledgment from the user indicating that it's OK to move on with G-Code execution after
executing M3, M4, M5 commands. See the structure element MachineData.Spindle[n].AtSpeed. This BOOL must be set high
after an M3 or M4 when it's OK to continue on with G-Code execution, and after an M5, it must be set low when it's OK to con-
tinue executing G-Codes. See an example for managing the AtSpeed status flag below.
Example
Managing the MachineData.Spindle[].AtSpeed status flag.
This is a sub structure of MC_PATH_DATA_REF which contains data about the circular buffer of Segments. Most of this data is
managed for internal use by the blocks which load and consume Segment information (Read_GCode_File , Read_GCode_
Stream, MC_MovePath)
The G-Code function blocks manage and use this data without any intervention required by the application program, but this
information may be useful to view in the Watch Window when debugging. The ExecutedSegment variable listed below is par-
ticularly useful when creating an error recovery sequence because it indicates the last Segment Executed when an Error
occurred.
GCodeStruct contains internal working information used by the G Code Processor and is made available as a VAR_IN_OUT by
Read_GCode_File and Read_GCode_Stream mainly for debugging purposes. There are four main sub structures:
If using G code data with variables, connect the same structure to MC_MovePath. For example MyGCodeStruct.Variables.
For use with the GridMeasurement, WriteGridFile, ReadGridFile, and GridLookup function blocks. The data in this structure is
either copied from the GridSetupStruct or populated by the GridMeasurement function block.
Example Initialization
GroupHomeStruct contains all the setup information required for the GroupToHome function block to move the group to a
home position in a specified sequence (if required.) This structure is also used with the GroupCommManager function block
because it can execute GroupToHome.
This is the main structure used with the GroupToHome function block.
Supporting structure
Supporting structure
This example homes a three axis gantry by first raising the Z upward to 12mm , then moving the X & Y axes to their home pos-
itions.
MyMachine is a MachineStruct, shown here for the initialization of the Origin, used by the HomeData.
HomeData is a GroupHomeStruct.
In this example, MyMachine is a MachineStruct, it's values are not shown, but MyMachine.Origin[d] can be any valid positions.
Lines 81 through 84 serve as constants, indicating that there are four home methods configured.
The primary method is "HomeAll" as seen in lines 86 through 102. The sequence is the same as the example for
GroupHomeStruct.
The remainder of the initialization shows the specific variations required to create the other three methods, which are all based
on the HomeAll method. The following initialization makes it possible for homing all axes or individual axes.
Data Type:JointMap
The JointMap is populated by the ReadJointMap and DetectPrimeAxes function blocks. Other functions such as GroupReA-
lignPrimeAxes and GroupToHome require this data. JointMap provides a link between the Axis specific information such as
AXIS_REF and AxisName and Group specific information such as Joint and Label. Functions using JointMap are able to determ-
ine if a group has more than one axis operating a Joint, and find the AXIS_REF for an axis operating one of the Degrees of Free-
dom labeled as a STRING such as 'X'.
A sub structure of MC_PATH_DATA_REF which contains data for managing paths with looping or jumping events.
NOTE: Starting in Group Toolbox v361, the communication method in GroupComm DLL was changed to provide more flexibility
to avoid compatibility issues when features are changed or added. MachineStruct0120190110 was the final structure used
with the original communication protocol as supported by the components shown in the chart below. Group Toolbox v361 still
supports the previous communication method. The toolbox will convert the modern structure definition to the older version so
that the GroupComm DLLs shown below can still communicate.
MachineStruct contains important configuration and other application specific data used by MC_MovePath, Read_GCode_File,
Read_GCode_Stream. This structure is shared with a PC application such as CNCWorks or Compass via the GroupComm DLL.
Version information
Version information is relevant if using GroupCommManager and GroupComm.DLL to operate the machine via PC software.
Compatibility
Example Initialization
Data structure used with the Read_GCode_File, Read_GCode_Stream, CP_PathGenerator, and MC_MovePath function blocks .
HC_ReadParameter is located in the FileRW_Toolbox. It is important to set MyPath.HC_UserUnits so the function blocks can con-
vert G-Code position correctly if the units are not the same as the Group Configuration. Alternatively to using HC_ReadPara-
meter, simply write the proper value to MYPath.HC_UserUnits if it is certain that the Group configuration is always performed
the same way on all equipment.
Sub struct of MachineStruct which holds configuration data used in MC_MovePath, Read_GCode_File, and Read_GCode_
Stream.
If the FeedRate is not specified for a PathData.Segment, the MC_MovePath function block will default to using the appropriate
maximum velocity from the MachineStruct.Prms.
Note that even if the same units are provided in the G Code data, (say millimeters) there is still a difference to be accounted
for. Native units on the MPiec controller are mm/sec for velocity, mm/sec 2 for acceleration. Native G Code convention specifies
feedrate in mm/minute. Take this difference into account when configuring the Maximums in the MachineStruct.
Example
This data is typically initialized in a Warm Start system task.
Sub structure of the MachineStruct which holds data related to the work coordinate offsets. When a G10 command is pro-
cessed, the Read_GCode_File or Read_GCode_Stream function block will populate the appropriate Offset with the data
received. Alternatively, Offset data can be loaded from any other source, such as a host PC or HMI. When a G Code G54
through G59.3 is received, the subsequent position commands will be offset accordingly.
Important: All data in the MachineStruct are in the user units of the configured group. For example, if the G Code data sent to
the MPiec is in inches (G20), but the group mechanism is configured for millimeters, the Work Coordinate Offsets MUST be
entered in millimeters. When G code G10 is received the G Code processor will convert the offset values to teh proper units for
the MachineStruct if necessary.
For use with the Pendant_Driver and GroupCommManager function blocks. The major structure 'PendantDataStruct' contains
two sub structures which each contain two sub structures to categorize the data:
Contains information for 3D printing applications, including externally operated devices, such as heaters, and fans. The func-
tions in the Group Toolbox do not directly manage temperature and fan control features. Support for these features must be
added to the MotionWorks IEC application based on the machines specific hardware. The Read_GCode_File and Read_GCode_
Stream function block will recognize various M Codes for temperature and fan and copy the parameter values into the Print-
erStruct for the MotionWorks IEC project to reference.
ExtruderData
Starting in v350, there is an array of ExtruderData to support machines with multiple extruder heads.
In the following chart, the left column indicating 'U'ser or 'C'ontroller - Controller indicates that the MC_MovePath function
block manages the value.
A supporting structure for MC_PATH_DATA_REF. This is an array of SegmentDetails, each of which contains the necessary
information for the Segment based on the SegmentType. This list of elements in this structure is comprehensive; note that ele-
ments are only used for specific SegmentTypes as detailed below.
Not all elements are used for each SegmentType. The SegmentType element dictates the data which will be referenced for a
given Segment[]. The following chart outlines the relationship between SegmentType and its relevant information.
Example 1
If designing a custom path generating algorithm, if is useful to know which elements of the PathData.Segment[] are applicable
based on the SegmentType specified. Refer to the following chart for usage by MC_MovePath.
This structure is used by MC_MovePath to track buffered motion segments. It is necessary to control the OutputFlags in syn-
chronization with the motion specified. Motion Segments may be executed some time before they are actually causing motion
based on the number of motion blocks buffered.
This is a substructure within MC_PATH_DATA_REF. It holds data for reporting to a host application via Ethernet. A DLL is avail-
able which will connect to the MPiec controller running the Read_GCode_Stream function block and receive this StreamStatus
information. Search for AN.MPIEC.24 on www.yaskawa.com.
The first four bytes of the structure always contains the version number of the structure.
Version information
Compatibility
Group
Release Date GCodeComm.DLL UDP Packet
Toolbox
PathStatusStruct
* Element Data Type Description Usage
FBStatusStruct
* Element Data Type Description Usage
MyPath.StreamStatus.FB.ReadStre- ReadGCodeStreamStat-
am us
C ErrorID UINT The ErrorID repor- MyPath.StreamStatus.FB.ErrorID
ted by the Read_
GCode_Stream
function block.
C ErrorRow UDINT If applicable, the MyPath.StreamStatus.FB.ErrorRow
line number from
the G-Code data
which cor-
ToolData is typically populated by the application program via an HMI or other source. Holds tool data
for use with any compensation (G41, G42, G43, G44) G Code commands. ToolDataStruct contains an array of 21 Tools. There
is support for G Code data to be provided in alternate user units (G20 = inches, G21 = mm) - the ToolDataStruct values will be
converted to the user unit configuration of the group before Tool Compensation is applied.
ConfigStruct
JogSpeedStruct
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to zero, the second to 1, etc. The format for enumerated types is as follows: ENUM:(0, 1, 2...) as displayed in the
example below (MC_BufferMode#Aborting).
Custom_Code_Execute
This is a special function block which must be copied and pasted from the Group Toolbox to the Logical POU tree of the main
project for customization. Its purpose is to execute custom G or M code actions required by the user application that are not
supported by the Group Toolbox. Do not include this function in any main project POU. It will automatically be called by MC_
MovePath as necessary when unsupported commands are encountered.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V MachineData MachineStruct Contains parameters such as maximum velocities and accelerations,
and support for 3D printers and tangent axes if required. Also
included are Origin (Home) and Part Coordinate System offsets.
V ThisSegment SegmentDetails Structure of data that holds information for an individual Segment
of information along the path.
V VarData VariableArray An array of LREAL data which can be used with G Code applications
where registers contain variable data. The variable ThisSegment
contains an element named VarFlags. VarFlags is a DWORD where
each bit indicates if a variable was provided for a specific G Code
register. A=bit 0, B=bit 1, C=bit 2, etc. If the application will not
require the use of variables, it is not important that this variable be
Notes
l See the recommended procedures and example in the help for Custom_Code_Processor.
Procedure
1) Create a User Defined Data Type in the main project. This structure design is based completely on the needs and complexity
required of the application.
2) Create a Global variable of this new User Defined Type. The variable can have any name desired.
3) Right click on the variables grid of Custom_Code_Execute and add this variable as VAR_EXTERNAL. This data structure is
not required by Custom_Code_Processor.
It is now possible to transfer data to/from the G and M Codes to the Application specific data structure, where they can be fur-
ther processed.
Error Description
See the Function Block ErrorID list.
Custom_Code_Processor
This is a special function block which must be copied and pasted from the Group Toolbox to the Logical POU tree of the main
project for customization. Its purpose is to process overrides or custom G or M codes required by the user application that are
not supported by the Group Toolbox. It must have the exact name as shown: "Custom_Code_Processor."
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V GCodeData GCodeStruct Working data set used by the G Code Processor. It is made available
as a VAR_IN_OUT mainly for debugging purposes. For applications
using variables for register values, this GCodeData.Variables sub
structure must be connected to the VAR_IN_OUT "VarData" of MC_
MovePath.
V ThisSegment SegmentDetails Structure of data that holds information for an individual Segment of
information along the path. A sub structure within PathData.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
the function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Any motion commands surrounding the custom code will be not be stopped. For example, an analog or digital output must be
synchronized with motion. The custom code will be placed in a monitoring queue to be executed when the motion path (which
is likely buffered) actually crosses the preceding coordinate position. In this scenario, Custom_Code_Execute (for the custom
code in question) cannot be configured with OKToIncrement logic to control program flow. OkToIncrement will be ignored
when ExactStopCheck=FALSE.
The custom code will wait for any preceding Motion commands to stop before executing. In this scenario, Custom_Code_
Execute can be customized to allow the program flow (and motion) to continue only after any required conditions have been
met. For example, if a heater or pressure reading must be within a required value to proceed. See the OKToIncrement cus-
tomization below in Example #1, line 10.
Error Description
See the Function Block ErrorID list.
Examples
#1 - Setting a BOOL value to the MPiec Controller
Assume a custom M code command "M742" is required to set a BOOL value, and M743 to clear the same BOOL.
Simply add the custom codes to the CASE statement as shown on line 28. This identifies the codes as recognized by system,
and prevents the CASE ELSE condition from setting the "UnsupportedMCode" Error condition.
Simply add the code as shown on lines 21 and 22. The variable CustomMCode will have the value of 742 or 743 when the CASE
statement is executed, and can be used in the logic as shown to set or clear a BOOL variable in a user defined structure ref-
erenced in this function as VAR EXTERNAL.
Additionally, choose a program location in the project to link MyAppData.MyBOOL to the relevant device. Consider other logic
which may be required to safely operate the device under all machine conditions. Yaskawa recommends adding only the min-
imum code to link custom Codes to User structures within the Custom_Code_Execute function and adding additional interlock
logic externally.
#2 - Write an analog or multiple analog values to a custom user structure on the MPiec
Controller.
Assume a custom G code command "G392" is required to set several values, specified in the H, I, J, and Q registers.
The variable 'ThisSegment' is one of the SegmentDetails in an array of SegmentDetails in the PathData structure. 'ThisSeg-
ment' is exclusive to this custom code, so any data element in 'ThisSegment' can be used without interfering with other pro-
cessing in the Group Toolbox. This example shows usage of the Generic LREAL elements provided, and the FeedRate variable,
even though the value transferred here may have nothing to do with FeedRate. When implementing custom codes, its only
important to link the same data in both function blocks, and consider the datatype.
Once the parameter values are loaded into the MyAppData, use the information in other parts of the project to write the values
to the Widget as necessary. Yaskawa recommends keeping the customization code in this block to a minimum, and adding any
other necessary logic externally.
Assume that custom G code command M406 indicates the machine must wait until a temperature has reached or exceeded a
set point before continuing. In this example, assume MyAppData.TempSetting has been previously set using another custom
code or other method.
Simply add the custom code to the CASE statement as shown on line 34. This identifies the codes as recognized by system,
and prevents the CASE ELSE condition from setting the "UnsupportedMCode" Error condition. Three is nothing else to do in the
Custom_Code_Processor function. Optionally, the set point could be sent with the custom G Code as a parameter. In that case,
copy the TempSetting into ThisSegment.GenericLREAL[0] similar to the example shown on line 16.
Add the code as shown in lines 27 and 28. Use the OKToIncrement BOOL variable which is returned to MC_MovePath. Setting
this variable according to the comparison of the two values allows MC_MovePath to know when it's OK to proceed.
The ID assigned in the OverrideList function block is added to the base SegmentType of 3000 indicating an override. The ori-
ginal ID can be obtained by subtracting 3000 for the ease of programming (See line 45.) Very little code is required in Cus-
tom_Code_Procesor, sometimes no code other than to list the ID in the CASE statement to prevent the ELSE condition from
returning an Error.
DetectPrimeAxes
This function block searches the AxesGroup structure and the JointMap to determine if any joints are configured with addi-
tional axes. It is useful for operating other functions in Group Toolbox such as GroupToHome and GroupReAlignPrimeAxes.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V JointMap JointMap Structure of data that holds information for Joint Index, Label,
AxisName and AXIS_REF.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Notes
l This block only supports Mechatrolink groups, not remote hosted robots via MotomanSync.
Error Description
This function block will not generate any errors, even if the AxesGroup is invalid.
Example
This example shows how GetPrimeAxes is used inside the Pendant_Driver function block.
GridLookup
For a 3D motion space with an uneven plane, this function block provides the offset required given the current Coordinate over
the plane. Its Offset output is intended to be used with Y_DirectControl and other logic to account for the uneven surface.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V GridResults GridResultsStruct Structure previously populated by the GridMeasurement function
block containing the offsets and other grid measurement information.
V Coordinate VECTOR The current location of the other two axes in the group where the off-
set is required. Typically AxesGroup.Machine.ActualPos can be con-
nected to this input, but only of X & Y are the intended input
coordinates, and Z requires an Offset. Otherwise, supply Coordinate
[1] and [2] positions that correspond to the axes which moved over
the plane requiring Offset correction.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
Notes
l This block will generate an error if the initial Coordinate provided is not within the region specified in GridResults, but if
the Coordinate goes out of bounds afterward, the Offset will remain frozen until the Coordinate becomes in bounds
again.
l This function uses bilinear interpolation to calculate the Offset.
l Execute this function in a task at the same update interval as the Mechatrolink network. Check the Group configuration.
Confirm that the IO variable for the AxesGroup is updated at a same interval as the Mechatrolink network.
Error Description
See the Function Block ErrorID list.
Example
GridMeasurement
This function block moves a group to measure a grid / plane surface by touching the grid surface at an array of locations. The
recorded GridResults can then be written to a file using WriteGridFile / ReadGridFile, and ultimately used to provide on the fly
offset compensation using GridLookup in conjunction with Y_DirectControl.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V GridSetup GridSetupStruct Structure of data that provides information for measuring the spe-
cified plane.
V GridResults GridResultsStruct Contains the measurement information which can be written to a
file and referenced with the GridLookup function block.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs FALSE
are read and the function is initiated. To modify an
input, change the value and re-trigger the execute
input.
Notes
l This block will detect if joint has a secondary servo(s), and monitor the torque of all servos configured when moving
the joint to the touch positions. The first motor to indicate a torque limit will cause motion to stop and the measurement
to be taken. A maximum of three servos operating the joint (as secondary axes) are supported.
l The only mode supported is "measurement by torque limited contact with the surface." The other modes are reserved
for future enhancement.
l See related function blocks: WriteGridFile, ReadGridFile, GridLookup.
Error Description
See the Function Block ErrorID list.
Example
Initialization:
GroupReAlignPrimeAxes
This function block searches the AxesGroup structure to determine if any joints are configured with additional prime axes. If
all the motors operating a joint are already within the PrimeAllowance, the prime motors are moved to the same commanded
position as the main motor. It is useful to prepare a group for MC_GroupEnable and prevent that function from generating the
ErrorID 8966.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V JointMap JointMap Structure of data that holds information for Joint Index, Label,
AxisName and AXIS_REF.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
B Velocity LREAL Absolute value of the velocity in user units/second. LREAL#0.0
Notes
l This block only supports Mechatrolink groups, not remote hosted robots via MotomanSync.
l The Group's servo power must be applied before executing this block. (Y_GroupPower, or GroupControl.EnablePower)
l PrimeAllowance must not be set to a large value, which could cause damage to the machine! It is assumed that the
motors were previously aligned and positions were set properly. This function block is only to be used to perform minor
realignment motion such that all motors on each joint are at the exact same commanded position in preparation for exe-
cution of MC_GroupEnable.
Error Description
See the Function Block ErrorID list.
Example #1
1) MC_GroupDisable
2) Y_GroupPower
3) GroupReAlignPrimeAxes (HasPrime BOOL was set by executing DetectPrimeAxes. See its example.
4) MC_GroupEnable (Should now be successful because all secondary axes have same commanded position as main.)
GroupCommManager
This function block provides a communication interface to GroupComm.DLL to provide support for group operations to PC soft-
ware such as CNCWorks. It contains the Pendant_Driver function block, and supports data transfer of other structures such
as MachineStruct and GCodeRegisters.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains
several additional substructures pertaining to the
group.
V HostData PendantDataStruct Contains the data which is shared with the host via
GroupComm.DLL.
V MachineData MachineStruct Contains parameters such as maximum velocities and
accelerations, and support for 3D printers and tan-
gent axes if required. Also included are Origin
Notes
l This block was designed for use with a PC software interface such as CNCWorks using GroupComm.DLL.
l Yaskawa recommends executing this function block in a 50 mSec task. This has been determined as an ideal update
interval for adequate response to jog button presses, and other user controls.
l See the Getting Started with Secondary Axes section.
Error Description
See the Function Block ErrorID list.
Example
Refer to the document AN.MPIEC.27 on www.yaskawa.com for an Application Note and template project describing how this
function block is used in the context of a 3D printing solution.
GroupStatus
This function block monitors all alarms from various areas of the system which could affect group operation. It is used within
the GroupControl function block.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
Notes:
l If ErrorClass = 16#3504 (13572 decimal ) then the source of the error is the MLX200. Refer to the MLX AlarmID List
for MLX200 GroupErrorIDs.
l If ErrorClass = 16#3302, 16#3303, 16#4302, or 16#4403, then the source of the error (alarm) is the ServoPack.
Sigma alarms are documented in the Sigma Series user manuals. Please refer to the following manuals for details
regarding servo amplifier errors to look up the alarm code shown at AxisErrorID output:
l Sigma-7 Mechatrolink-III: SIEPS8000128, see Section 12.2
l Sigma-5 Mechatrolink-III with rotary motor: SIEPS8000064, see Section 9.1
l Sigma-5 Mechatrolink-III with linear motor: SIEPS8000065, see Section 8.1
l Sigma-5 Mechatrolink-II with rotary motor: SIEPS8000046, see Section 9.1
l Sigma-5 Mechatrolink-II with linear motor: SIEPS8000048, see Section 8.1
l If ErrorClass is some value other than 16#3302, 16#3303, 16#3504, 16#4302, or 16#4403, the source of the error
is on the MPiec controller side. Refer to the Controller Alarm ID List.
l There is no distinction between Alarms and Errors; they have the same meaning.
Error Description
See the Function Block ErrorID list.
GroupControl
This function block operates and monitors several PLCopen Part 4 group related functions including MC_GroupEnable, MC_
GroupDisable, MC_GroupReadError, MC_GroupReset, Y_GroupPower and other functions such as Y_ReadAlarms, Y_
ClearAlarm.
Library
Group Toolbox
Error Description
See the Function Block ErrorID list.
Example
This example shows an error condition when the group has two axes which operate the same joint (Y axis) on a gantry. The
commanded position of both axes must be identical before the group can be enabled, otherwise, the alarm condition shown
below will result.
GroupToHome
This function block moves a group to its home location in the Coordinate system specified in a sequence specified in
GroupHomeData. Prepare GroupHomeData to indicate the required sequence of operation for safe motion to the home position
to avoid obstacles, if required, as well as the home position. This function does not locate home switches or overtravels, it
assumes that the system has been previously calibrated or homed, and returns to the positions configured in GroupHomeData.
It is intended for use with Absolute Encoders. It can also be used with systems that home to sensors, but that operation is not
included here, and must be previously executed before GroupToHome can be used.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several additional
substructures pertaining to the group.
V GroupHomeData GroupHomeStruct Structure of data that holds information for how the group will be
moved to its home (Origin).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated.
To modify an input, change the value and re-
trigger the execute input.
E CoordSystem MC_Coordin- Enumeration with the following values: 0 = MC_Coordin-
ateSystem ACS, 1 = MCS, 2 = PCS, 3 = TCS, 4 = WCS, 5 ateSystem#ACS
= TPCS.
MC_CoordinateSystem#ACS
Notes
l This block will detect joints that have secondary (prime) servos, and will pre align the servos sharing a load prior to
starting the home sequence. If pre alignment must be performed, this block will execute MC_GroupDisable, GroupReA-
lignPrimeAxes, and MC_GroupEnable prior to starting the home sequence.
l See the Getting Started with Secondary Axes section.
l There will be a slight delay until motion starts after executing this function as it determines if there are any joints with
prime axes to realign prior to Executing MC_GroupEnable.
Error Description
See the Function Block ErrorID list.
Example
This example homes a three axis gantry by first raising the Z upward to 12mm , then moving the X & Y axes to their home pos-
itions.
MC_MovePath
This function block reads the information in the PathData struct and performs the required actions such as interpolated
motion, waiting for inputs, setting outputs, etc. The PathData struct is typically populated by various sources, such as Read_
GCode_File and Read_GCode_Stream, although it is not required that G Code be used to populate MC_PATH_DATA_REF. Cus-
tom path generators can also be created.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several additional
substructures pertaining to the group.
V MachineData MachineStruct Contains parameters such as maximum velocities and accelerations, and
support for 3D printers and tangent axes if required. Also included are
Origin (Home) and Part Coordinate System offsets.
G Code Support:
l Work Coordinate Offsets G54 through G59.3 are stored in the MachineStruct.CoordinateSystem.Offset. The offsets can
be updated by the application program via an HMI or PC, or from the G Code data itself via the G10 command.
l Tool Compensation: T0 ~ T20, G40, G41, G42. Tool data must be loaded in the ToolStruct before executing Read_
GCode_File or Read_GCode_Stream. Select a tool using the T command.
Error Description
See the Function Block ErrorID list.
NOTE! If hard coding a sequence, starting in v350, the AxesFlags DWORD must be set to indicate the coordinates that are
being specified for each segment.
Pendant_Driver
The Pendant_Driver function block provides a communication link to a pendant (or PC application via GroupComm.DLL) to per-
form group related operations. The Pendant_Driver supports operations such as jogging, teaching, part frame definition, tool
data definition, saving and recalling taught data, etc. Feedback and status data are sent to a pendant via the InputRegisterData
structure. Teach point data and part frames are accessible via the UserApplicationData structure.
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V PendantData PendantDataStruct Structure that holds taught data like job points, part frame
coordinates, tool data, interference zone definitions etc. This data
is shared between the Pendant and the IEC Application program.
V UserApplicationData UserApplicationData Structure that holds taught data like job points, part frame
coordinates, tool data, interference zone definitions etc. This data
is shared between the Pendant and the IEC Application program.
V HoldingRegisterData HoldingRegisters_ Structure of read/write data which primarily contains commands
ByteArray sent from a pendant to the MPiec controller. The elements of this
structure are used to perform group tasks like jogging, teaching
etc.
V InputRegisterData InputRegisters_ Structure of read data which contains feedback and status inform-
ByteArray ation about the group.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs
Notes
l This function block generates two types of Errors. Logical errors (such as wrong control mode or group not enabled)
are displayed on the pendant or host and are not reported at the VAR_OUTPUT of this function block. Other errors,
such as a loss of communication are output as a traditional PLCopen function block Error.
Error Description
See the Function Block ErrorID list.
Example
PlaneMeasurement
This function block moves a Group to find a plane by measuring three user specified locations. The recorded results are avail-
able for use with other functions, such as Y_GroupSetFrameOffset.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V PlaneSetup PlaneSetupStruct Structure of data that provides information for measuring the spe-
cified plane.
V PlaneResults PlaneResultsStruct Contains the measurement positions and the Offset which can be
used with Y_GroupSetFrameOFfset.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs FALSE
are read and the function is initiated. To modify an
input, change the value and re-trigger the execute
input.
VAR_OUTPUT
B Done BOOL Indicates that the function is operating normally and the outputs of
Notes
l This block will detect if joint has a prime axis, and will monitor the torque of all axes involved when moving the joint to
the touch positions. The first motor to indicate a torque limit will cause motion to stop and the measurement to be
taken. A total of three servos operating a single joint is supported.
l Only Measurement by torque limited contact with the surface is supported as of v350.
Error Description
See the Function Block ErrorID list.
Example
Read_GCode_File
This function block reads a file containing G Codes from the MPiec controller's flash or ramdisk file system and writes to the
PathData for use with the MC_MovePath function block. Refer to the list of supported G & M Codes.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V MachineData MachineStruct Contains parameters such as maximum velocities and
accelerations, and support for 3D printers and tangent
axes if required. Also included are Origin (Home) and Part
Coordinate System offsets.
V ToolData ToolDataStruct Structure holding ToolData structures. If this data is not
applicable to the application, connect a dummy variable to
satisfy the compiler.
Notes
Processing is divided into two parts; Read_GCode_File and MC_MovePath. These blocks may be put into separate tasks. Typ-
ically MC_MovePath is placed in a faster task, especially if InputFlags and OutputFlags are used. Read_GCode_File should be
executed in a slower task, or even the DEFAULT task, which is recommended. It will parse the number of bytes as specified by
FileBufferSize per cycle. A cycle is six scans. For example, if FileBufferSize is set to 10000, and Read_GCode_File is executed
in a Cyclic task running every 50 mSec, a cycle is 300 mSec (50 * 6 = 300). Given these settings, the controller will process a
maximum of 33,000 bytes/second, but may be less, based space available in the motion buffer. The datatype definitions of
MC_PATH_DATA_REF.Segments and the number of characters in the ByteBufferStruct specified by FileBufferSize is con-
figurable if necessary. Consult Yaskawa for details.
Error Description
See the Function Block ErrorID list.
Example
This example shows the HC_ReadParameter function block from the File_RW_Toolbox. It reads parameter 1813 to obtain the
code for the user units selected for one of the Cartesian axes of the mechanism, which is copied into MyPath.HC_UserUnits.
This allows the Read_GCode_File function block to compare the machine configuration to the G20 / G21 setting within data
files and convert the position data as necessary.
This example also demonstrates that the InstructionsProcessed Output can be used to start motion. When the block is Busy
and at least 6 datapoints have been processed, a BOOL variable is set which can be used to initiate motion using MC_MovePath.
Read_GCode_Stream
This function block reads and parses a G Code stream from the configured communication device and writes to the PathData,
which can be used by MC_MovePath.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V MachineData MachineStruct Contains parameters such as maximum velocities and
accelerations, and support for 3D printers and tan-
gent axes if required. Also included are Origin (Home)
and Part Coordinate System offsets.
V ToolData ToolStruct Contains radius and length data for tools that may be
selected.
V GCodeData GCodeStruct Working data set used by the G Code Processor. It is
made available as a VAR_IN_OUT mainly for debug-
Notes
l The host application must read the StreamStatus to determine the number of bytes available in the bytebuffer. The
host application and the Read_GCode_Stream function block will work together to transmit / receive the byte stream of
G Code information.
l Yaskawa recommends executing this function block in the DEFAULT task with the watchdog disabled.
Error Description
See the Function Block ErrorID list.
Example
The following structured text shows the initialization of CommCfg.
l The LocalIPAddress is that of the MPiec controller. This is necessary because the controller may have more than one IP
address and more than one network. It allows the function to listen for G Code data on the correct network. This inform-
ation can be automatically obtained by referencing the ControllerInfo structure and converting the IP address as a byte
array into a string using BYTE_TO_STRING. See the DataTypes section in the PLCopenPlus help manual for more inform-
ation.
l Local Port can be nearly any convenient port number that you choose. The host application must open a connection to
the port specified here.
l TimeOut is not supported and must be set to T#0s.
User Units
You can optionally use the HC_ReadParameter from the File Read Write Toolbox, which will read the Hardware Configuration
setting for the axis selected. (Choose one of the axes that makes Cartesian movement.) Alternatively, if you know the user units
of the group's MCS, load MyPath.HCUserUnits directly. 0=Inches, 1=millimeters, 2=microns. This setting allows the G Code
processing functions to convert values to the correct units for the machine if the G Code data specifies different user units
(Refer to G20 / G21).
In the example above, a minimum number of points must be loaded into MC_PATH_DATA_REF.Segment[] before the
StreamReady flag is set. This flag is referenced in another task which executes the MC_MovePath function block. This allows
paths with many small segments to be buffered and sent to the motion engine more quickly to avoid data starvation when
motions starts.
The example below shows the MC_MovePath function including StreamReady logic.
ReadAxisOffsetFile
This function block reads absolute encoder offset information from a file written by WriteAxisOffsetFile. It restores the absolute
encoder offsets retained in the MPiec controllers battery backed memory for all axes in an AxesGroup. Restoring encoder off-
sets is necessary in the event of an MPiec controller replacement or MPiec SRAM battery failure.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
VAR_INPUT Default
B Execute BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V FileName STRING The file name as listed in the /Flash/Local directory on the STRING#''
controller. The extension is not required and will be auto-
matically appended.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If
another block takes control before the action is completed, the Done
output will not be set. This output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when
Done, CommandAborted, or Error is true. In the case of a function
block with an Enable input, a Busy output indicates the function is
operating, but not ready to provide Valid information. (No Error)
Notes:
l Firmware version 3.3.0 is required to use this function. It relies on MC_ReadParameter 1838, which was added for ver-
sion 3.3.0.
l The Flash/Local directory was also added for firmware 3.3.0. This folder is not deleted when a project archive is
deleted or the controller is restored to factory defaults.
l Once the file is created using WriteAxisOffsetFile, it is highly recommended to save a backup copy of the file to another
location other than the MPiec controller. This file can be replaced manually via the web UI in the event that a new MPiec
controller is connected to the existing mechanical equipment.
l The offsets contained in this file are only valid in the following situations:
l MPiec controller replacement .
l MPiec SRAM battery failure.
l The offsets contained in this file become invalid in the following situations:
l Absolute encoder battery failure or disconnection. (ServoPack has A.810 alarm)
l Motor replacement.
l Any mechanical alteration to the drive train, including belts, gearboxes, couplings, etc.
Error Description
See the Function Block ErrorID list.
Example
ReadGridFile
This function block reads a GMD file from the /Flash/Local folder previously written by WriteGridFile.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V GridResults GridResultsStruct Contains the measurement information populated by the GridMeas-
urement function block.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
V FileName STRING Enter only the file name without path or extension. The STRING#''
file will be read from the /Flash/Local folder. This folder
is never deleted even if the MPiec is restored to factory
defaults or an archive is added or deleted. The extension
.GMD will automatically be appended.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If
V ErrorCol INT If applicable, indicates the column in the file which generated the
error.
Notes
l Yaskawa recommends executing this function block in a slow (100mSec) or Default task.
l See related function blocks: GridMeasurement, WriteGridFile, GridLookup.
Error Description
See the Function Block ErrorID list.
Example
ReadJointMap
This function block will populate the JointMap with data linking Axis_Ref, Joint, and Joint Label. It can be useful when creating
applications which must programmatically act upon specifically named joints or axes rather than predetermined AXIS_REF
numbers for a specific machine.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V JointMap JointMap Structure containing group information populated by this function
block.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If
another block takes control before the action is completed, the Done
output will not be set. This output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when
Done, CommandAborted, or Error is true. In the case of a function
Notes
Error Description
See the Function Block ErrorID list.
Example
With a group configured as shown, the ReadJointMap function block will populate the JointMap as viewed in the Watch Win-
dow.
The configuration shown is a 3D gantry with a theta axis operated externally to the group using Y_SyncTangentAxisToGroup.
The application uses a special configuration which inserts the theta axis into the AxesGroup structure, therefore axis 5 in the
Jointmap shows an ExternalTanget as Axis_Ref 7.
ReAlignPrimeAxes
Designed for Groups configured with more than one servo operating a single joint, this function block will move the secondary
motor(s) to the commanded position of the main servo if they are already within the PrimeAllowance provided. Joints with mul-
tiple servos must have the same commanded position prior to executing MC_GroupEnable, otherwise the ErrorID 8966 will
occur.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
V JointMap JointMap Structure of data that holds information for Joint Index, Label,
AxisName and AXIS_REF.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
V Label STRING Specify the Joint to be aligned. Use the 'Label' name as STRING#''
shown in the Hardware Configuration for the group.
B Velocity LREAL Absolute value of the velocity in user units/second. LREAL#0.0
Notes
l This block only supports Mechatrolink gantry groups, not remote hosted robots via MotomanSync.
l See GroupReAlignPrimeAxes, which will iterate through all joints and calls this block as many times as necessary to
align all joints.
l The File R/W Toolbox and the PROCONOS firmware library are required when using this function block.
Error Description
See the Function Block ErrorID list.
Example
This example shows how the function is used within GroupToHome. A CASE statement sequences through the joints and
executes ReAlignPrimeAxes for all the joints configured with secondary axes.
WriteAxisOffsetFile
This function block writes absolute encoder offset information to a file which can later be read by ReadAxisOffsetFile. It records
the absolute encoder offsets retained in the MPiec controllers battery backed memory for all axes in an AxesGroup. These off-
sets can be restored in the event of an MPiec controller replacement or SRAM battery failure.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B AxesGroup AXES_GROUP_REF A logical reference to a group of axes, which contains several addi-
tional substructures pertaining to the group.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V ControllerInfo CONTROLLER_INFO Place this variable of type CONTROLLER_INFO at All zeros
address %MD3.66560. This is required to include other in struc-
data in the file such as the controller firmware version. ture
V FileName STRING The file name without an extension, which will be auto- STRING#''
matically appended. Do not include the directory
folders, they are also automatically added. See the
example below.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If
another block takes control before the action is completed, the Done
output will not be set. This output is reset when Execute goes low.
Notes:
l Firmware version 3.3.0 is required to use this function. It relies on MC_ReadParameter 1838, which was added for ver-
sion 3.3.0.
l The Flash/Local directory was also added for firmware 3.3.0. It is not deleted when a project archive is deleted or the
controller is restored to factory defaults.
l It is highly recommended to save a backup copy of the file to another location other than the MPiec controller. This file
can be downloaded / uploaded from the MPiec web UI in the event that a new MPiec controller is connected to the exist-
ing mechanical equipment.
l The offsets contained in this file are only valid in the following situations:
l MPiec controller replacement
l MPiec SRAM battery failure.
l The offsets contained in this file become invalid in the following situations:
l Absolute encoder battery failure or disconnection. (ServoPack has A.810 alarm)
l Motor replacement
l Any mechanical alteration to the drive train, including belts, gearboxes, couplings, etc.
Error Description
See the Function Block ErrorID list.
Example
WriteGridFile
This function block writes the GridResults structure that was populated by the GridMeasurement function block. The FileName
will be appended with a GMD extension in the /Flash/Local folder on the MPiec controller.
Library
Group Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V GridResults GridResultsStruct Contains the measurement information populated by the GridMeas-
urement function block.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are FALSE
read and the function is initiated. To modify an input,
change the value and re-trigger the execute input.
V FileName STRING Enter only the file name without path or extension. The STRING#''
file will be written to the /Flash/Local folder. This folder
is never deleted even if the MPiec is restored to factory
defaults or an archive is added or deleted. The extension
.GMD will automatically be appended.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If
V ErrorCol INT If applicable, indicates the column in the file which generated the
error.
Notes
l Yaskawa recommends executing this function block in a slow (100mSec) or Default task.
l See related function blocks: GridMeasurement, ReadGridFile, GridLookup.
Error Description
See the Function Block ErrorID list.
Example
Current Version:
2021-04-09 v372 released with MotionWorks IEC 3.7.2
Previous Versions:
2020-11-02 v371 released with MotionWorks IEC 3.7.1
Calc3DCenter - Improved FB to be PLCopen compliant, protect against divide by zero. DCR 4787.
Internal changes for code reduction, use single instance of ATAN2. SCR 12546.
ATAN2_F - Function equivalent of ATAN2 as function block, saves on compiled code instance memory. SCR 13009.
No changes.
Removed all Boolean logic and simple math functions. Use IEC-61131 functions instead .
1) Added functionality to the ATAN2 function block. New ENUM type as VAR_INPUT was added to configure it to operate in 0 to
2 pi radians or 0 to 360 degree in addition to -pi to pi radians. The default behavior (-pi to pi) is the same as previous versions.
2) New MathDataTypes file added. This contains enum types for ATAN2 input options.
Made change in REM function to prevent a negative result. Added TRUNC_DINT to the code in REM
Upgraded to version 2.0 Project for MotionWorks IEC. Built from Math Toolbox v004beta .
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to zero, the second to 1, etc. The format for enumerated types is as follows: ENUM:(0, 1, 2...) as displayed in the
example below (MC_BufferMode#Aborting).
ATAN2
The ATAN2 function is useful in many applications involving vectors, such as finding the direction from one point to another.
This two argument function is a variation of the ATAN function. For any LREAL arguments x and y,atan2(y, x) is the angle
between the positive x-axis of a plane and the point given by the coordinates (x, y) on it.
Library
Math Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B EN BOOL This function will continue to calculate the ATAN2 result while EN is FALSE
held high.
V X LREAL X coordinate LREAL#0.0
V Y LREAL Y coordinate LREAL#0.0
V Output_ INT Format of the output value. INT#0
Format 0: radians (-pi, pi]
1: radians [0, 2*pi)
2: degrees [0°, 360°)
VAR_OUTPUT
B ENO BOOL High if the function is executing normally.
Example
ATAN2 used with various output formats:
REM
This function block returns the modulo division result of two LREAL inputs. It is useful for determining the position within a
MachineCycle.
Library
Math Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B EN BOOL This function will continue to calculate the remainder while EN his held high. FALSE
V Numerator LREAL The numerator for division, such as the free running motor position, which LREAL#0.0
may be outside a desired range of values, such as 0 to 360.0
V Denominator LREAL The denominator for division, which is the desired max value for the Numer- LREAL#0.0
ator input, such as 360.0
VAR_OUTPUT
B ENO BOOL High if the function is executing normally.
Error Description
This is a function, not a function block and only provides one output. If ENO is not high when EN is high, this function cannot
calculate the remainder. Verify that the Denominator is not zero.
(* These calculations are designed for a rotary knife, rotary placer, one way cam, etc. *)
ELSE
(* These calculations are designed for reciprocating cam profiles (Slave net change = zero each cycle, Out and Back *)
END_IF;
CalcCircCenter
CalcCircCenter can be used whenever two points on the circle, the radius of the circle, the direction of the path (coun-
terclockwise or clockwise), and the length of the path (shortest or longest) is given.
Library
Math Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
V X1 LREAL X coordinate of starting point. LREAL#0.0
V Y1 LREAL Y coordinate of starting point. LREAL#0.0
V X1 LREAL X coordinate of ending point. LREAL#0.0
V Y1 LREAL Y coordinate of ending point. LREAL#0.0
V Radius LREAL Radius of the circle. LREAL#0.0
V PathChoice MC_CirclePathChoice If the path length is larger than 180 degrees, MC_CirclePathChoice#C-
use MC_CirclePathChoice#Longest. If the path lockWise
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the func-
tion are valid.
B Error BOOL Set high if an error has occurred during the execution of the function block.
This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
V CenterX LREAL X coordinate of the center of the circle
Notes
Whenever given two points and a radius, it is possible to create two circles that pass through both points with the same
radius, and different center coordinates. In order to know which center coordinates we need we can either use a unique third
point or the Direction (Clockwise vs CounterClockWise) and the PathChoice (Shortest or Longest). Currently support is only
available for choosing the Direction and PathChoice method.
CalcFrameOffset
This function block calculates an output frame by offsetting the input frame.
Library
Math Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
V InputFrame VECTOR An array of values. The specific meaning of each value depends upon the Coordinate Sys-
tem specified and the mechanism, and the context. For example, the values could be world
space positions or velocities.
V Offset VECTOR An array of values. The specific meaning of each value depends upon the Coordinate Sys-
tem specified and the mechanism, and the context. For example, the values could be world
space positions or velocities.
V OutputFrame VECTOR An array of values. The specific meaning of each value depends upon the Coordinate Sys-
tem specified and the mechanism, and the context. For example, the values could be world
space positions or velocities.
VAR_INPUT Default
B EN BOOL Enables the function. FALSE
VAR_OUTPUT
B ENO BOOL High if the function is executing normally.
Example
Firmware libraries:
l PROCONOS
User libraries:
The following User Libraries must be listed above the PackML Toolbox and in the following order:
Current Version:
2018-01-23: v340 Released
1) Altered the CM_Event and UN_Event FBs to pass the cfg_Event as an IN-OUT variable of EventCfgArray datatype.
Previous Versions:
2016-10-19: v302 Released
1) Altered the CM_Event and UN_Event FBs to pass the cfg_Event as an IN-OUT variable of EventCfgArray datatype.
6) Many changes to the event handling. The goal of this revision was to move away from the fixed event handling method of
built-in Servopack, Motion and Controller events in favor of User-defined events that could include messages looked up from
the other built-in lists.
9) Removed the ResetFirstOut Input from the UN_EventSummation block. It was redundant since we could not think of a case
where we would reset all active events but leave the FirstOut event still showing.
1) Reconciled to the latest specification for PackML according to ISA-TR88 00 02 Edition 2. Rev 3D, 11/2014.
- Added Unit Machine Layer to the PackTags. This is PackMLv30 datatype and contains PMLs, PMLc and PMLa.
- Edited PackML datatypes to conform as closely as possible to v3.0 spec for Minimum Supported Set of PackTags.
- Renamed Datatypes file and POUs to aad the Prefix "PML_". This helps avoid superfluous warnings in the user's project.
2) Inputs for remote control have been removed from the PackML_State_Diagram function block.
3) Event categories was changed from a DWORD datatype to a DINT datatype. Most users set a category number for severity
with lower numbers being higher severity (i.e. cat 1 = safety-type fault.)
5) renamed to v301beta.
7) Added UN_Event function block, similar to CM_Event, to capture events that are part of the general machine and not part of
any particular Control Module.
3) Improved interlocking in the PackML_State_Diagram for Stop and Abort. There were instances on the beta applications
Supporting array used to pass commands and machine status to individual Control Modules. The toolbox supports up to 16
Control Modules numbered 0 to 15.
Supporting Array used to pass commands and machine status to individual Equipment Modules. Up to 16 Equipment Modules
are supported, numbered 0 to 15.
A structure of parameters containing information for a specific ingredient. Support structure for Ingredient_ARRAY.
Array that contains information used to coordinating machine nodes in a cell of multiple units. The array can be expanded as
needed.
An array containing the names, units and values of a given parameter that are used across multiple machines and can be dis-
played on an HMI screen.
Contains all the information about the machine’s current state for each EM and CM.
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to zero, the second to 1, etc. The format for enumerated types is as follows: ENUM:(0, 1, 2...) as displayed in the
example below (MC_BufferMode#Aborting).
CM_Control_Inputs
The CM_Control_Inputs function block passes the high level commands from the PackML_StateControl into each of the
enabled and active Control Modules.
Library
Pack ML Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V PML_Cmds PackML_Com- Structure that contains the current Unit mode of operation and the commands sent by
mands_ PackML_StateMachine.
STRUCT
V PML_States PackML_ Structure containing information about the current state of the machine.
States_
STRUCT
V UnitMachine Structure containing all the information about the machines current state and mode of
UNitMachine_ operation for all EMs and CMs.
STRUCT
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V EM_Number The EM number corresponding to the EM in which this FB is loc- INT#0
INT ated.
Notes
• See the PackML template documentation for further details on recommended usage.
Error Description
See the Function Block ErrorID list.
CM_Control_Outputs
The CM_Control_Outputs function block sets the State Complete bits for the control module to be passed up and assembled
into the Equipment Module status in the EM00_ModuleControl worksheet.
Library
Pack ML Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V PML_States PackML_ Structure containing information about the current state of the machine.
States_
STRUCT
V UnitMachine Structure containing all the information about the machines current state and
UNitMachine_ mode of operation for all EMs and CMs.
STRUCT
Notes
• See template documentation for further details on recommended usage.
Error Description
See the Function Block ErrorID list.
PackML_State_Diagram
The PackML_State_Diagram function block handles the operation of the state machine, including mode and state transitions,
as defined in the OMAC PackML specification. This function block, when enabled, initializes the machine to be in mode 3
(Manual Mode) and in the Stopped state.
Library
Pack ML Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V Clearing BOOL When this bit is set, the machine is in the ‘Clearing’ state
V Stopped BOOL When this bit is set, the machine is in the ‘Stopped’ state
V Starting BOOL When this bit is set, the machine is in the ‘Starting’ state
V Idle BOOL When this bit is set, the machine is in the ‘Idle’ state
V Suspended BOOL When this bit is set, the machine is in the ‘Suspended’ state
V Execute BOOL When this bit is set, the machine is in the ‘Execute’ state
V Aborting BOOL When this bit is set, the machine is in the ‘Aborting’ state
V Aborted BOOL When this bit is set, the machine is in the ‘Aborted’ state
V Holding BOOL When this bit is set, the machine is in the ‘Holding’ state
V Held BOOL When this bit is set, the machine is in the ‘Held’ state
V UnHolding BOOL When this bit is set, the machine is in the ‘UnHolding’ state
V Suspending BOOL When this bit is set, the machine is in the ‘Suspending’ state
V UnSuspending BOOL When this bit is set, the machine is in the ‘UnSuspending’ state
V Resetting BOOL When this bit is set, the machine is in the ‘Resetting’ state
V Completing BOOL When this bit is set, the machine is in the ‘Completing’ state
V Complete BOOL When this bit is set, the machine is in the ‘Complete’ state
V ModeChangeNotAllowed BOOL When this bit is set, the requested Mode change isn’t allowed and the
machine will remain in the current mode and state.
V Sts_StateCurrent DINT Number in decimal corresponding to the current state the machine is
in
V Sts_StateCurrentName STRING The name of the current state the machine is in
V Sts_StateCurrentBits DINT DWORD indicating the current state the machine is in (Ex. If Sts_
StateCurrentBits[x] = 1, then the machine is in State x)
V Sts_ModeCurrent DINT Number in decimal corresponding to the current mode the machine is
in
V Sts_ModeCurrentName STRING The name of the current mode the machine is in
V StsModeCurrentBits DWORD DWORD indicating the current mode the machine is in (Ex. If Sts_
ModeCurrentBits[x] = 1, then the machine is in State x)
Notes
• Should always be enabled when program is running to ensure proper operation of the state machine.
PackMLCommands_Init
The PackMLCommands_Init function block clears all commands and sets the machine to be in the stopped state.
Library
Pack ML Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V INP_Pack- PackML_Module_Commands_ Structure containing the current state and commanded
MLCommands STRUCT actions
VAR_INPUT Default
B EN BOOL Enables the function. FALSE
VAR_OUTPUT
B ENO BOOL High if the function is executing normally.
Notes
• Intended to be executed when initially entering the stopped state to clear all previous commands.
PackMLModeStateTimes
The PackMLModeStateTimes function block keeps track of the times spent in each mode and state of operation for the machine.
Library
Pack ML Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V AdminTags PackTags_Admin_ Structure containing alarm data from the machine.
STRUCT
V UnitMachine UNitMachine_ Structure containing all the information about the machines current
STRUCT state and mode of operation for all EMs and CMs.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there
are no errors.
B Cmd_ResetCur- BOOL When set, all time counting will be stalled FALSE
rModeTimes and all of the times being counted for the
Sts_ModeCurrent will be cleared.
B Cmd_ResetAllTimes BOOL When set, all times being monitored will be FALSE
reset to zero. Time counting will also be
stalled while this input is held high.
V Sts_ModeCurrent DINT The current mode in which the machine is DINT#0
operating.
V Sts_StateCurrent DINT The current state in which the machine is DINT#0
operating.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
Notes
• See the PackML template documentation for further details on recommended usage.
Error Description
See the Function Block ErrorID list.
UN_ModuleSummation
The UN_ModuleSummation function block rolls up all the Equipment Module State Complete bits for active, enabled EMs. The
result is an overall PMLs State Complete bit that is transferred to the PackML_StateControl function.
Library
Pack ML Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V UnitMachine UNitMachine_ Structure containing all the information about the machines current state and mode of
STRUCT operation for all EMs and CMs
V PML_Cmds PackML_Com- Structure that contains the current Unit mode of operation and the commands sent by
mands_ PackML_StateMachine
STRUCT
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V EM_Mask WORD Mask to deactivate EMs. When an EM is deactivated, commands WORD#16#0000
will not be sent down to the EM, for testing purposes. Each bit cor-
responds to the same number EM to deactivate. (Example: to
deactivate EM_3, set EM_Mask.X3 =TRUE)
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V EMs_Active WORD The list of active EMs. Same bit scheme as EM_Mask. (Example: if EMs_Active.X4 =
Error Description
See the Function Block ErrorID list.
Firmware libraries:
l YMotion
- Only required if using the ReadAxisParameters function block.
User libraries:
The following User Libraries must be listed above the PLCopen Toolbox and in the following order:
Data Types
For versions prior to v205, this toolbox already includes the PLCTaskInfoTypes and MotionBlockTypes DataTypes files typically
included when starting a new project, so delete them from your project to avoid compile errors that indicate duplicate
DataType definitions. Starting in v205, the data type files that are included in the new project templates were added to a new
User Library called DataTypes toolbox. You must include the DataTypes Toolbox in your project as mentioned above, and
delete standard data type files form the main project to avoid compile errors that indicate duplicate DataType definitions. Start-
ing with MotionWorks IEC v3.x, the new project templates will include the PLCopen and DataTypes Toolboxes, and the data
types files will be excluded to save many steps during new project creation.
See the PLCopen_Toolbox eLearning Modules on Yaskawa's YouTube channel for video tutorials and examples.
Current Version:
2021-04-09 v372 released
Previous Versions:
2020-11-04 v371 released
1) AbsolutePositionManager - Improve to use Flash file for retain data. This version fixes bugs introduced in 370 when the pro-
cess was changed to use flash file instead of battery backed RAM. DCR 1784.
2) Cannot stop motor with Jog_To_Position function block (with specific vel and accel values). DCR 2638.
4) Improve Feed_To_Length to account for additional marks in unexpected regions. DCR 2759.
5) Jog_To_Position giving an incorrect velocity graph for some profiles. DCR 2802.
6) AbsolutePositionManager has the wrong constant for a ControllerAlarm variable compare. DCR 2824.
7) Fix code change for Home_LS blocks to add FinishHoming (Done does not stay on). DCR 2873.
8) Home_* function blocks should not output Done if Error or CommandAborted. DCR 2975.
9) AbsolutePositionManager FB - Improve to use a Flash file for retain data (for Sigma7-Siec support.) DCR 1784.
1) SetAccDecPns - Function block use by the Home_LS* functions had issues fixed with writing Pn 305, pn 306. DCR 1405.
2) Home_LS* blocks - Fixed to set MotionState back to "StandStill" by executing MC_FinishHoming. DCR 1530.
3) HighSpeedOutput - Fixed double counting of the output setting. (Status output.) DCR 1963.
2) ProductBuffer - Fixed new ErrorID added in v340 which detects a duplicate latch caused by a fw bug which was fixed in fw
3.4.0. ProductBuffer was errantly indicating that condition on first latch if less then Lockout distance. DCR 1449.
2017-11-22 v341 released (Filename is still 340, using new project version
control)
This version is included in the MotionWorks IEC 3.4.0.233a
1) AxisControl - Reverted change to only show outputs when Enable is High in v340. The v340 behavior was not ideal. DCR
918.
2) SetAccDecPns - This was a new block added for v340 to enhance the capabilities of Home_LS_Pulse and Home_LS, but
there was a compile error due to an incorrectly declared variable, now fixed. DCR 1318.
3) AxisControl - Changed to only show outputs when Enable is High. DCR 918.
4) AbsolutePositionManager - Improved PositionValid output for the case when the user resets the Absolute Encoder even if
there is not an alarm. DCR 949.
8) Feed_To_Length - Improved operation so LatchPosition does not toggle to zero between moves. DCR 1167.
10) Feed_To_Length - Improved operation in cases where latch comes very late in the move and the tuning is soft. DCR 1183.
11) ProductBuffer - Added ErrorID to catch firmware bug (SCR 10736) if previous latch is reported.DCR 1185.
3) ProductBuffer - Added new check and ErrorID 10099 if the Axis type is not a servo or external encoder, and TestMode is not
set TRUE. (This combination is not supported. Also suppressed an Error generated by internal function MC_AbortTrigger
when an unsupported axis is selected while in TestMode. DCR 903.
2) ProductBuffer - Added code to support multiple latch patterns, such as rising edge and falling edge .
3) ProductBuffer - Added code to automatically detect External Encoder type, even on MP3000iec series .
4) AxisInterLock - Replaced prm 1005 (actual position cyclic) with 1006 (actual position non cyclic.)
5) ReadMotorSpeed - New function block to read peak and rated speeds of connected rotary servos .
6) FeedToLength - Improved output logic - NOT Done added to RETURN rung. Enable added to Done rung.
7) ReadMotorSpeed - New function added to read the Motor part number string to report the Rated and Maximum speeds.
2) ProductBuffer - Added a Busy output because it takes 3 scans after Enable goes FALSE before iActive goes FALSE. Pro-
ductBuffer.Busy can be used as an interlock if the ProductBuffer FB is used within other user function blocks to prevent the
code from going dormant before the block is finished.
3) HomeTouchProbe - New function block. Homes an axis based on a sensor wired to the high speed latch input on the Ser-
voPack.
6) MoveAbsolute_2Stage - New function block. Provides two acceleration and two deceleration values switchable at a specified
speed.
7) Jog_To_Position - Fixed typo with Accel variable causing complete inoperability in v205.
9) GetActionPointers - New function block. For use with user functions that use the ProductBuffer for multi operation support.
10) ProductBufferStruct - Multiple pointers for several actions are now supported.
11) Jog - Improved logic to account for continuously changing inputs without getting stuck.
12) Home_LS - Added NC contact LimitError to workaround issue described in SCR 8025.
13) Home_LS - Added NC contact LimitError to workaround issue described in SCR 8025.
14) HighSpeedOutput - Added iActive contact to various rungs to clear outputs from previous execution.
2) Because of the reintroduction of functions with EN/ENO, the MP2600 requires firmware 2.1.
3) Moved all datatype definitions for firmware libraries to a new DataTypes Toolbox. Upgrading to PLCopen v205 will require
deleting any Yaskawa firmware datatypes files and adding the DataTypes Toolbox.
2) AccDecLimits - Fixed several copy / paste errors and variable naming confusion.
4) Feed_To_Length - Added. This function will index a default amount, and update the final target based on a registration
input.
2) PLCTaskInfoTypes - Added DataTypes to mirror the 2.0 additions for high resolution task timing.
3) AbsolutePositionManager - Added additional alarm detection to catch A830, A840, and ACC0 alarms. Also added code to
clear EncoderAlarmID and ControllerAlarmID when the block goes inactive.
4) Jog_To_Position - Added. For rotary applications that must stop at a specific location.
5) HighSpeedOutput - Fixed issue with MinTime. Was not working correctly if Min Time not zero. (YEU)
2) ReadAxisParameters - Disabled reading parameter 1311 because it causes an error on MP2600iec. This parameter is sched-
uled to return a zero instead of an ErrorID in firmware 2.2.
3) ReadAxisParameters - Fixed two swapped values CamOffset and CamScale were swapped in v200.
2) Math Toolbox - Upgraded to v004 with Enable / Valid as function block I/O for compatibility with FW 2.1*)
3) Changed AxisControl to allow clearing a drive warning while the servo is enabled.
2) Home_LS_Pulse - Added a MC_MoveRelative between searching for the limit switch and C channel to prevent ErrorID 4397
from occurring: "Over travel limit still ON after attempting to move away from it."
2) ProductBuffer - Improved lockout operation when a manual offset was applied. See ProductBuffer FB comments for more
details.
3) Jog - Improved Done output (It will only pulse; this block is a special case of Enable type
5) Home_LS - Fixed rung 6 (incorrect execute bit), duplicated StartOffset from rung 5.
6) DigitalCamSwitch - Added. See the initialize POU for example data setup.
8) AbsolutePositionManager - Added. For confirmation that the absolute position was set and valid
6) Improved ProductBuffer FB to account for external encoder master (prm 1016 / 1006 switch
9) CamGenerator formula type 4 (Cycloidal) changed to 3 (Simple harmonic). It was incorrectly identified.*)
10) Added ParamTypes input to ReadAxisParameters to increase efficiency of the function (Provides
11) MOVED ALL CAMMING SUPPORT FUNCTIONS TO CAM TOOLBOX - FOR PRO VERSION ONLY.
12) The "PLCTaskInfoTypes" DataType file was removed from this Toolbox. If you need to replace it in
your project, open a second copy of MotionWorks IEC, and open a project that already has the
PLCTaskInfoTypes DataType file, then copy & paste it into your project explorer.
4) Removed the variable Speed from HomeStruct, it was not used for anything.
6) Added MOVE_UNIT & MOVE_LREAL function block to provide compatibility with MP2600iec.
9) Added some outputs such as 'Valid' to some blocks for increased consistency with PLCopen.
2) Removed R_TRIGs from the ErrorID portion of Home_LS, Home_LS_Pulse, and Home_Pulse because it was preventing the
blocks from showing errors.
3) Updated ProductBuffer function block for both modularized and non modularized latch data.
4) Updated ReadAxisParameters to include VAR_IN_OUT (for speed) and additional input parameter to specify axis type. Also
reduced parameter set to eliminate those that typically do not change.
6) Improved interlock logic in Home_LS_Pulse, Home_LS, Home_Pulse functions, added CommandAborted as output, and
fixed a typo in all three blocks where the variable attached to the Busy output of one of the internal blocks was referencing an
error bit.
firmware 1.1.2.5 caused new problem if the block was executed when already executing. This may occur if there
3) Fixed MoveRelative_ByTime - calculations would cause error if negative distance. Also added checks for
(* Previously they had a normally closed contact from the MC_Power FB preventing the block from enabling *)
(* again. Also changed these two blocks to reset Error & ErrorID outptus when Enable=FALSE *)
(* Changed the Jog Block Error and ErrorID outputs to only come on if JogFwd or JogRev is On *)
1) Explicitly set some parameters in ReadAxisParameters to LREAL#0.0 and documented as being unavailable.
because they were causing Access Violation Errors when viewed in the Watch Window.
(* Fixes *)
3) Simplified MoveRelativeByTime function, removed additional interlocks, and just copied MC_MoveRelative
4) Made corrections to the AxisParameterArray, added cam parameters. NOTE: will require controller firmware
1.1.0.4 or greater to read some of the cam parameters. Set the READ flag for those parameters to FALSE
3) Added example initialization code as a Program POU to enable cut & paste to speed development.
4) Open the Toolbox as a project in a second copy of MotionWorks IEC as a project to see the Initialization POU.
5) Added 'ControllerAlarm' function block to provide BOOL output when there is a controller alarm.
2) Previous versions would not allow the block to run more than once.
1) AxisControl
2) AxisStatus
Fixes:
Not complete:
4) MoveRelative_ByTime
1) Home_LS_Pulse
3) ReadAxisParameters
Not complete:
4) MoveRelative_ByTime
1) EnableServo
2) Jog
Not complete:
3) MoveRelative_ByTime
AxisParamData:ARRAY[0..60] OF IndividualParamDetails;
END_TYPE
AxisPrmArray: STRUCT
Param:AxisParamData;
END_STRUCT;
END_TYPE
END_TYPE
U AxisDirection INT The direction of the master for which this switch applies. 0 = Both Pos MyCAMSWITCH_
and Neg; 1 = Positive Only (future); 2 = Negative Only (future). ONLY STRUCT.AxisDirection
0 should be implemented at this time.
MultiUseData:ARRAY[0..9] OF MultiUsePointers;
END_TYPE
l SensorDistance
l SensorOffset
l ProductAwayDistance
Example 1:
Example of ProductBufferStruct being initialized for a linear flying shear application
(*==========================================*)
Products.LockoutDistance := LREAL#9.0; (* Looks for a new part only after conveyor has traveled LockOutDistance after pre-
vious part*)
Products.SensorDistance := LREAL#14.075; (* Distance from sensor to start of slave 1 home position (beginning of cam pro-
file) *)
Products.ProductAwayDistance := LREAL#20.075; (* Distance from sensor to end of sync position in the cam table.
This is used to update the use pointer. Cam disengages only when use pointer = store pointer *)
Products.Sensor.Bit:=UINT#1; (* Equates to EXT1 on a Sigma-5 amplifier, see MC_TouchProbe help for details *)
(*==========================================*)
Products.LockoutDistance := LREAL#90.0; (* Looks for a new part only after conveyor has traveled LockOutDistance after
previous part*)
Products.SensorDistance := LREAL#1580.0; (* Distance from sensor to start of slave 1 home position (beginning of cam pro-
file) *)
Products.BufferPattern[0].Bit :=UINT#1; (* PART SENSOR Signal - RISING EDGE connected to Latch DI_01*)
Products.BufferPattern[1].Bit :=UINT#0; (* PART SENSOR Signal - FALLING EDGE Connected to PCL5 External Encoder
Sensor...*)
Products.BufferPatternSize :=INT#2;
END_TYPE
TRACK_REF:STRUCT
Track:TRACK_ARRAY;
END_STRUCT;
END_TYPE
Some blocks accept an enumerated type (ENUM), which is a keyword (or constant) representing a value which will configure
the operation of the function block. Enumerated types are equivalent to zero-based integers (INT). Therefore, the first value
equates to zero, the second to 1, etc. The format for enumerated types is as follows: ENUM:(0, 1, 2...) as displayed in the
example below (MC_BufferMode#Aborting).
AbsolutePositionManager
This function monitors for any controller or servo alarm related to the absolute encoder or battery backed encoder offset data
stored in the controller. It can serve as the single point of monitoring, clearing, and defining the position of an absolute
encoder. This function includes a retained Boolean output variable that once set, requires that the alarm be cleared through
this function, and that the position of the encoder is redefined. The intention is to prevent the machine from operating until the
position of the absolute encoder has been calibrated to the machine coordinates.
This function includes the following PLCopen function blocks: MC_ReadAxisError, MC_ReadAlarm MC_ResetAbsoluteEncoder,
Y_ClearAlarm and MC_SetPosition.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V PositionValid BOOL Indicates that the absolute encoder has no alarms, and the MC_SetPosition has been
used at some point in the past to align the encoder with the mechanical system.
V ResetDone BOOL Indicates that the ResetEncoder request has completed successfully.
V ControllerAlarmID UDINT Controller alarm related to the SRAM or battery, which stores the absolute encoder off-
set.
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
or 'Enable' goes low.
Notes
l This function block is not supported on the Sigma7-Siec because there is a Retain variable in the code which is not sup-
ported due to hardware limitations; there is no SRAM memory on the Sigma7-Siec.
l To clear the absolute encoder alarm from a ServoPack, the user must use the 'ResetEncoder' input, then reset the Ser-
voPack by either cycling power the ServoPack or using the Y_ResetMechatrolink function block.
l Check the Hardware Configuration to ensure that the alarm format for Sigma III and higher drives is set for 3 digit
alarm mode.
Error Description
See the Function Block ErrorID list.
AccDecLimits
This function block manages the parameters associated with enabling/disabling the acceleration and deceleration limits. The
limits can be enabled or disabled and the values of the limits can be input and verified at the output. The outputs are provided
as an echo from the motion engine. This function allows for streaming of variable limits.
Library
PLCopen Toolbox
Parameters
Parameter Data Description
*
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the
REF Hardware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are no
errors.
V LimitAccDecEnable BOOL Enables or Disables the Limit Accel Decel func- FALSE
tion. Parameter 1222 and 1232 are combined
V LimitAccelPositive LREAL Parameter 1221 LREAL#0.0
V LimitAccelNegative LREAL Parameter 1220 LREAL#0.0
V LimitDecelPositive LREAL Parameter 1231 LREAL#0.0
V LimitDecelNegative LREAL Parameter 1230 LREAL#0.0
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function
Notes
The function block uses MC_ReadBoolParameter, MC_WriteBoolParameter, MC_ReadParameter, and MC_WriteParameter.
• The software acceleration & deceleration limits are managed in the MPiec controller.
• When an acceleration or deceleration limit is exceeded, a controller alarm will be generated, obtainable via the MC_ReadAx-
isError function block, or the web server.
Acceleration Limits
• The parameters are called LimitAccelPositive and LimitAccelNegative, with values of UINT#1221 and UINT#1220 respect-
ively. Use the MC_WriteParameter function block for these and all controller side parameters. Acceleration limit parameters
are in user units / sec2.
Deceleration Limits
• The parameters are called LimitDecelPositive and LimitDecelNegative, with values of UINT#1231 and UINT#1230 respect-
ively. Use the MC_WriteParameter function block for these and all controller side parameters. Deceleration limit parameters
are in user units / sec2.
Error Description
See the Function Block ErrorID list.
Axes_Interlock
This function block checks MC_ReadAxisError and the actual position of both axes to verify that they are both free of alarms
and within the position tolerance specified. It is intended for use with axes that operate on the same mechanical load and must
remain within tolerance to avoid equipment damage, such as an X, X Prime gantry system. The Locked output will be high to
indicate that the axes are synchronized and free of errors.
Support for axes configured in rotary mode requires controller firmware 1.2.3 and PLCopen Toolbox v021.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis1 AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hardware
REF Configuration (logical axis number).
B Axis2 AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hardware
REF Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute while enable is FALSE
held high.
V Locked BOOL Indicates TRUE if neither axis has an alarm and the position deviation is less than the spe-
cified tolerance.
V Deviation BOOL The amount of positional difference between the two axes.
B Error BOOL Set high if error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
Notes
l It is assumed that the axes have the same user units because they are operating the same load.
l See the AxesInterlock eLearning Module on Yaskawa's YouTube channel.
Error Description
See the Function Block ErrorID list.
AxisControl
This function block combines MC_Power, MC_ReadAxisError, and MC_Reset and provides separate outputs for controller and
drive alarms and warnings.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
E EnablePositive BOOL Not Supported FALSE
V DriveWarning BOOL Indicates a warning on the drive, such as any A.9x display on a ServoPack.
V DriveWarningID UINT Indicates the drive warning number, such as 95 (overload warning). Refer to the drive
manual for troubleshooting.
V DriveAlarmID UINT Indicates the drive alarm number, such as C9 (encoder disconnected). Refer to the
drive manual for troubleshooting.
V ControllerAlarmID UDINT Indicates the controller alarm ID number, such as 3302 0018. (shown in hex.) Refer
to the Controller AlarmID list in the PLCopenPlus manual for troubleshooting.
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
or 'Enable' goes low.
Notes
l When attempting to clear an alarm, the enable input must be FALSE or the alarm reset function will be blocked from
executing.
l We recommend viewing the alarm and warning output ID’s in Hex, because all Yaskawa ServoPack documentation lists
the amplifier alarm codes in Hex. This simplifies alarm identification. Note that MotionWorks IEC may show the value
at the output in decimal. For example, a DriveAlarmID 0f 2064 converted to hex is 810, which is the ServoPack alarm
for the absolute encoder. "A81" will be displayed on the front of the ServoPack.
l This function only reports axis specific alarms and warnings. For general system alarms, use the Y_ReadAlarms func-
tion block from the PLCopenPlus firmware library.
Error Description
See the Function Block ErrorID list.
AxisStatus
This function block uses MC_ReadAxisError to provide further breakdown of the ErrorClass and AxisErrorID by providing BOOL
and UINT outputs for the drive faults, and a DINT value for the controller alarm which is consistent with the 32 bit controller
alarm reporting in the web server. This function was created for use inside the AxisControl function block in the PLCopen Tool-
box. This function's outputs are available at the output of the AxisControl function block.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
Notes
To simplify alarm identification, Yaskawa recommends viewing the alarm and warning output ID’s in Hex, because all Yaskawa
ServoPack documentation lists the amplifier alarm codes in Hex. Use the Debug Dialog menu in MotionWorks IEC to change the
debug value display type. The controller alarm list in the webserver and in the PLCopenPlus help manual show the controller
alarms in hex also.
Error Description
See the Function Block ErrorID list.
ControllerAlarm
This function block provides a BOOL output to indicate if there is a controller alarm not related to an axis. It uses the Y_
ReadAlarm function block and determines if the AlarmID output is non-zero. This function is useful because the PLCopenPlus
function Y_ReadAlarm does not have a Boolean output, just the AlarmID.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are read FALSE
and the function is initiated. To modify an input, change the
value and re-trigger the execute input.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
V AlarmID UDINT This output provides the Controller Alarm ID. This output is reset when execute goes low.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
Notes
It is best to view the AlarmID in hex because the Controller AlarmID list in the PLCopenPlus manual displays all alarm codes in
hex. This simplifies alarm category identification.
Error Description
See the Function Block ErrorID list.
Feed_To_Length
FeedToLength was designed for use with applications that index forward in one direction, and require on the fly adjustments
of the actual index length based on a sensor input that occurs while the axis is moving. This block is a hybrid function block,
meaning it use both types of PLCopen behaviors: Enable and Execute. The reason for this is so the function can monitor for
consecutive latches and flag an Error for that condition. The Enable input allows this feature to operate. The Execute input ini-
tiates each move.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the
Hardware Configuration (logical axis number).
V TriggerData TRIGGER_ Reference to the trigger signal source.
REF
VAR_INPUT Default
Error Description
See the Function Block ErrorID list.
Example
Consider a case where the default distance between successive products is 6.2832 units. Let the distance between the sensor
(wired to the high speed registration input) and the target position where the product will be processed be 3.1416 units.
DistanceAfterLatch = 3.1416.
MaxCorrection limits the correction if an erroneous registration mark is captured and the calculation results in a large cor-
rection distance.
SensorMinimum and SensorMaximum provide window in which a registration mark must be detected to be considered a valid
registration mark. In this example, the mark is expected around 3.1416 units, and only marks detected between 2.0 to 4.5 are
accepted. Set the window as small as appropriate for the application.
The Feed_To_Length function block will position the axis exactly 3.1416 units (DistanceAfterLatch) after the registration mark
is detected for varying product lengths.
Full_Closed_Control
This function block uses an external encoder position to provide improved positioning for machines that have loose mechanics
or applications that must account for material slippage. This function block is very useful for MP2600iec applications which
cannot take advantage of the FC100 option card. Other features include the ability to switch from full closed to normal motor
encoder feedback, which is useful for applications where the external encoder is tracking a product which may not be present
at all times.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
V Virtual AXIS_ Logical axis reference. This value can be located on the Configuration tab in
REF the Hardware Configuration (logical axis number).
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in
REF the Hardware Configuration (logical axis number).
V Encoder AXIS_ Logical axis reference. This value can be located on the Configuration tab in
REF the Hardware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V Mode BOOL This turns on and off full closed loop operation. Set FALSE
Notes
l The Yaskawa Toolbox v300 or higher is required when using the Full_Closed_Control function block. The Yaskawa Tool-
box must be included and placed above PLCopen Toolbox in the Libraries folder of your MotionWorks IEC project.
l For the best performance, this function block must be executed in a task running at the same interval as the
Mechatrolink (or MP2600iec DP ram) update rate. Ideally, the function is executed in a task at 4 mSec or faster.
l The user application must pre-set the position of the Virtual axis and the Encoder axis before enabling this function.
The two positions must be less than MaxDeviation, or an Error will be generated immediately.
l For applications where the full closed encoder is in contact with product fed into the machine and may experience slip
due to feed roll pressure, etc. the Clear input can be used in conjunction with the cycle of the machine, or each index
motion. For example, if up to 1 mm of slip is known to occur normally while indexing 25 cm, set the MaxDeviation input
to 2 or 3 mm, and trigger the Clear input after each index is finished. This will allow the function to monitor for excess-
ive slippage and generate an error only if it exceeds 2 mm during a single index, but will allow for much more deviation
to accumulate over long periods of operation.
l Mode can be set TRUE for situations when the material monitored by the full closed encoder is not in contact with the
full closed encoder. This may be when the machine is being set up, or a jam is being cleared. The Full_Closed_Control
function block can operate the motor using the motor encoder alone. If during the time that Mode=TRUE the MaxDe-
viation is exceeded, it will not cause an Error, however, when Mode is again set to FALSE, the difference between the
Virtual axis and the Encoder must be within MaxDeviation, or an Error will be generated. The application program must
set the two positions accordingly. It may be necessary to disable this function block and re-Enable it after using the
Mode which doesn’t close the position around the Encoder.
Example 1
In this example, the Logic Analyzer is showing when positive slip happens, correction is added to the Axis and how the moving
average slip changes during the correction.
Example 2
In this example, the Logic Analyzer shows negative slip, and the correction added to Axis.
Example 4
When Mode is ON, full closed loop function is disabled.
HighSpeedOutput
This function block combines several of the parameters for use with the High Speed Output function available on the LIO-01,
LIO-02, LIO-06, and MP2600iec. It allows changing the "OnPosition" value on the fly. While the "OnPosition" will be triggered
at the hardware level with a response time of 13us, the output will be turned off when either the MinDistance has been trav-
elled or the MinTime has elapsed, which will be based on the application scan in which this function is operating.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hardware
REF Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V OnPosition LREAL Position at which output must turn on. LREAL#0.0
V MinDistance LREAL Minimum distance that must occur before the output LREAL#0.0
turns off.
V MinTime TIME Minimum time that must elapse before the output T#0s
must turn off.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
V Status BOOL Indicates the status of the hardware.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
Notes
High Speed Output Quick Reference
Error Description
See the Function Block ErrorID list.
Home_Init
This function block provides a method to initialize the HomeStruct data for use with all HOME_** function blocks. It is useful
for programmers who prefer to avoid structured text for initializing HomeStruct values.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V HomeData HomeStruct Logical axis reference. This value can be located on the Configuration tab in
the Hardware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL Upon the rising edge, all other function block inputs FALSE
are read and the function is initiated. To modify an
input, change the value and re-trigger the execute
Error Description
No Errors will be generated.
Home_LS
This function block combines the PLCopen function blocks MC_StepLimitSwitch, MC_MoveRelative, and MC_SetPosition to make
a sequence that detects the limit switch, performs an offset move away from the limit, and sets a home position.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the
Hardware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the value
and re-trigger the execute input.
V HomeData HomeStruct User defined Data Type in the PLCopen Tool- All zeros in structure
box, contains all related homing para-
meters.
VAR_OUTPUT
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input,
a Busy output indicates the function is operating, but not ready to provide Valid
information. (No Error)
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This
Notes
l This function is intended to operate only with a ServoPack's POT or NOT signal detection. HomeData.SwitchMode only
supports "EdgeOn." Configure the ServoPack Pn 50A and 50B appropriately.
Error Description
See the Function Block ErrorID list.
Example
Use a ST POU to initialize the data required for HomeData. To save time, copy & paste the example initialization into your pro-
ject.
(** Copy & Paste, then search & replace the headings in the following section to speed the initialization of the homing data.
**)
HomeStruct_ReplaceMe.ApproachTimeLimit:=LREAL#500.0; (* In seconds *)
HomeStruct_ReplaceMe.CreepTimeLimit:=LREAL#500.0; (* In seconds *)
HomeStruct_ReplaceMe.Direction:=INT#0; (* MC_Direction#Positive_Direction; *)
HomeStruct_ReplaceMe.SwitchMode:=INT#2; (* MC_SwitchMode#EdgeOn; *)
Home_LS_Pulse
This function block combines the PLCopen function blocks MC_StepLimitSwitch, MC_StepRefPulse, MC_MoveRelative, and MC_
SetPosition to make a sequence that detects the limit switch, reverses to the C channel, performs and offset move away from
the limit, and sets a home position.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the
Hardware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the value
and re-trigger the execute input.
V HomeData HomeStruct User defined Data Type in the PLCopen Tool- All zeros in structure
box, contains all related homing para-
meters.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This
output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input,
a Busy output indicates the function is operating, but not ready to provide Valid
Notes
l This function is intended to operate only with a ServoPack's POT or NOT signal detection. HomeData.SwitchMode only
supports "EdgeOn." Configure the ServoPack Pn 50A and 50B appropriately.
l See the Home_LS_Pulse eLearning Module on Yaskawa's YouTube channel.
Error Description
See the Function Block ErrorID list.
Home_Pulse
This function block combines the PLCopen function blocks MC_StepRefPulse, MC_MoveRelative, and MC_SetPosition to make a
sequence that detects the limit switch, reverses to the C channel, performs and offset move away from the limit, and sets a
home position.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the
Hardware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the value
and re-trigger the execute input.
V HomeData HomeStruct User defined Data Type in the PLCopen Tool- All zeros in structure
box, contains all related homing para-
meters.
VAR_OUTPUT
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input,
a Busy output indicates the function is operating, but not ready to provide Valid
information. (No Error)
B Done BOOL Set high when the commanded action has completed successfully. If another block
Error Description
See the Function Block ErrorID list.
Home_TouchProbe
This function block combines the PLCopen function blocks MC_MoveRelative, MC_TouchProbe, MC_MoveAbsolute and MC_
SetPosition to make a sequence that initiates motion on the axis until a signal is detected on the sensor connected to the high
speed latch input of the servo. The axis then performs an offset move from the latched position, and sets a home position.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the
Hardware Configuration (logical axis number).
V TriggerData TRIGGER_ Reference to the trigger signal source.
REF
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the value
and re-trigger the execute input.
V HomeData HomeStruct User defined Data Type in the PLCopen Tool- All zeros in structure
box, contains all related homing para-
meters.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This
Notes
Use HomeData.ApproachDistanceLimit to set the maximum travel distance while waiting for the TouchProbe function to detect
the sensor. Enter a positive or negative value, this function block does not use HomeData.Direction.
Error Description
See the Function Block ErrorID list.
Example
The example below illustrates how the Home_TouchProbe function block homes an axis based on the latch detected on one of
the three EXT channels on the servo. Plots of the commanded speed and positions are shown to describe a negative home off-
set of 360 units after the latch is detected.
Jog
This function block combines the PLCopen functions MC_MoveVelocity and MC_Stop to provide a jogging feature only while the
Forward or Reverse inputs are TRUE. The function will default to stopping the axis when neither (or both) are high.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hardware
REF Configuration (logical axis number).
VAR_INPUT Default
V Forward BOOL Runs the axis in a forward direction when FALSE
TRUE.
V Reverse BOOL Runs the axis in a Reverse direction when FALSE
TRUE.
B Velocity LREAL Absolute value of the velocity in user unit- LREAL#0.0
s/second.
B Acceleration LREAL Value of the acceleration in user unit- LREAL#0.0
s/second^2 (acceleration is applicable with
same sign of torque and velocity)
B Deceleration LREAL Value of the deceleration in user unit- LREAL#0.0
Notes
l The velocity can be changed on the fly without toggling the Forward or Reverse input. The code inside this function
block will detect if the velocity has changed, and automatically re trigger the MC_MoveVelocity function block inside.
Starting in PLCopen Toolbox v202, changes in Acceleration and Deceleration are detected and can be changed on the
fly.
l See the Jog eLearning Module on Yaskawa's YouTube channel.
Error Description
See the Function Block ErrorID list.
Jog_To_Position
This function block combines the PLCopen functions MC_MoveVelocity and MC_MoveAbsolute to provide a jogging feature spe-
cifically for rotary axes that must stop at a specific position after an indefinite period of motion.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
V Forward BOOL Runs the axis in a forward direction when FALSE
TRUE.
V Reverse BOOL Runs the axis in a Reverse direction when FALSE
TRUE.
B Velocity LREAL Absolute value of the velocity in user unit- LREAL#0.0
s/second.
B Acceleration LREAL Value of the acceleration in user unit- LREAL#0.0
s/second^2 (acceleration is applicable
with same sign of torque and velocity)
B Deceleration LREAL Value of the deceleration in user unit- LREAL#0.0
Notes
l When using this function block, the Math Toolbox is also required because JogToPosition references the REM function.
l The velocity, acceleration, and deceleration can be changed on the fly without toggling the Forward or Reverse input.
The code inside this function block will detect if the input values have changed, and automatically re trigger the MC_
MoveVelocity function block inside. Starting in PLCopen Toolbox v202, changes in Acceleration and Deceleration are
detected and can be changed on the fly.
l This block references the REM function from the Math Toolbox, so it must be included in the project tree.
Example 1
In the first example the speed is low enough and the deceleration high enough that the axis can stop within one revolution.
This is the easiest condition.
Example 2
In this example, the axis requires about 13 revolutions to come to a stop at the specified velocity and deceleration. The data
"SlowNow" in green is an internal monitoring bit which results from a calculation made to determine a position that will allow
the motion profile to follow the deceleration rate to the specified StopPosition. Notice there is a very brief delay between the
time the Forward jog request is removed and the axis starts decelerating. This allow the axis to decelerate smoothly to the
StopPositiion. The pink data indicates when the MC_MoveAbsolute is active.
MoveAbsolute_2Stage
This function block commands a move to an absolute position using a two staged acceleration and deceleration.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trigger
the execute input.
B Position LREAL A positive or negative value within the coordinate LREAL#0.0
system in user units.
B Velocity LREAL LREAL#0.0
Notes
Error Description
See the Function Block ErrorID list.
MoveRelative_ByTime
This function block converts the MoveTime input into acceleration, velocity, and deceleration for a 1/3, 1/3, 1/3 trapezoidal
move profile which will complete in the MoveTime specified. It uses the MC_MoveRelative function block.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hard-
REF ware Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated.
To modify an input, change the value and re-
trigger the execute input.
V Distance LREAL A relative positive or negative value within the LREAL#0.0
coordinate system in user units
V MoveTime LREAL The time required (in seconds) for the move to LREAL#0.0
complete.
V VelocityLimit LREAL LREAL#0.0
Notes
l Prior to v207, this function creates a 1/3, 1/3, 1/3 trapezoidal move, it may not be appropriate for very long moves,
because the calculated commanded speed may be too high. New functionality was added for v207 which allows the
function to calculate the move parameters to stay within the restraints of the new VAR_INPUTS VelocityLimit, Accel-
erationLimit, and DecelerationLimit.
l See the MoveRelative_ByTime eLearning Module on Yaskawa's YouTube channel.
Error Description
See the Function Block ErrorID list.
PositionLimits
This function block enables or disables the position limit function. It also allows continuous streaming of new position limits.
This block uses MC_WriteBoolParameter, MC_ReadBoolParameter, MC_WriteParameter, and MC_ReadParameter.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in
REF the Hardware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
V LimitPositionEnable BOOL Enables / Disables the position limit function FALSE
in the motion engine.
V LimitPositionPositive LREAL The maximum commanded position allowed LREAL#0.0
V LimitPositionNegative LREAL The minimum commanded position allowed LREAL#0.0
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the func-
tion are valid.
V LimitPositionEnableEcho BOOL Status of the Position Limit function from the motion engine.
V LimitPositionPositiveEcho LREAL Value used by the motion engine for the maximum allowed commanded pos-
ition.
V LimitPositionNegativeEcho LREAL Value used by the motion engine for the minimum allowed commanded pos-
ition.
B Error BOOL Set high if an error has occurred during the execution of the function block.
Notes
The function block uses MC_ReadBoolParameter, MC_WriteBoolParameter, MC_ReadParameter, and MC_WriteParameter.
l The software position limits are managed by the MPiec controller. The parameters are called LimitPositionPositive and
LimitPositionNegative, with values of UINT#1201 and UINT#1200 respectively. Use the MC_WriteParameter function
block for these and all controller side parameters. Position limit parameters are in user units.
l When a position limit is exceeded, a controller alarm will be generated, obtainable via the MC_ReadAxisError function
block, or the web server.
l The controller alarm will be 16#3202 0001 if the positive position limit is exceeded and 16#3202 0002 if the negative
position limit is exceeded.
l To disable the position limits, set LimitPositionEnable, parameter 1202 to zero.
l LimitPositionPositive must be greater than LimitPositionNegative.
l LimitPositionNegative must be lower than LimitPositionPositive.
l See the PositionLimits eLearning Module on Yaskawa's YouTube channel.
Error Description
See the Function Block ErrorID list.
ProductBuffer
This function block uses MC_TouchProbe and provides a circular buffer of recorded latch positions for the axis specified. It is
tailored for use specifically for applications that process random incoming products such as rotary knifes or linear flying
shear. Together, the application programmer and the ProductBuffer function block manage the RegistrationData structure
which contains information pertaining to the product positions and other mechanical dimensions related to the application.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V ProductAxis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in
the Hardware Configuration (logical axis number).
V RegistrationData ProductBufferStruct Structure containing all information for the circular buffer to operate.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V TestMode BOOL If TRUE, then the internal MC_TouchProbe is aborted, FALSE
and the function block can be used to "dry cycle" the
machine by simulating products using the TestTrig-
ger input.
V TestTrigger BOOL If TestMode is TRUE, then on the rising edge of FALSE
TestTrigger, the actual position of the ProductAxis
will be stored into the RegistrationData STRUCT.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the func-
tion are valid.
Notes
l The Math Toolbox v202 or higher is required when using the ProductBuffer. The Math Toolbox must be included and
placed above the PLCopen Toolbox in the Libraries folder of your MotionWorks IEC project.
l The ProductBuffer function block manages only the storing activity and only updates the StorePointer. Another part of
your application must update the UsePointer after the products have been processed. If the UsePointer is not updated,
this function block will eventually generate the ErrorID 10022, buffer overrun.
l The StorePointer and UsePointer are the 'Head' and the 'Tail' of the circular buffer. If more than one 'Use' of the latch
data is required, use the expanded sub structure added for v206 which supports a series of Use pointer activities.
l The cyclic (modularized) and non cyclic (unmodularized) latch position are stored into the RegistrationData sim-
ultaneously.
l TestMode can be toggled on the fly without re Enabling the function block. TestMode was added in v201.
l See the ProductBuffer eLearning Module on Yaskawa's YouTube channel.
Error Description
See the Function Block ErrorID list.
Example 1:
Consider a rotary knife application as shown below.
Conveyor.Products.BufferSize:=INT#20;
Conveyor.Products.LockoutDistance:=LREAL#3.25; (* inches *)
Conveyor.Products.ManualOffset:=LREAL#0.0;
Conveyor.Products.ProductAwayDistance:=LREAL#23.75;
Conveyor.Products.Sensor.Bit:=UINT#1; (* Equates to input1 on 2600 I/O, see MC_TouchProbe help for details *)
Conveyor.Products.SensorOffset:=REM(Conveyor.Products.SensorDistance, Conveyor.MachineCycle);
ReadAxisParameters
This function block reads all axis parameters into the AxisParameterStruct. The Y_Motion firmware library must be included in
a project that uses ReadAxisParameters.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the
Hardware Configuration (logical axis number).
V AxisParams AxisParameterStruct User Defined DataType declared in the PLCopen Toolbox.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
Inputs will be read only on the rising edge of
enable.
V AxisType TB_AxisType Indicates axis type: INT#0 (TB_
TB_AxisType#Servo AxisType#Servo)
TB_AxisType#VFD
TB_AxisType#Stepper
TB_AxisType#Virtual
TB_AxisType#External
V ParamTypes WORD Used to include additional parameter sets, such as WORD#0
Notes
Only AxisType#Servo, AxisType#External, AxisType#Virtual are supported.
By default, the function will update all parameter types in the AxisParamStruct. For efficiency, parameters are grouped into
types. Basic, Status, and Cam. For axes that are not cam slaves, there is no need to read the cam parameters. To cause the
function to skip the update of a parameter group, set the corresponding bit high. For example, the following function block
will not read the cam parameters:
Error Description
See the Function Block ErrorID list.
ReadMotorSpeed
This function block reads the rated and peak speeds of a Sigma-5 motor connected to the controller.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in the Hardware
REF Configuration (logical axis number).
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trigger
the execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes con-
trol before the action is completed, the Done output will not be set. This output is reset when
Execute goes low.
Error Description
See the Function Block ErrorID list.
Example
The example below shows the ReadMotorSpeed function block reading the rated and peak speeds of an SGMAV motor.
Reverse_MC_Direction
This function block was designed for use with the Home_LS_Pulse function block in the PLCopen Toolbox. It changes the enu-
merated type MC_Direction#positive_direction to MC_Direction#negative_direction or vice versa so that the function can move
the motor one direction into a limit switch with MC_StepRefLimit, and the other direction when searching for the Index Pulse
with MC_StepRefPulse.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B EN BOOL Enables the function. FALSE
V LimitDirection INT INT / ENUM MC_Direction#positive_direction or MC_Dir-
ection#negative_direction
V BackOffDistance LREAL INT#0
VAR_OUTPUT
B ENO BOOL High if the function is executing normally.
V PulseDirection INT INT / ENUM MC_Direction#positive_direction or MC_Direction#negative_direction
V BackOffDirection LREAL
Error Description
No Errors will result, but if there is a problem with the ENum input for MC_Direction, then ENO will be FALSE.
VelocityLimits
This function block enables or disables the velocity limit function. It also allows continuous streaming of new velocity limits.
This block uses MC_WriteBoolParameter, MC_ReadBoolParameter, MC_WriteParameter, and MC_ReadParameter.
Library
PLCopen Toolbox
Parameters
* Parameter Data Description
Type
VAR_IN_OUT
B Axis AXIS_ Logical axis reference. This value can be located on the Configuration tab in
REF the Hardware Configuration (logical axis number).
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
V LimitVelocityEnable BOOL Enables / Disables the velocity limit function FALSE
in the motion engine.
V LimitVelocityPositive LREAL The maximum commanded velocity allowed LREAL#0.0
V LimitVelocityNegative LREAL The minimum commanded velocity allowed LREAL#0.0
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the func-
tion are valid.
V LimitPositionEnableEcho BOOL Status of the Velocity Limit function from the motion engine.
V LimitPositionPositiveEcho LREAL Value used by the motion engine for the maximum allowed commanded velo-
city.
V LimitPositionNegativeEcho LREAL Value used by the motion engine for the minimum allowed commanded velo-
Notes
The function block uses MC_ReadBoolParameter, MC_WriteBoolParameter, MC_ReadParameter, and MC_WriteParameter.
• The software velocity limits are managed by the MPieciec controller. The parameters are called LimitVelocityPositive and Lim-
itVelocityNegative, with values of UINT#1211 and UINT#1210 respectively. Use the MC_WriteParameter function block for
these and all controller side parameters. Velocity limit parameters are in user units / sec.
• When a velocity limit is exceeded, a controller alarm will be generated, obtainable via the MC_ReadAxisError function block,
or the web server.
• The controller alarm will be 16#3202 0003 if the positive velocity limit is exceeded and 16#3202 0004 if the negative velo-
city limit is exceeded.
Y_DigitalCamSwitch
This function block commands a group of discrete output bits analogous to a set of mechanical cam controlled switches driven
by a rotating shaft. Forward and backward movements are allowed. A maximum of 32 outputs and 256 switches are sup-
ported. Starting in v340, support was added to include the FT62, a specialized high speed output capability of the Sigma 7 Ser-
voPack.
Library
PLCopen Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
B Axis AXIS_REF Logical axis reference. This value can be located on the Configuration tab in the Hard-
ware Configuration (logical axis number).
B Switches CAMSWITCH_ Reference to the switching actions. 256 maximum switches.
REF
E TrackOptions TRACK_REF Reference to the track related properties. 32 maximum tracks.
VAR_INPUT Default
B Enable BOOL The function will continue to execute while enable is FALSE
held high.
Notes
• This functionality is sometimes called PLS – Phase or Position or Programmable Limit Switch.
• Switches will be evaluated for both forward and reverse travel of the axis.
• OnCompensation and OffCompensation will only be applied when the axis is moving in the Positive Direction.
• When change tracknumber and reverse signal of any switch, Sigma7_FT62 feature requires controller reboot.
• The function block 'Output' is not supported by Sigma7_FT62 and not output bit can be observed for this feature.
Restrictions
If the output specified in the PLS is also controlled somewhere else in the project then the last instruction wins. This would
also be the case when a single output is used in two PLS blocks.
The PLS block will support a maximum of 256 switches and 32 outputs. This means that the block will react to a maximum of
512 positions (two for each switch).
If the cam-like lobes of multiple switches intersect with each other for a single track the net effect would be an OR-ing of the
switches.
Example1 SW1: on at 10, off at 50, SW2: on at 20, off at 30; net effect on at 10 off at 50.
Example2 SW1: on at 10, off at 50, SW2: on at 40, off at 60; net effect on at 10 off at 60.
Operation
On the rising edge of Enable, the input data will be checked against restrictions. The busy output will remain on until at least 1
track is enabled and the FB is controlling the outputs, then the InOperation bit will be set and the busy bit reset.
While the Enable is on, the EnableMask value will be read each scan and effect the output control.
On the falling edge of Enable, all outputs will be reset (turn off), and the InOperation, Busy, and Error bits will be reset.
ErrorID output will be set to 0.
CAMSWITCH_STRUCT[].TrackNumber
CAMSWITCH_STRUCT[].CamSwitchMode
AXIS_REF
CAMSWITCH_REF.MasterType
CAMSWITCH_REF.MachineCycle
CAMSWITCH_REF.LastSwitch
CAMSWITCH_STRUCT[].FirstOnPosition
CAMSWITCH_STRUCT[].LastOnPosition
CAMSWITCH_STRUCT[].Duration
CAMSWITCH_STRUCT[].FirstOnPosition
TRACK_STRUCT[].OnCompensationScaler
TRACK_STRUCT[].OffCompensationScaler
Enable
EnableMask
AxisDirection must be 0, any other number will default to 0. (values 1 and 2 not supported.)
Error Description
See the Function Block ErrorID list.
Example 1:
Consider the PLS requirement shown in the figure below. There are 4 tracks (0, 1, 2, 3) in the set up and a total of 5 switches
(0, 1, 2, 3, 4).
Example 2:
If speed compensation needs to be applied to individual tracks, it can be accomplished by specifying either OnCom-
pensationScaler or OffCompensationScaler in the TRACK_REF data type (TrackOptions in Y_DigitalCamSwitch). An example of
applying a -0.06 OffCompensation on track 1 and 0.05 OnCompensation on track 3 is shown below.
Y_DigitalCamSwitch Sigma7_FT62
PLS_Switches.LastSwitch N/A
PLS_Switches.MachineCycle N/A
PLS_Switches.MasterType N/A
PLS_Switches.Switch[0].TrackNumber OutputFunction
PLS_Switches.Switch[0].AxisDirection OutputFunction
PLS_Switches.Switch[0].Duration OutputTime
PLS_Switches.Switch[0].FirstOnPosition OutputPosition
PLS_Switches.Switch[0].LastOnPosition OutputPosition/OutputDistance
PLS_TrackOptions.Track[0].OnCompensationScaler OutputPositionCompensation
PLS_TrackOptions.Track[0].OffCompensationScaler N/A
PLS_TrackOptions.Track[0].Value N/A
PTB_Initialize
This is not a function block but a Program POU in the PLCopen Toolbox. Its purpose is to reduce the time required to enter ini-
tialization code into your project. If you use the provided datatypes, time can be saved by copying and pasting structured text
code from this POU into your Initialization POU, then replacing the string “Replace_Me" with another name meaningful to the
application.
This POU is not intended to be selected for execution in a task in your application program.
Firmware libraries:
l YMotion
User libraries:
The following User Libraries must be listed above the Winding Toolbox and in the following order:
Block Diagram
This diagram shows how a complete system can be controlled using the various functions contained in the winding toolbox.
DiameterCalculation
The DiameterCalculation function block provides a diameter for a winding roll by calculating the diameter from a line pulse and
the winder pulse. It updates based on the revolutions incurred at the winding or unwinding roll. As the diameter increases,
the speed of the motor decreases to maintain a constant web speed across the system. Likewise as the diameter decreases,
the motor speed increases to maintain a constant web speed.
Library
Winding Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V DiameterSet BOOL The function will be on when current diameter is set. FALSE
V LinePulse LREAL Set position feedback from encoder on the line. LREAL#0.0
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Notes
Error Description
See the Function Block ErrorID list.
Example
Set the initial value of the diameter before executing DiameterCalculation. An initial diameter is maintained until three rotata-
tions after an operation start, then the diameter is updated every three rotations.
DrawRoll
The DrawRoll function block provides the velocity for a draw roll with draw ratio. This method stabilizes a moving web by con-
trolling tension. Based off of a ratio to the line master, the DrawRoll optimizes the web that is fed into a cut roll.
Library
Winding Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V BaseSpeed LREAL The BaseSpeed input is a base speed. LREAL#0.0
V DrawRatio LREAL The ratio for the BaseSpeed. For example 0.01 is 101% & - LREAL#0.0
0.01 is 99% of base speed.
V Rate LREAL Acceleration/Deceleration per scan. The time required for LREAL#0.0
the SpeedRef to become the DrawSpeed value profile
depends on the Rate Input and the interval (Application task
rate) at which the DrawRoll function block is being run.
(User Unit/sec )
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
V AtDrawSpeed BOOL The AtDrawSpeed output will be high once the BaseSpeed is met.
V SpeedRef BOOL This output provides the real time speed that the DrawRoll FB is moving.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
Notes
l The DrawRoll speed is calculated by multiplying the base speed by the draw ratio speed. This helps to provide a con-
stant tension along the entire web.
Error Description
See the Function Block ErrorID list.
Example
A BaseSpeed is converted to a SpeedRef that is multiplied the DrawRatio. The rate of 1 unit specifies that the output value is
expected to increase at the rate of 1 unit per application scan.
LineMaster
The LineMaster function block provides the velocity for a line master with S curve acceleration and deceleration.
Library
Winding Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V E_Stop LREAL From the safety circuit of the machine. LREAL#0.0
V TargetSpeed LREAL Commanded speed of the Line Master in user units. LREAL#0.0
V Parameters LineMasterStruct The LineMasterStruct parameters are used for ini- All zeros in
tialization of the LineMaster FB. structure
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of
the function are valid.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when
Done, CommandAborted, or Error is true. In the case of a function
block with an Enable input, a Busy output indicates the function is
operating, but not ready to provide Valid information. (No Error)
V SpeedRef LREAL This is the actual speed of the Line Master.
V AtTargetSpeed BOOL This output turns on once the Line Master has reached the Tar-
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset
when 'Execute' or 'Enable' goes low.
Notes
l The line master speed becomes a standard speed of the entire line. The speed reference for all axes are based on the
line master speed.
l An SLAU function block from the Yaskawa Toolbox is used in the LineMaster function block. See the SLAU function block
help for how to set Normal_Rate and Shape_Time.
Error Description
See the Function Block ErrorID list.
Example
ProcessRoll
The ProcessRoll function block provides the velocity for a tension cut roll with PI control.
Library
Winding Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V Inverse BOOL This input is dependent upon the PI output of the feed- FALSE
back device.
V BaseSpeed LREAL The BaseSpeed input is the Line Master Speed after cal- LREAL#0.0
culating the control gains.
V PI_SetPoint LREAL Defines the process support module baseline value. LREAL#0.0
V PI_FeedBack LREAL Scaled input from the process support module, usually a LREAL#0.0
dancer or loadcell.>
V PI_Parameters PI_Struct Proportional and Integral gain parameters used for the All zeros
roll. in Structure
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
V PI_AtLimit BOOL Indicates that the axis has reached the designated PI Limit.
V SpeedRef LREAL Real time speed that the process roll is moving.
V PI_Value LREAL Provides the PI value from the support module, usually a dancer or load-
Notes
l The dancer roll is used to adjust the speed reference used by the Tension cut roll. In this manner, the LineMaster
speed remains constant, while the Dancer roll accumulates any slack and adjusts the Tension cut roll speed. This Pro-
cessRoll function block can also be used for a load cell feedback.
Error Description
See the Function Block ErrorID list.
Example
Firmware libraries:
l YDeviceComm
l PROCONOS
User libraries:
l None
Current Version:
2021-04-09 v372 released
1) DataSort FB - Fixed Watchdog caused when X variables are equal to each other. DCR 5175.
Previous Versions:
2020-11-02 v371 released
1) TemperatureControl FB - Should not output a control value when not Enabled. DCR 2533.
2) TemperatureControl FB - Fixed possible stuck in Autotuning condition after 1st cycle in oven application. DCR 2675.
3) CTU Counter Enchancement - Added CTU_Retained, CTD_Retained, and CTUD_Retained to Yaskawa toolbox. DCR 2838.
7) SLAU - Improved to work in both positive and negative direction. DCR 3054.
10) TemperatureControl FB - Description for AutoTuning and Busy outputs were incorrect. DCR 3082.
11) TemperatureControl FB - FileRemove error results if multiple FB instances are using the same DeviceName. DCR 3085.
12) TemperatureControl FB - Report an error condition if it doesn't detect change in feedback when applying a control output.
DCR 3111.
13) IsNumeric / IsInteger FBs were not returning correct value if InputString was zero length. DCR 3643
14) IsNumeric / IsInteger FBs were not reporting string like "5." correctly. DCR 3684
2017-12-08 v341 released (filename is still 340, using new project version control numbering)
1) STRING_TO_BOOL - New FB added. DCR 1068. converts false, FALSE, true, TRUE, 0, 1, BOOL#1, BOOL#0 to BOOL datatype
3) Blink - DCR 1221. Add handling for Rollover of uSec DINT value from +2147483647 to -2147483648. At 2msec MLink,
rollover occurs every approx 70 minutes. Without this fix, the output freezes.
1) Blink - Support Mechatrolink rates less than one millesecond. DCR 825.
2) CheckSumCalculate and CheckSumValidate - Updated to include a new method for two's compliment in hexadecimal.
2) LAU - new function block added. Creates a linear profile from current value to target value based on rate/scan input
3) SLAU - new function block added. Creates an s-curve (moving average profile) from a current value to target value.
5) Removed references to the Math Toolbox to simplify usage. NOTE: This change makes version 204 and higher incom-
patible with MP2600iec firmware versions 2.0, 2.1, and 2.2!
4) Fixed bug in XY Lookup (Min and Max were not getting reset for each scan.)
3) Changed MovingAverage to always divide by the number of samples specified by the user. Old methods divided by the
number of actual samples until the entire buffer had been filled.
4) Changed the Blink functions frequency input to REAL datatype and the value now accepts a frequency. (Before it was TIME
datatype)
6) Added error checking to WindowCheck FB to ensure Window value is greater than zero.
2) Improved MovingAverage to not require a FOR LOOP to initialize the buffer at rising edge of ENABLE
4) Included ProConOS firmware library to use the Real Time Clock function, provided FB to convert RTC from STRING TO
STRUCT
7) Added XYLookup, which is equivalent to the FGN function in the standard MP series
8) Added DataSort, to arrange the data for use with XYLookup if it has been collected out of order.
9) Added DataRecord to capture XY data by either streaming or when the Trigger input goes high.
10) Fixed MovingAverage - it was not properly subtracting old and adding new values.
Improved templates with new, reduced logic that does not use SET or RESET coils.
Changed functions for MP2600 compatibility by removing EN / ENO and adding MOVE_UINT.
Shell code with all logic to replicate the behavior of PLCopen FB with Execute, Busy, Done, Error, & ErrorID outputs
Execute_ST_Template:
Shell code with all logic to replicate the behavior of PLCopen FB with Execute, Busy, Done, Error, & ErrorID outputs
Action:
Action
This function block is only for demonstration purposes. It is applied in the Enable_F_
Template, Enable_ST_Template, Execute_FB_Template, and Execute_ST_Template
function blocks to show how the inputs and outputs of nested functions can be inter-
locked to apply the PLCopen standards for I/O behavior.
Library
Yaskawa Toolbox
Error Description
Example
Action
This function block is only for demonstration purposes. It is applied in the Enable_F_
Template, Enable_ST_Template, Execute_FB_Template, and Execute_ST_Template
function blocks to show how the inputs and outputs of nested functions can be inter-
locked to apply the PLCopen standards for I/O behavior.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are read and the func- FALSE
tion is initiated. To modify an input, change the value and re-trigger the
execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
control before the action is completed, the Done output will not be set. This output is
reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a
Busy output indicates the function is operating, but not ready to provide Valid inform-
ation. (No Error)
B CommandAborted BOOL Set high if motion is aborted by another motion command or MC_Stop. This output is
Error Description
Example
Blink
This function block will toggle the Output at the frequency specified at the input. If Fre-
quency is set to 1.0, then the output will be on for 500 mSec and off for 500 mSec.
Note that the actual frequency may be affected by the application scan rate in which
this function block is placed.
Library
Yaskawa Toolbox
Parameters
Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held high and FALSE
there are no errors.
V Frequency REAL The cycle rate in Hertz. REAL#0.0
VAR_OUTPUT
B Valid BOOL Indicates if the function is operating.
V Output BOOL Toggled at the specified frequency when the function is enabled.
Error Description
The valid output will be high if the function is operating. If Enable is held high and the
Frequency is not greater than zero, the valid output will be low.
Blink_1 was placed in a 10 mSec task so the expected output is 50 mSec on and 50
mSec off which corresponds to 10 cycles.
ByteSwap
This function block swaps the upper and lower byte of a word.
Library
Yaskawa Toolbox
Parameters
Parameter Data Type Description
VAR_INPUT Default
V WordIn WORD Input word WORD#0
VAR_OUTPUT
V WordOut WORD Output word
Error Description
Example:
CommWatchDog
This function block allows the application program to monitor data being transmitted
from a master device. If the data does not change within the TimeOut period, then
the OK output goes off to indicate that the communications is not being updated by
the master.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V HeartBeat DINT Value that the master changes and sends to the MPiec controller. DINT#0
V WatchDog DINT The HeartBeat input must change value within the WatchDog DINT#0
period for communications to be considered OK.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
V OK BOOL Indicates if the HeartBeat input has changed within the TimeOut period.
The Valid Output will be high when the function is executing. If the WatchDog value is
not greater than zero, the function will not operate.
Example
DataRecord
This function block will record Data into the array. Data can be stored continuously or
intermittently. The default datatype for Data to be recorded can be customized by
the user to satisfy other recording needs.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V Data XYDataStruct Structure where recorded data is stored.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V DataSize INT The maximum amount of data to be stored, which INT#0
must be less than or equal to the datatype definition
for Data.
V NewData XYData Structure containing a single pair of X and Y data to n/a
be added to the XYDataStruct.
V Stream BOOL If TRUE, the function will store NewData every applic- FALSE
Error Description
Example
DataSort
This function block will sort data from the lowest to highest value of X data. This gen-
eric function can be customized for other sorting needs.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V Data XYDataStruct Structure where recorded data is stored.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block
takes control before the action is completed, the Done output will not be set. This out-
put is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
Notes
Error Description
The default version of this block produces no errors (customizing this block may add
errors depending on what functions are used internally).
DateCompare
This function block will calculate the difference between two real time clock values
and provide the difference as a real time clock value. The clock values may be
obtained using the RealTimeClock function block.
Library
Yaskawa Toolbox
Parameters
Parameter Data Type Description
*
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held FALSE
high and there are no errors.
V Clock1 RTCStruct The more recent real time clock value. All zeros
in struc-
ture
V Clock2 RTCStruct The older real time clock value. All zeros
in struc-
ture
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function
are valid.
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
Error Description
DEC_TO_HEX
This function block converts DINT numeric input into a hexadecimal STRING output.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V DecimalNum DINT Input value to be converted. DINT#0
V UpperCase BOOL If True, the output string will contain upper case ASCII FALSE
characters. If False, the output string will contain lower
case ASCII characters.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V HexString STRING String containing the hexadecimal representation of DecimalNum.
V OutputByteArray YTB_ Byte array containing the same ASCII values as in the OutputString.
ByteArray8
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
or 'Enable' goes low.
Error Description
This function block may output ErrroIDs from the BUF_TO_STRING function used
internally.
Enable_FB_Template
This function block is a template which can be used when developing functions which
adhere to the PLCopen output behavior.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
Error Description
This is an example function block template with no specific errors of its own.
For full documentation about how to create PLCopen compliant function blocks, see
this application note (AN.MWIEC.01) on www.yaskawa.com.
Enable_ST_Template
This function block is a template which can be used when developing functions which
adhere to the PLCopen output behavior.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
Error Description
This is an example function block template with no specific errors of its own.
For full documentation about how to create PLCopen compliant function blocks, see
this application note (AN.MWIEC.01) on www.yaskawa.com.
Execute_FB_Template
This function block is a template which can be used when developing functions which
adhere to the PLCopen output behavior.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block inputs are read and the FALSE
function is initiated. To modify an input, change the value and re-trig-
ger the execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another
block takes control before the action is completed, the Done output will not be set.
This output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable
input, a Busy output indicates the function is operating, but not ready to provide
Valid information. (No Error)
B CommandAborted BOOL Set high if motion is aborted by another motion command or MC_Stop. This output
is cleared with the same behavior as the Done output.
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
Notes
Depending on the exact usage, there may be outputs in the template that will not
apply, such as CommandAborted. Determine what outputs are necessary for your
situation and make modifications accordingly.
Error Description
This is an example function block template with no specific errors of its own.
Example
For full documentation about how to create PLCopen compliant function blocks, see
this application note (AN.MWIEC.01) on www.yaskawa.com.
Execute_ST_Template
This function block is a template which can be used when developing functions which
adhere to the PLCopen output behavior.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function block FALSE
inputs are read and the function is initiated. To
modify an input, change the value and re-trig-
ger the execute input.
VAR_OUTPUT
B Done BOOL Set high when the commanded action has completed successfully. If another block takes
control before the action is completed, the Done output will not be set. This output is
reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable input, a
Busy output indicates the function is operating, but not ready to provide Valid inform-
ation. (No Error)
B CommandAborted BOOL Set high if motion is aborted by another motion command or MC_Stop. This output is
cleared with the same behavior as the Done output.
Notes
l Initialization
Depending on the exact usage, there may be outputs in the template that will not
apply, such as CommandAborted. Determine what outputs are necessary for your
situation and make modifications accordingly.
Error Description
This is an example function block template with no specific errors of its own.
Example
For full documentation about how to create PLCopen compliant function blocks, see
this application note (AN.MWIEC.01) on www.yaskawa.com.
Explicit_Message
This function block will write/read a block of data to/from an Ethernet/IP Target
(Adapter) device via Explicit Messaging. Unlike Implicit Messaging (a built in feature
of the MPiec Series Controllers) which uses the UDP protocol, Explicit Messaging uses
TCP/IP.
This function block emulates the MSG function block in the AB RSLogix platform. The
Explicit_Message function block is best suited when an application requires unsched-
uled and less frequent updates like recipe transfer, cam table transfer, job transfer
etc. Explicit Messaging makes use of a request/response format for communication.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V SourceElement ExplicitData When writing a message to the Target (Adapter), SourceElement is the data (as
an array of bytes) that the Scanner (MPiec Controller) will send to the Target.
V Destination ExplicitData When reading a message from the Target (Adapter), the Destination Element is
the data (as an array of bytes) where the Scanner (MPiec Controller) will copy the
data from the Target.
VAR_INPUT Default
B Execute BOOL Upon the rising edge, all other function FALSE
block inputs are read and the function is ini-
tiated. To modify an input, change the value
and re-trigger the execute input.
V AdapterIPAddress STRING IP Address of the Target device. STRING#''
V ServiceCode BYTE Code for the particular service type as BYTE#0
defined for a CIP message. The value can
be obtained from the Target's (Adapter's)
documentation.
V Class BYTE Class parameter of a CIP Generic message. BYTE#0
The value can be obtained from the Target's
(Adapter's) documentation.
V Instance BYTE Instance parameter of a CIP Generic mes- BYTE#0
sage. The value can be obtained from the
Target's (Adapter's) documentation.
V Attribute BYTE Attribute parameter of a CIP Generic mes- BYTE#0
sage. The value can be obtained from the
Target's (Adapter's) documentation.
V SourceLength INT The number of bytes to be written to the Tar- BYTE#0
get. This is the actual data size required,
not the full size of the SourceData DataType.
VAR_OUTPUT
B Done BOOL The done bit is set high when the last packet of the message is successfully trans-
ferred.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, Com-
mandAborted, or Error is true. In the case of a function block with an Enable
input, a Busy output indicates the function is operating, but not ready to provide
Valid information. (No Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
'Execute' or 'Enable' goes low.
V Status DWORD Indicates if the Target was able to execute the requested command. A value of
zero indicates successful execution of the command by the remote device.
V Response WORD Response from the Target.
V ResponseStatus WORD Status of the response from the Target.
Notes
l The Explicit_Message function block uses the Y_DeviceComm firmware library. This firmware library must be added to
your project. Y_DeviceComm was incorporated into firmware version 2.1.0 and has been included as a firmware lib-
rary starting in MotionWorks IEC v2.1.0.
l Enter parameters as entered in Message Configuration for the MSG function block in AB RSLogix software.
l See Yaskawa's Youtube webinar - EtherNet/IP Explicit Messaging for more info.
Example 1
HEX_TO_DEC
This function block converts a hexadecimal STRING into a base 10 output value as a
DINT.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V HexString STRING Input hexadecimal string. Can only contain values 0-9, A-F, and a- STRING#''
f. A maximum of 8 characters is allowed, because this would rep-
resent the maximum value of a DINT as STRING#'FFFFFFFF'
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
V DecimalNum DINT Output value from hexadecimal conversion.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
Error Description
This function may output ErrorIDs from the STRING_TO_BUF Status output used
internally.
IsInteger
This function block checks if InputString is an integer (Any non floating point value
such as BYTE, SINT, INT, UINT, DINT, UDINT). If InputString is an integer, Result will
be set high. This function block is useful when preparing to copy string data into other
datatypes using the STRING_TO_* functions. If the data is corrupt or not an integer
when using the STRING_TO_ functions, a String Conversion Exception will occur. This
function block helps to eliminate that risk.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B EN BOOL The function will continue to execute every scan while Enable FALSE
is held high and there are no errors.
V InputString STRING Input string to be tested. STRING#''
VAR_OUTPUT
B ENO BOOL Indicates that the function is operating normally and the outputs of the function are valid.
V Result BOOL Result will be TRUE if the string is convertible to an integer.
The PROCONOS firmware library must be added to the project, otherwise, the com-
piler error "A function block POU "STRING_TO_BUF" is referencing a sub function, but
the library containing the function is not included."
Library
If InputString is numeric, Result will be set high. This function block is useful when pre-
paring to copy string data into other datatypes using the STRING_TO_* functions. If
the data is corrupt or not a valid number when using the STRING_TO_ functions, a
String Conversion Exception will occur. This function block helps to eliminate that risk.
Valid strings may include a '+', '-' or '.' character as the first character, otherwise
every character must be between or including '0 -9'. If there is an 'E' for scientific
notation, another '+' or'-' may immediately follow the 'E'.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B EN BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V InputString STRING Input string to be tested. STRING#''
VAR_OUTPUT
B ENO BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V Result BOOL Result will be TRUE if the string is convertible to a number.
The PROCONOS firmware library must be added to the project, otherwise, the com-
piler error "A function block POU "STRING_TO_BUF" is referencing a sub function, but
the library containing the function is not included."
LAU
This function block generates a linear ramp from a current value to the target value
with a slope based on the Rate input on the function block. The input can be con-
tinuously update on the fly.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held FALSE
high and there are no errors.
V Input LREAL Target value. LREAL#0.0
V Rate LREAL Acceleration/Deceleration per scan. The time required for the Output LREAL#0.0
to become the Input value profile depends on the Rate Input and the
interval (Application task rate) at which the LAU function block is being
run.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
Error Description
Example 1
The figure shown below illustrates how the LAU block can generate a ramp output
even if the Input value instantaneously changes from 0 to 10. The rate of 1 unit spe-
cifies that the output value is expected to increase at the rate of 1 unit per application
scan.
The figure shown below shows the effect of a ramp of 0.2 units per scan. The signal
takes 50 application scans to reach 10 units from an initial value of 0.
MovingAverage
This function block will provide the MovingAverage of a series of samples. The
NewValue can either be streamed continuously or updated only when the Trigger
input goes high.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held FALSE
high and there are no errors.
V NewValue LREAL The new value to be added to the total LREAL#0.0
V SampleSize UINT The total number of values to total UINT#0
V Trigger BOOL To indicate when a NewValue should be added to the total FALSE
V Stream BOOL To indicate if the NewValues should be added to the total every scan. FALSE
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V MovingAverage LREAL The moving average of all the samples.
B Error BOOL Set high if an error has occurred during the execution of the function block. This out-
put is cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute'
or 'Enable' goes low.
See Yaskawa's YouTube webinar - MPiec Web Tension Control Applications for more
info on using this function block.
Error Description
Example
The MovingAverage function acts as a smoothing filter. In this example, the Sweep
function will increment by 5 each cycle. The Sweep function will continue to increment
the OutputValue until it has reached 100.
The Moving average function has a sample size of 50 which means that if Sweep
reaches its maximum value after 19 cycles, MovingAverage will output the maximum
value after 69 cycles. By looking at the Logic Analyzer plot below, notice there is a 5
cycle pre-record that must be taken in to account: 74 - 5 = 69 cycles.
PackByte
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
V Bit0 BOOL Bit 0 of the BYTE to be output FALSE
V Bit1 BOOL Bit 1 of the BYTE to be output FALSE
V Bit2 BOOL Bit 2 of the BYTE to be output FALSE
V Bit3 BOOL Bit 3 of the BYTE to be output FALSE
Error Description
Example
PackWord
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
V Bit0 BOOL Bit 0 of the WORD to be output
VAR_OUTPUT
V OutputWord WORD The resulting WORD of the input bits
Error Description
PIDControl
This function block can be used as a generic control loop feedback mechanism. A PID
controller calculates an "error" value as the difference between a measured process
variable and a desired set point, or reference. PIDParameters must be adjusted to
allow the process to provide the proper ControlOutput for a given error situation.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable FALSE
is held high and there are no errors.
V PIDParameters PIDStruct Structure containing all the information for PID control block N/A
to operate
V Reference LREAL Setpoint for the PID control loop. LREAL#0.0
V ProcessValue LREAL Real world value to be compared with the Reference in the LREAL#0.0
control loop
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the
function are valid.
V ControlOutput LREAL Output value from the PID control block. The range of values will be gov-
erned by the PID parameters, especially the upper and lower limit.
B Error BOOL Set high if an error has occurred during the execution of the function
block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when
Notes
l All time parameters in the PIDStruct (Ts, Td1, and Td2) must be in the same
units, i.e seconds or ms.
l See Yaskawa's Youtube webinar - MPiec Web Tension Control Applications for
more info on using this function block.
Example
ControlOutput of zero *)
Symbol Specification
X’: previous input value; Yi’: previous I output value; Ts: scan time set value
PWM
This function block can be used for generally lower performance PWM requirements.
For higher performance PWM applications, consider a SLIO PWM remote I/O module.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held high FALSE
and there are no errors.
V DutyCycle UINT DutyCycle / MaxWidth indicates the percentage of time the output will be UNIT#0
on.
V MaxWidth UINT The maximum DutyCycle that can be applied. The task interval in which UINT#0
this function block is executed will dictate the cycle period.
VAR_OUTPUT
V Output BOOL The output value.
Errors
Example
RangeCheck
This function block will set the output 'InRange' if the Value input is between the Min-
imum and Maximum. The check is inclusive, meaning that if Value=Minimum or
Value=Maximum, then the InRange output will be on.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is FALSE
held high and there are no errors.
V Minimum LREAL The smallest 'Value' that will set the InRange output high. LREAL#0.0
V Value LREAL The data to be tested against the Minimum and Maximum. LREAL#0.0
V Maximum LREAL The largest 'Value' that will set the InRange output high. LREAL#0.0
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
V InRange BOOL Indicates if the Value is between the Minimum and Maximum. (Inclusive)
Example
RateCalculator
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every FALSE
scan while Enable is held high and there are
no errors.
V Sensor BOOL Periodic signal to be measured. Commonly a
"part-complete" sensor.
V TimePeriod_ DINT Sensor is measured with respect to this time
ms window (milliseconds) to determine the cur-
rent real-time rate.
VAR_OUTPUT
Notes
Upon enabling or a change of the time period, the 'Busy' signal remains active until
the specified time period elapses, whereupon 'Busy' will go low and 'Valid' will go
high. This is to receive a complete initial measurement of the rate 'Sensor' /
'TimePeriod_ms'.
Error Description
RealTimeClock
This function block provides the controllers real time clock as an RTCStruct containing
year, month, day, hour, minute, second, and millisecond. This function uses the
RTC_S function, provided in the ProConOS firmware library, which returns the real
time clock as a string.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are valid.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is
cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
V Clock RTCStruct Structure containing year, month, day, hour, minute, second, and millisecond.
The controllers clock can be set from the web server, or by using the Y_SetRTC func-
tion block from the YMotion firmware library, which requires firmware version 2.0.0
or greater.
Error Description
Example
Scaler
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description
Type
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V Input LREAL The x variable of y:=mx + b. LREAL#0.0
V CalX1 LREAL Datapoint specifying a line along which data is to be LREAL#0.0
scaled.
V CalY1 LREAL Datapoint specifying a line along which data is to be LREAL#0.0
scaled.
V CalX2 LREAL Datapoint specifying a line along which data is to be LREAL#0.0
scaled.
Notes
l This function can be used with temperature sensors or any analog value that
must be adjusted before further processing takes place.
l m is determined by the slope of a line specified by Cal_X1, Cal_Y1, Cal_X2, Cal_
Y2.
l x is the 'Input'
l b is determined by calculating the Y intercept of the line.
Error Description
Example
SLAU
This function block generates an S-curve profile to the input value based on a moving
average calculation. First, a slope is calculated based on the ramp input. Second, a
moving average is applied to the ramp profile. The input value can be changed con-
tinuously on the fly.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Description Default
Type
VAR_INPUT
B Enable BOOL The function will continue to execute every scan while Enable is held FALSE
high and there are no errors.
V Input LREAL Target Value. LREAL#0.0
V Rate LREAL Acceleration/Deceleration per scan. The time required for the Output LREAL#0.0
to become the Input value profile depends on the Rate and S_Scans
Inputs and the interval (Application task rate) at which the LAU func-
tion block is being run.
V S_Scans UINT Number of scans for the moving average calculation (S-Curve). UINT#0
VAR_OUTPUT
Error Description
Example 1
An example of a step input converted to a smooth s-curve by the SLAU function block
is shown below. The 0 to 10 unit step change is converted to a smooth s-curve profile
with a 20 scan ramp and an additional 20 scan s-curve (moving average). Output of
the LAU function block with a similar rate input is also shown.
Sweep
This function block generates an output that rises and falls between the minimum
and maximum outputs specified by the inputs. The OutputValue is the changed by
the Increment input. This function block is useful for testing purposes by forcing
other portions of application code to be tested with a full range of expected values.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held FALSE
high and there are no errors.
V StartValue LREAL The OutputValue will start from this value. LREAL#0.0
V Increment LREAL The amount by which the Outputvalue is changed each scan. LREAL#0.0
V Minimum LREAL The minimum value output. LREAL#0.0
V Maximum LREAL The maximum value output. LREAL#0.0
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function
are valid.
V OutputValue LREAL The output of the function.
B Error BOOL Set high if an error has occurred during the execution of the function block. This
output is cleared when 'Execute' or 'Enable' goes low.
Error Description
Example:
TemperatureControl
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V TC_Parameters AutoTuneStruct Structure containing the parameters for operating the Temperature Control
function.
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while FALSE
Enable is held high and there are no errors.
V Mode INT 0: Normal operation. The function block looks for a pre- INT#0
viously stored DeviceName file and runs. If the file is not
found, then an Autotuning process starts. Upon successful
autotuning, the system runs normally.
1:Force autotuning before running, even if the DeviceName
file already exists.
Notes
formance is desired.
l If loading autotuning parameters from a file. the DeviceName must be the
same as the filename on the controller.
l DeviceName cannot be left empty.
l RewritePrms must be toggled for every new write. When toggled, it will write
whatever data is in the TC_Parameters into the file as long as tuning has been
completed.
l Note that it is possible for the user to write garbage data to the file, which
Flow Diagram
Error Description
Hardware Setup
Initialization of Variables
Mode := INT#0; (* 0: Calculate gains and run, 1: Run without calculating gains *)
Initialization of AutoTuneParameters
The following graph shows the output power vs temperature value for the rise time,
tuning period, settling time, and then the ControlOutput compensation when the
extruder was intentionally cooled with a fan (artificial disturbance).
l Kp = 15.5
l Ki = 0.1
l Kd = 0.5
The following graph shows that it took 11 seconds to complete tuning and settled to
197.8 degrees in the following minute.
UnpackByte
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B InputByte BYTE The input data to be separated into bits. BYTE#0
VAR_OUTPUT
V Bit0 BOOL Bit 0 of the InputByte
Error Description
Example
UnpackWord
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B InputWord WORD The input data to be separated into bits. WORD#0
VAR_OUTPUT
V Bit0 BOOL Bit 0 of the InputWord
V Bit1 BOOL Bit 1 of the InputWord
V Bit2 BOOL Bit 2 of the InputWord
V Bit3 BOOL Bit 3 of the InputWord
V Bit4 BOOL Bit 4 of the InputWord
V Bit5 BOOL Bit 5 of the InputWord
V Bit6 BOOL Bit 6 of the InputWord
V Bit7 BOOL Bit 7 of the InputWord
V Bit8 BOOL Bit 8 of the InputWord
V Bit9 BOOL Bit 9 of the InputWord
V Bit10 BOOL Bit 10 of the InputWord
V Bit11 BOOL Bit 11 of the InputWord
V Bit12 BOOL Bit 12 of the InputWord
V Bit13 BOOL Bit 13 of the InputWord
V Bit14 BOOL Bit 14 of the InputWord
V Bit15 BOOL Bit 15 of the InputWord
Error Description
WindowCheck
This function block sets the InWindiow output high if the InputValue is within +/- (Win-
dow/2) of the TargetValue. This function is useful when making a comparison that
only relies on the InputValue to be close to the Target, but an exact match is not
required.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan while Enable is held high FALSE
and there are no errors.
V InputValue LREAL The data to be tested against the TargetValue LREAL#0.0
V TargetValue LREAL The desired data to be compared against. LREAL#0.0
V Window LREAL This amount will be divided in two. The InputValue must fall within half LREAL#0.0
the window distance of the TargetValue for the InWindow output to go
high. Window must be greater than zero.
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V InWindow BOOL Indicates that the InputValue is within the TargetValue +/- (Window/2) inclusive.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output
is cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or
'Enable' goes low.
Example
XYLookup
This function block will do a binary search on the XYdata to find the X value, then out-
put the corresponding Y value. This function will perform linear interpolation if the X
value is between two data points in the XYData and calculate the appropriate Y value.
Library
Yaskawa Toolbox
Parameters
* Parameter Data Type Description
VAR_IN_OUT
V XYData XYDataStruct An array of X & Y data pairs
VAR_INPUT Default
B Enable BOOL The function will continue to execute every scan FALSE
while Enable is held high and there are no errors.
V X LREAL The input reference
VAR_OUTPUT
B Valid BOOL Indicates that the function is operating normally and the outputs of the function are
valid.
V Y LREAL The resulting output that relates the input.
Notes
Works for sets where the X value is always increasing or always decreasing, but to
use decreasing values of X requires v205 or higher.
Error Description
Example
ExplicitMessage Types
DataType: ExplicitData
END_TYPE
RegSessionRequestStruct
ExplicitReceiveDataStruct
Service
END_TYPE
ExplicitSendDataStruct
SenderContext
END_TYPE
UnRegSessionRequestStruct
ErrorID Description
0 No error.
1 Time limit exceeded.
2 Distance limit exceeded.
3 Torque limit exceeded.
4 The file is already opened.
5 The file is write protected or access is denied. Tip #1: Make sure a leading / has not been omit-
ted. Example STRING#'/flash/user/data/myfile.txt' Tip #2: If the FileName is a STRING variable,
do not include single quotes in the string. Only include single quotes if when specifying the
FileName as a literal such as STRING#'MyFile.txt'
6 File name not defined. Tip: If the FileName is a STRING variable, do not include single quotes in
the string. Only include single quotes if when specifying the FileName as a literal such as
STRING#'MyFile.txt'
17 Soft Limit Violation for group (position max).
Motion State Error
4369 The move could not be buffered because the motion queue is full. The default queue size for
single axis moves is 16. For Mechatrolink groups, the queue size can be set in the Hardware Con-
figuration, Yaskawa recommends setting the IO Task Assignment to the cyclic task with the fast-
est update interval. For MLX hosted robots, the queue size is 25.
4370 The move could not be started because motion is prohibited. Possible causes: 1) The axis may
not be enabled. Check MC_Power.Status output. 2) An MC_Stop.Execute might be held high - no
other block can override the Stopping state. 3) Verify that the limit switches are not active -
check the Global Variables for the Axis. 4) A motion block may be attempting to abort an MC_Tor-
queControl move. 5) If this axis is included in a set of Grouped axes, this Error may occur when
executing a single axis function block while the axis is part of an Enabled Group. Use MC_
GroupDisable first. 6) If the axis is a cam slave AND configured as a rotary axis, verify that the
slave positions in the Y_MS_CAM_STRUCT are within 0.0 to MachineCycle.
4371 The servo drive failed to enable or disable. Check the amplifier wiring for L1 / L2 / L3. The amp-
lifier could be e-stopped or has an alarm.
4375 CamOut called while not camming.
4376 The master slave relationship cannot be modified because the master axis has not been set yet.
4377 File reading already in progress.
4378 The function block is not applicable for the external axis specified.
4379 A homing sequence is already in progress.
4380 MC_SetPosition cannot be executed while the axis is already moving.
4381 Motion was aborted due to an axis alarm.
4382 When an axis is configured for rotary mode, and the MC_SetPosition tries to set a position that is
equal to or greater than the MachineCycle, this error is generated, and the position is not set.
4383 Axis must be commanded at standstill when homing is attempted. Refer to the Motion State Dia-
gram and MC_ReadStatus. Maybe the axis is not enabled using MC_Power?
The following is a list of alarm codes that are reported in the Hardware Configuration's Controller Alarms tab, Y_ReadAlarm and
MC_GroupReadError function blocks, and the webUI. These are non axis specific system alarms.