SMC_NCNavigator (FB)

FUNCTION_BLOCK SMC_NCNavigator

This function block selects one of a given number of G-sentence queues. The selection is done based on the called subprogram and controlled by SMC_NCInterpreter.

Additionally to subprogram calls and returns, this function block also handles jumps to sentence numbers, jumps to jump targets, and step suppression.

Note

This function block is included in SMC_ReadNCFile2 and is needed in CNC applications only in special cases.

InOut:

Scope

Name

Type

Comment

Inout

sentences

SMC_GSentenceQueue

The output sentence queue that can be fed into SMC_NCInterpreter. Note: this queue must have capacity 1.

Input

bExecute

BOOL

A rising edge starts the execution.

bStepSuppress

BOOL

When this input is TRUE, lines of the CNC program starting with ‚/’ will be ignored. Otherwise they will be processed.

pSentenceQueues

POINTER TO SMC_GSentenceQueue

Pointer to the first element of an array of sentence queues, one for each subprogram call depth. The first is used for the main program. Note that the last queue is reserved for parsing subprogram declarations, so the effective maximum call depth is nNumSentenceQueues - 1. Read each cycle, not only at the rising edge of bExecute.

nNumSentenceQueues

UDINT

The number of sentence queues. Must be at least 1.

stSubprogramDeclRequest

STRING

If this input is set to an non-empty string, the last sentence queue will be used to read the subprogram with the given name in order to store the declaration in the symbol table. Read each cycle, not only at the rising edge of bExecute.

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.

RequestedSentenceQueueIdx

UDINT

The zero-based index of the active sentence queue.

RequestedProgramName

STRING

The program name of the requested sentence queue. Only relevant if RequestedSentenceQueueIdx is increased.