CAM ¶ MC_CamTableSelect (FunctionBlock) SMC_CAMBounds (FunctionBlock) SMC_CAMBounds_Pos (FunctionBlock) SMC_CamEditor (FunctionBlock) DoBeforeLeave (Action) SMC_CamRegister (FunctionBlock) SMC_GetCamSlaveSetPosition (FunctionBlock) SMC_GetTappetValue (FunctionBlock) SMC_ReadCAM (FunctionBlock) CloseFile (Action) SMC_WriteCAM (FunctionBlock) CloseFile (Action)
SMC_GetTappetValue (FB) ¶ FUNCTION_BLOCK SMC_GetTappetValue This function block evaluates the output Tappets of function block MC_CamIn and contains the current tappet status. InOut: Scope Name Type Comment Inout Tappets SMC_TappetData Tappet signals to be evaluated by MC_GetTappetValue Input iID INT Group ID of the tappet to be evaluated. bInitValue BOOL Initial value of the tappet to be assigned at first call bSetInitValueAtReset BOOL TRUE : Sets the value of the tappet to bInitValue at a restart of the MC_CamIn` function block. FALSE : Retains the tappet value at a restart of the MC_CamIn function block. Output bTappet BOOL Tappet value
SMC_ReadCAM (FB) ¶ FUNCTION_BLOCK SMC_ReadCAM This function block is designed for loading a cam at runtime and making it available for the modules MC_CamTableSelect and MC_CamIn . The cam to be loaded has to be created within the cam editor before and saved in a “*.CAM” file (see SMC_WriteCAM ). The size of a loadable cam is limited by the library parameters LibParams.gc_SMC_FILE_MAXCAMEL (number of elements) and LibParams.gc_SMC_FILE_MAXCAMTAP (number of cam switch actions). InOut: Scope Name Type Initial Comment Input bExecute BOOL FALSE Rising edge: Starts the execution of the function block. sFileName STRING(255) Name of the file, which contains the cam description in the defined ASCII format. Output bDone BOOL FALSE TRUE : Cam has been read in. bBusy BOOL FALSE TRUE : Execution of the function block has not been finished. bError BOOL FALSE TRUE : Error has occurred within the function block. ErrorID SMC_ERROR 0 Error identification CAM MC_CAM_REF STRUCT(nElements := 0, nTappets := 0) Structure: CloseFile (Action)
SMC_WriteCAM (FB) ¶ FUNCTION_BLOCK SMC_WriteCAM This function block is designed for storing a cam table created within the Cam editor into a file at runtime. InOut: Scope Name Type Initial Comment Inout CAM MC_CAM_REF Input bExecute BOOL FALSE Rising edge: Starts the execution of the function block. sFileName STRING(255) Name of the file, which contains the cam description in the defined ASCII format. Output bDone BOOL FALSE TRUE : Cam has been written. bBusy BOOL FALSE TRUE Execution of function block has not been finished. bError BOOL FALSE TRUE : Error has occurred within the function block. ErrorID SMC_ERROR 0 Error identification Structure: CloseFile (Action)
Diagnostics ¶ FBError SMC_ClearFBError (Function) SMC_ReadFBError (FunctionBlock) MC_ReadActualPosition (FunctionBlock) MC_ReadActualTorque (FunctionBlock) MC_ReadActualVelocity (FunctionBlock) MC_ReadAxisError (FunctionBlock) MC_ReadStatus (FunctionBlock) Performance SMC_PerfStat (FunctionBlock) SMC_PerfTimerSum (Function) SMC_SeriesStat (FunctionBlock) SMC3_BrakeStatus (FunctionBlock) SMC_AxisDiagnosticLog (FunctionBlock) WriteToFile (Action) SMC_CheckAxisCommunication (FunctionBlock) SMC_CheckLimits (FunctionBlock) SMC_GetMaxSetAccDec (FunctionBlock) SMC_GetMaxSetVelocity (FunctionBlock) SMC_GetTrackingError (FunctionBlock) SMC_InPosition (FunctionBlock) SMC_MeasureDistance (FunctionBlock) SMC_ReadSetPosition (FunctionBlock) SMC_ReadSetValues (FunctionBlock)
FBError ¶ SMC_ClearFBError (Function) SMC_ReadFBError (FunctionBlock)
SMC_NC_FindProgramFile (FUN) ¶ FUNCTION SMC_NC_FindProgramFile : SMC_ERROR For a given CNC sub program name, such as ‘SUB’, looks for the corresponding CNC file ‘sub.cnc’ in one of the subdirectories (aSubProgramDirs). InOut: Scope Name Type Comment Return SMC_NC_FindProgramFile SMC_ERROR Input strProgramName STRING The CNC sub program name. Case does not matter. Inout strFilePath STRING(255) Out: On success, the full path of the cnc file containing the sub program. Inout Const aSubProgramDirs ARRAY [0..4] OF STRING(174) An array of up to 5 directories where subprograms are searched. For a subprogram with name “SUB”, the file “sub.cnc” (lower-case) is searched in each of the given directories, starting with directory aSubProgramDirs[0], in ascending order. The first match is used. The first empty directory name ends the search.
SMC_NC_PrependDefaults (FB) ¶ FUNCTION_BLOCK SMC_NC_PrependDefaults This function block is used internally by SMC_ReadNCFile2 to prepend a sentence containing the given defaults, e.g. ‘N0 G17 F25 E1000 E-2000’. If SMC_ReadNCFile2 is used, there is not need to use this function block. Important: this function block will prepend the defaults again after a jump command in the out queue. So it should be used before any buffering function blocks such the jump buffer. It should be called before SMC_NCNavigator as well, because the navigator will handle the jumps to unknown jump targets. InOut: Scope Name Type Comment Inout sentencesOut SMC_GSentenceQueue The output sentence queue sentencesIn SMC_GSentenceQueue The input sentence queue Input bExecute BOOL bAbort BOOL If TRUE , the current processing of this function block is aborted fDefaultVel LREAL Default velocity; used if the velocity (F-word) is not specified inside the CNC file. fDefaultAccel LREAL Default acceleration; used if acceleration (E+ word) is not specified inside the CNC file fDefaultDecel LREAL Default deceleration (E- word); used if deceleration is not specified inside the CNC file fDefaultVelFF LREAL Default velocity for fast forward (G0), FF word. It is used if no velocity is specified inside the CNC file. fDefaultAccelFF LREAL Default acceleration for fast forward (G0), EF+ word. It is used if no acceleration is specified inside the CNC file. fDefaultDecelFF LREAL Default deceleration for fast forward (G0), EF- word. A non-negative value is expected. It is used if no deceleration is specified inside the CNC file. b3DMode BOOL If TRUE , a G17 command (activation of 3D-mode) is executed implicitly. Output bBusy BOOL bError BOOL ErrorID SMC_ERROR errorPos SMC_NC_SourcePosition
SMC_ReadNCFile2 (FB) ¶ FUNCTION_BLOCK SMC_ReadNCFile2 SMC_ReadNCFile2 can read an NC-ASCII-file from the file system of the controller in order to make it available for the SMC_NCInterpreter . Thus, an NC program can be read in and interpreted at runtime. InOut: Scope Name Type Initial Comment Input bExecute BOOL Rising edge: starts execution. bAbort BOOL If TRUE , the current processing of this function block is aborted sFileName STRING(255) File path of the file containing the g-code. pvl POINTER TO SMC_VARLIST A variable list defining the type and address for each variable that can be used from the g-code. If there are no variables in the g-code, this input is not used. fDefaultVel LREAL Default velocity; used if the velocity (F-word) is not specified inside the CNC file. Note: only applies to the main program, not to subprograms. fDefaultAccel LREAL Default acceleration; used if acceleration (E+ word) is not specified inside the CNC file. A non-negative value is expected. Note: only applies to the main program, not to subprograms. fDefaultDecel LREAL Default deceleration (E- word); used if deceleration is not specified inside the CNC file Note: only applies to the main program, not to subprograms. fDefaultVelFF LREAL Default velocity for fast forward (G0), FF word. It is used if no velocity is specified inside the CNC file. Note: only applies to the main program, not to subprograms. fDefaultAccelFF LREAL Default acceleration for fast forward (G0), EF+ word. It is used if no acceleration is specified inside the CNC file. Note: only applies to the main program, not to subprograms. fDefaultDecelFF LREAL Default deceleration for fast forward (G0), EF- word. A non-negative value is expected. It is used if no deceleration is specified inside the CNC file. Note: only applies to the main program, not to subprograms. b3DMode BOOL TRUE If TRUE , a G17 command (activation of 3D-mode) is executed implicitly. Note: only applies to the main program, not to subprograms. bStepSuppress BOOL When this input is TRUE , lines of the CNC program starting with ‚/’ will be ignored. Otherwise they will be processed. aSubProgramDirs ARRAY [0..4] OF STRING(174) An array of up to 5 directories where subprograms are searched. For a subprogram with name “SUB”, the file “sub.cnc” (lower-case) is searched in each of the given directories, starting with directory aSubProgramDirs[0], in ascending order. The first match is used. The first empty directory name ends the search. bParenthesesAsComments BOOL TRUE Usually, parentheses in g-code are treated as multi-line comments. If bParenthesesAsComments is set to FALSE, however, parentheses can be used in the usual ways to group expressions (‘(a+b)*c’) and for subprogram calls (‘N10 sub(17)’) in g-code. Multi-line comments can be started with ‘( ’ and end with ‘ )’. For more control over the delimiters, call the method SMC_ReadNCFile2.SetDelimiters before calling the main method of this FB. If SetDelimiters is called, this input is ignored. Note Regardless of the value of this input, it is always possible to use curly braces ‘{}’ to group expressions and for subprogram calls. bDisableJumpBuffer BOOL This input, if TRUE , disables an internal jump buffer that is used to improve performance of g-code processing if jumps (G20) are used. pCustomFunTable POINTER TO SMC_NC_GFunctionTable Allows to define custom functions that can be used in G-Code expressions. If there are no custom G-Code functions, this input is null. aTokenModifier ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF SMC_ITokenModifier Optional modifier function blocks that can change the tokens on the fly. This can be used to translate between G-Code dialects. Leave 0 if not needed. Otherwise, set all members of the array to valid function block instances. aSentenceModifier ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF SMC_IGSentenceModifier Optional modifier function blocks that can change the g-code sentences on the fly. This can be used to translate between G-Code dialects. Leave 0 if not needed. Otherwise, set all members of the array to valid function block instances. Output bBusy BOOL TRUE while execution of function block is not finished bError BOOL TRUE signals that an error has occurred within the function block. ErrorID SMC_ERROR Error identification errorPos SMC_NC_SourcePosition The source-position where an error has been detected. ErrorProgramName STRING The name of the program where an error has been detected sentences SMC_GSentenceQueue The output sentence queue that can be fed into SMC_NCInterpreter . adwFileSize ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF DWORD Size of the file in bytes. adwPos ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF DWORD Current Position of the cursor in the file. Methods: SetDelimiters Structure: SetDelimiters (Method)
SMC_ReadNCFromStream (FB) ¶ FUNCTION_BLOCK SMC_ReadNCFromStream SMC_ReadNCFromStream can read an NC-ASCII-file from a stream in order to make it available for the SMC_NCInterpreter . Thus, an NC program can be read in and interpreted at runtime. InOut: Scope Name Type Initial Comment Input bExecute BOOL Rising edge: starts execution. bAbort BOOL If TRUE , the current processing of this function block is aborted aStream ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF SMC_ITextStream An array of streams. aStream[0] has to contain the main program. It must be open and ready for reading. The streams 1 .. N-1 are (only) used to process subprogram calls. The streams must be of the correct type for the implementation of lookupCNCProgram . lookupCNCProgram SMC_INCLookup An object that looks up subprograms by name. Used to open the streams for the subprograms ( aSubStreams ). pvl POINTER TO SMC_VARLIST A variable list defining type and address for each variable that can be used from the g-code. If there are no variables in the g-code, this input is not used. fDefaultVel LREAL Default velocity; used if the velocity (F-word) is not specified inside the CNC file. Note: only applies to the main program, not to subprograms. fDefaultAccel LREAL Default acceleration; used if acceleration (E+ word) is not specified inside the CNC file Note: only applies to the main program, not to subprograms. fDefaultDecel LREAL Default deceleration (E- word); used if deceleration is not specified inside the CNC file. A non-negative value is expected. Note: only applies to the main program, not to subprograms. fDefaultVelFF LREAL Default velocity for fast forward (G0), FF word. It is used if no velocity is specified inside the CNC file. Note: only applies to the main program, not to subprograms. fDefaultAccelFF LREAL Default acceleration for fast forward (G0), EF+ word. It is used if no acceleration is specified inside the CNC file. Note: only applies to the main program, not to subprograms. fDefaultDecelFF LREAL Default deceleration for fast forward (G0), EF- word. A non-negative value is expected. It is used if no deceleration is specified inside the CNC file. Note: only applies to the main program, not to subprograms. b3DMode BOOL TRUE If TRUE , a G17 command (activation of 3D-mode) is executed implicitly. Note: only applies to the main program, not to subprograms. bStepSuppress BOOL When this input is TRUE , lines of the CNC program starting with ‚/’ will be ignored. Otherwise they will be processed. bParenthesesAsComments BOOL TRUE Usually, parentheses in g-code are treated as multi-line comments. If bParenthesesAsComments is set to FALSE, however, parentheses can be used in the usual ways to group expressions (‘(a+b)*c’) and for subprogram calls (‘N10 sub(17)’) in g-code. Multi-line comments can be started with ‘( ’ and end with ‘ )’. For more control over the delimiters, call the method SMC_ReadNCFromStream.SetDelimiters before calling the main method of this FB. If SetDelimiters is called, this input is ignored. Note Regardless of the value of this input, it is always possible to use curly braces ‘{}’ to group expressions and for subprogram calls. bDisableJumpBuffer BOOL This input, if TRUE , disables an internal jump buffer that is used to improve performance of g-code processing if jumps (G20) are used. pCustomFunTable POINTER TO SMC_NC_GFunctionTable Allows to define custom functions that can be used in G-Code expressions. If there are no custom G-Code functions, this input is null. aTokenModifier ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF SMC_ITokenModifier Optional modifier function blocks that can change the tokens on the fly. This can be used to translate between G-Code dialects. Leave 0 if not needed. Otherwise, set all members of the array to valid function block instances. aSentenceModifier ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF SMC_IGSentenceModifier Optional modifier function blocks that can change the g-code sentences on the fly. This can be used to translate between G-Code dialects. Leave 0 if not needed. Otherwise, set all members of the array to valid function block instances. Output bBusy BOOL TRUE while execution of function block is not finished bError BOOL TRUE signals that an error has occurred within the function block. ErrorID SMC_ERROR Error identification errorPos SMC_NC_SourcePosition The source-position where an error has been detected. ErrorProgramName STRING The name of the program where an error has been detected nActiveChain UDINT The currently active parsing chain, 0 <= nActiveChain < NUM_PARSER_CHAINS. Inout sentences SMC_GSentenceQueue Out: The output sentence queue that can be fed into SMC_NCInterpreter . Methods: SetDelimiters Structure: SetDelimiters (Method)