Bosch 6000 User's Guide Page 39

  • Download
  • Add to my manuals
  • Print
  • Page
    / 268
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 38
24
6000 Series Programmer's Guide
Example A
DESCRIPTION: The program cut1 is executed until it gets to the command GOSUB
prompt. From there it branches unconditionally to the subroutine (actually a program) called
prompt. The subroutine prompt queries the operator for the number of parts to process.
After the part number is entered (e.g., operator enters the !'12 command to process 12 parts),
the rest of the prompt subroutine is executed and control goes back to the cut1 program and
resumes program execution with the next command after the GOSUB, which is MAØØ.
DEL cut1 ; Delete a program before defining it
DEF cut1 ; Begin definition of program cut1
HOM11 ; Send axes 1 and 2 to the home position
WAIT(1AS=b0XXX1 AND 2AS=b0XXX1) ; Wait for axes 1 and 2 to come
; to a halt at home
GOSUB prompt ; Go to subroutine program called prompt
MA00 ; Place axes 1 and 2 in the incremental mode
A10,30 ; Set acceleration: axis 1 = 10, axis 2 = 30
AD5,12 ; Set deceleration: axis 1 = 5, axis 2 = 12
V5,8 ; Set velocity: axis 1 = 5, axis 2 = 8
D16000,100000 ; Set distance: axis 1 = 16,000; axis 2 = 100,000
OUT.6-1 ; Turn on output number 6
T5 ; Wait for 5 seconds
L(VAR2) ; Begin loop ( the number of loops = value of VAR2)
GO11 ; Initiate moves on axes 1 and 2
T3 ; Wait for 3 seconds
LN ; End loop
OUT.6-0 ; Turn off output number 6
END ; End definition of program cut1
DEF prompt ; Begin definition of program prompt
VARS1="Enter part count >" ; Place message in string variable #1
VAR2=READ1 ; Prompt operator with string variable #1,
; and read data into numeric variable #2
; NOTE: Type !' before the part count number.
END ; End definition of program prompt
Example B
This example demonstrates the use of labels ($).
DEL pick ; Delete a program before defining it
DEF pick ; Begin definition of program pick
GO1100 ; Initiate motion and axes 1 and 2
IF(VAR1=5) ; If variable 1 = 5, then execute commands
; between IF and ELSE.
; Otherwise, execute commands between ELSE and NIF
GOTO pick1 ; Goto label pick1
ELSE ; Else part of IF statement
GOTO pick2 ; Goto label pick2
NIF ; End of IF statement
$ pick1 ; Define label for pick1
GO0011 ; Initiate motion on axes 3 and 4
BREAK ; Break out of current subroutine or program
$ pick2 ; Define label for pick2
GO1001 ; Initiate motion on axes 1 and 4
END ; End definition of program pick
Conditional Looping and Branching
Conditional looping (REPEAT/UNTIL and WHILE/NWHILE) entails repeating a set of
commands until or while a certain condition exists. In conditional branching
(IF/ELSE/NIF), a specific set of commands is executed based on a certain condition. Both
rely on the fulfillment of a conditional expression, a condition specified in the UNTIL,
WHILE, or IF commands.
A WAIT command pauses command execution until a specific condition exists.
Page view 38
1 2 ... 34 35 36 37 38 39 40 41 42 43 44 ... 267 268

Comments to this Manuals

No comments