SMC_ReadNCFile (FB)¶
FUNCTION_BLOCK SMC_ReadNCFile
SMC_ReadNCFile can read a NC-ASCII-file from the file system of
the controller in order to make it available for the SMC_NCDecoder.
Thus, a NC program can be read in and decoded at runtime.
Note
This function block has been superseeded by SMC_ReadNCFile2 and is kept only for compatibility. It is recommended to use SMC_ReadNCFile2, which has additional features like mathematical expressions or sub programs in g-code
- InOut:
Scope
Name
Type
Initial
Comment
Input
bExecuteBOOLRising edge: Starts execution. While
TRUE, the function block is active.sFileNameSTRING(255)‘’
File path
pvlPOINTER TO SMC_VARLIST
If there aren’t variables in the CNC programm, this input isn’t set. SMC_VARLIST
pBufferPOINTER TO BYTE
Pointer on a sufficiently large, free data area (buffer) that is allocated in the IEC application. It is strongly recommended to allocate the buffer as
ARRAY[0..x] OF |ioSMC_GCODE_WORD|in order to make sure to have a correct data alignment. A definition ofARRAY[0..x] OF BYTEmay lead to a misaligned data access on some platforms.dwBufferSizeDWORDSize of the buffer in byte
fDefaultVelLREALDefault velocity; used if velocity is not specified inside the CNC file.
fDefaultAccelLREALDefault acceleration; used if acceleration is not specified inside the CNC file
fDefaultDecelLREALDefault deceleration used if deceleration is not specified inside the CNC file
fDefaultVelFFLREALDefault velocity for fast forward (G0), FF word. It is used if no velocity is specified inside the CNC file.
fDefaultAccelFFLREALDefault acceleration for fast forward (G0), EF+ word. It is used if no acceleration is specified inside the CNC file.
fDefaultDecelFFLREALDefault deceleration for fast forward (G0), EF- word. A non- negative value is expected used if no deceleration is specified inside the CNC file.
b3DModeBOOLIf
TRUE, a G17 command (activation 3D-mode) is executed implicitly.pStringBufferPOINTER TO SMC_StringBuffer
Pointer to an object of type SMC_StringBuffer. This object is used to store strings that are defined in the G-code program in order to write them to variables using G36&37. If the pointer is not set (0) and string constants are used in the G-code program, an error will be generated.(
SMC_RNCF_NO_STRINGBUFFER).bEnableSyntaxChecksBOOLTurns on syntax checks that will detect invalid G-code and stop with an error in this case
Output
bDoneBOOLTRUEif parameter is availablebBusyBOOLTRUEwhile execution of function block is not finishedbErrorBOOLTRUEsignals that an error has occurred within the function block.ErrorIDSMC_ERRORError identification,
SMC_ERRORbExecuteDecoderBOOLSignal for triggering the input Execute of the SMC_NCDecoder module.
ncprogSTRUCT(nElements := 0)
CNC program, input of the succeeding SMC_NCDecoder module.
dwFileSizeDWORDSize of the file in bytes.
dwPosDWORDCurrent Position of the cursor in the file.