• No results found

Certain G & M codes will write data into MachineData.Spindle[]. This data is available for the user to access and customize the project. The only built in spindle features include:

l MC_MovePath waits until MachineData.Spindle[].SpeedOK is TRUE after executing a M3 / M4 / M5 command.

l Set MachineData.Spindle[].RPM to zero and restore it for ProgramStop events (M0, M1) and Feed Hold.

l In G97 mode, MC_MovePath Calculates MachineData.Spindle[].RPM.

* Element Data Type Description Usage

MyTools ToolStruct

U RPM REAL When G96 or G97 is received, the S register is

used to populate this value.

MyMachine.Spindle.RPM

U Override REAL For user customization. MyMachine.Spindle.Override

U Accel REAL For user customization. MyMachine.Spindle.Accel

U MaxPRM REAL Only used in Constant Surface Speed Mode. MyMachine.Spindle.MaxRPM

U SurfaceSpeed REAL When G96 is received, UnitCode is set to 0 to indic-ate 'Surface Speed' Mode

When G97 is received, UnitCode is set to 1 to indic-ate 'Feet Per Minute' Mode.

MyMachine.Spindle.SurfaceSpeed

U UnitCode INT When G96 is received, UnitCode is set to 0 to indic-ate 'Surface Speed' Mode

When G97 is received, UnitCode is set to 1 to indic-ate 'Feet Per Minute' Mode.

MyMachine.Spindle.UnitCode

U Direction INT Same as M03 (Clockwise Rotation), M04

(Coun-terClockwise Rotation).

MyMachine.Spindle.Direction

U Axis AXIS_REF For user customization. MyMachine.Spindle.Axis.AxisRef

U OrientationPosition LREAL Could come from an M19, or other method to move the spindle to a specific angle.

MyMachine.Spindle.OrientationPosition

U OrientationExe LREAL Set by MC_MovePath when an M19 is encountered.

MyMachine.Spindle.OrientExe

U OrientationDone BOOL To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.OrientationDone

U OrientationBusy BOOL To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.OrientationBusy

U OrientationAborted BOOL To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.OrientationAborted

U OrientationError BOOL To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.OrientationError

U OrientationErrorID UINT To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.OrientationErrorID

U ToolPresent BOOL Connect a BOOL to this structure item if there is a sensor mounted to detect a tool in the chuck.

MyMachine.Spindle.ToolPresent

U AtSpeed BOOL Indicates when the spindle motor is within a target speed so MC_MovePath can pause and wait for the spindle to get up to speed. For a basic example, see this spindle support section.

MyMachine.Spindle.AtSpeed

U FeedbackSpeed REAL To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.FeedbackSpeed

U FeedbackTorque REAL To be populated by the the template layer project code if the user wants to show this information on a GUI via the MachineStruct.

MyMachine.Spindle.FeedbackTorque

Help version created 2/3/2022 Configuration and Customization

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.

V PathData MC_PATH_DATA_

REF

Structure of data that contains the details for executing a path sequence.

Typically PathData is populated by a source function such as Read_

GCode_File, Read_GCode_Stream, but simple sequences could also be populated as a static script in ST code.

V VarData VariableArray An array of LREAL data which is only used with G Code applications where registers contain variable data. For such applications, connect

GCodeData.Variables from the Read_GCode_File function block to this VAR_IN_OUT. If this data is not applicable to the application, connect a dummy variable to satisfy the compiler.

VAR_INPUT Default

B Execute BOOL

Upon the rising edge, all other function block inputs are read and the function is initiated. To modify an input, change the value and re-trig-ger the execute input.

FALSE

V OperationMode INT Enumeration with the following meanings:

GTB_OperationMode#Forward

V SingleStep BOOL When OperationMode is set for SingleStepFwd, the function will execute one Segment from the PathData at each rising edge of SingleStep.

FALSE

V VelocityScaler REAL The 'FeedRate' element of each Segment is mul-tiplied by the VelocityScaler Input. Changes only affect new motion segments executed after a change to VelocityScaler, previous seg-ments already in the motion buffer will be executed at the Feedrate and VelocityScaler specified at the time they were processed. To change the velocity of the path segments already in the motion buffer at the firmware layer, use the MC_GroupSetOverride function block.

REAL#100.0

V StartSegment INT The first Segment of the PathData to use upon the rising edge of the Execute input. For fault recovery, set this to a non zero value to resume a path that was interrupted. Refer to PathData.Buffer.ExecutedSegment. Capture this value in the event of an Error or other interruption of the path and set it as the StartSegment to recover a path in progress.

INT#0

V InputFlags DWORD Specify up to 32 digital inputs which can be used to control path operations in conjunction with the following SegmentTypes:

V Abort BOOL Stops executing Segments and uses MC_

GroupStop to stop any ongoing motion. The CommandAborted Output will be set and motion cannot be started again until the Execute Input is toggled.

FALSE

V Pause BOOL This input puts MC_MovePath into an idle state

where it will no longer process new segments, but segments already executed and in the motion buffer will be unaffected and continue until the buffer is empty. This may result in a delay from the time Pause is set high until the group physically stops.

To Pause or "Interrupt" the group immediately, use the MC_GroupInterrupt function block sep-arately in the MotionWorks IEC project.

FALSE

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 out-put will not be set. This outout-put 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)

E 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 InputFlagsRequired DWORD For use as a debugging tool. This Output reports the InputConditions of the current Segment. For example, if the machine appears to be stuck, it is possible that the active Segment is waiting for a specific set of InputFlags to match before proceeding.

V OutputFlags DWORD PathData.Segment[].OutputFlags are copied to the OutputFlags Output based on the following conditions:

1) If motion is active, the OutputFlags associated with the Segment responsible for ongoing motion is applied. This technique relies on Group Parameters 2201 and 2202.

2) When there is no ongoing motion, the OutputFlags of the Segment being processed are applied.

V ProcessedLabel YTB_STRING16 If PathData.Segment[].Label was populated by the source, this Output reports a descriptive name of the Segment being processed. If this is a motion segment, the motion instruction is executed, but it does not mean that it is physically causing motion. It may be buffered behind many other motion instructions based on the path data.

V ExecutedLabel YTB_STRING16 If PathData.Segment[].Label was populated by the source, this Output reports a descriptive name of the Segment actually causing motion. In the case of other non motion Segment Types, ProcessedLabel and ExecutedLa-bel are likely equal to each other.

V ProcessedTotal UDINT Running count of the number of PathData.Segments[] processed since the rising edge of the Execute input. This value will likely be ahead of ExecutedTotal based on the path characteristics, and the size of the Group motion queue as configured in the Hardware Configuration.

V ExecutedTotal UDINT Running count of the number of PathData.Segments[] executed since the rising edge of Execute. The difference between the ProcessedTotal and ExecutedTotal is the number of motion blocks still in the motion buffer.

Notes

l Yaskawa recommends executing this function block in a fast task such as 4 or 8 mSec. Factors to consider when determining the ideal task interval include any InputFlag / OutputFlag usage, and the motion segment density relative to required velocity.

l This function block references information in AxesGroup.Status, which is updated by the firmware at the task interval configured in the Hardware Configuration. The IO task assignment must be set to the same or faster task interval as where the MC_MovePath function is executing, or errors such as 4369 may occur.

Additional information about OperationMode:

l It is possible to change ControlMode on the fly.

l When using GT_OperationMode#SingleStepFwd, if the SingleStep input is pulsed before a motion Segment has com-pleted, the request is not buffered and will be ignored.

l GT_OperationMode#InfiniteRepeat will permit MC_MovePath to remain Busy indefinitely (Done will not occur.) When the function reaches the last Segment as identified by comparing (PathData.Buffer.UsePointer = PathData.Fin-alSegment) it will immediately continue at the beginning of the PathData again. The advantage of this feature is to provide continuous motion for cyclic operations and improve overall cycle time (OEE). This mode is only available when the PathData has not been loaded via Ethernet stream. The total Path must be contained within the PataData structure without being overwritten, otherwise an Error will be generated.

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.

Related documents