Reading signals without waiting (#SIGNAL READ)

Release Note

release_note

This function is available as of CNC Build V2.11.2820.00

The NC command #WAIT stops the program decoding of the interpreter if the requested signal is missing. This blocks further program processing if the signal never arrives.

The NC command #SIGNAL READ allows flexible program sequences without a program stop. This command stores the result of the signal read operation in the channel-specific variable V.G.SIGNAL_READ. When this variable is subsequently evaluated, a corresponding response is possible.

#SIGNAL READ behaves analogously to #WAIT with respect to the use of signals as well as the programming and use of parameters and broadcast signals.

Attention

attention

The NC command #SIGNAL READ is only permitted at interpreter level. A #SIGNAL READ SYN [..] is not permitted and is indicated by an error message.

The status of the read access of #SIGNAL READ is indicated by the variable V.G.SIGNAL_READ. It is TRUE if the corresponding signal was present. The value of the variable remains until the next read access with #SIGNAL READ.

V.G.SIGNAL_READ

Status of read access of #SIGNAL READ

TRUE: Signal present and read

FALSE: No signal present, default

Syntax:

#SIGNAL READ [ ID=.. { P[<idx>] = <param> } { CH=.. } ]

ID=..

Number of the signal to be read. Positive integer.

P[<idx>] = <param>

Signal parameter as real number. When signals are read, parameters can also be sent by the signal sender. Parameters can also originate from different channels. They are assigned to the specified parameters or variables (<param>).

<idx>: Range for maximum possible number of parameters: 0...max. Number of signal parameters (1)

After complete acknowledgement of all the required signals, a check is made whether all programmed parameters were written. If this is not the case, the program stops with an error message

CH=..

Channel number from which a signal is expected.
1...max. number of channels (2)

If no channel number is specified, the program waits for a broadcast signal from any user

(1) see [6]-6.45

(2) see [6]-2.4

Programing Example

prg_example

Read signals and wait for result

(Wait flag 4711, synchronisation at interpreter level, SIGNAL 4711 from any channel)

:

N100 #SIGNAL READ [ID=4711]

N110 $IF V.G.SIGNAL_READ == TRUE

N120   LL UP1

N130 $ELSE

N140   #ERROR [..]

N150 $ENDIF

:

(Wait flag 815, synchronisation at interpreter level,
SIGNAL 815 from channel 1)

:

N100 #SIGNAL READ [ID=815 CH=1]

N110 $IF V.G.SIGNAL_READ == TRUE

N120   LL UP1

N130 $ELSE

N140   L Init.nc

N150 $ENDIF

:

(Wait flag 911, synchronisation at interpreter level, from channel 3)

(1st signal parameter V.P.SIGNAL, 2nd signal parameter P200)

:

N100 #SIGNAL READ [ID=911 P[0]=V.P.SIGNAL P[1]=P200 CH=3]

N110 $IF V.G.SIGNAL_READ == TRUE

N120   P20 = [10 * P200]-V.P.SIGNAL

N130 $ELSE

N140   P20 = 0

N150 $ENDIF