User`s guide

The WINDOW instruction in the above program indicates that whenever a window violation
occurs, a subroutine named window.error is to be executed. The following is an example of
what such a routine might contain.
; *** WINDOW VIOLATION ROUTINE ***
TYPE /B, /C1, "** WINDOW ERROR OCCURRED **", /C1
; Find out which end of window was violated
IF DISTANCE(HERE,window.1) < DISTANCE(HERE,window.2) THEN
; Error occurred at window.2
TYPE "Part moved downstream out of reach"
;...(Respond to downstream window error) .
ELSE ; Error occurred at window.1
TYPE "Part moved upstream out of reach"
;...(Respond to upstream window error) .
END
MOVES wait.location ;Move robot to rest location
; Use digital output signals to sound alarm and stop belt
SIGNAL alarm, stop.belt
HALT ;Halt program execution
Sample Programs
V+Language User's Guide, v17.0
Page 320