External variables
Read/write accesses to channel-specific and global external variables V.E.* can be made from the realtime cycle.. The variable must be defined as synchronous for a write access.
Programing Example
Definition of a synchronised V.E. variable
...
var[0].name VALUE1
var[0].type REAL64
var[0].scope GLOBAL
var[0].synchronisation TRUE
var[0].access_rights READ_WRITE
...
Only synchronised variables may be written in realtime cycles.
With a read access to a V.E. variable, its value is dependent on its synchronisation.
- A synchronised variable is evaluated in the realtime context of the CNC.
- An asynchronised variable is evaluated at the time of decoding and is used as a constant.
Programing Example
Accesses to V.E. variables
; Pre-assign variables
V.E.SYNC = 47 ; synchronous variable
V.E.SYNC = 11 ; asynchronous variable
; Define realtime cycle
#RT CYCLE [SCOPE = PROG]
; Run through instructions only once
$IF ONCE 1 < 2
; Assign new value
V.E.SYNC = 99
; has the value 198
V.E.VALUE1 = 2 * V.E.SYNC
; V.E.ASYNC always has the value 11 in this realtime cycle
; right side has the value 22
V.E.VALUE2 = 2 * V.E.ASYNC
$ENDIF
#RT CYCLE END
; End main program
M30