Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Programming a Trapezoidal Motion Profile on CNC Machines, Lecture notes of Logic

A sample program for executing a trapezoidal motion profile on CNC machines using the Motion Planner software. It includes instructions on setting up commands, using variable and data substitutions, and defining programs and compiled profiles. The example program sets acceleration, velocity, and distance for axes 1 and 2, and executes the motion.

What you will learn

  • What is the difference between programs and compiled profiles in the Motion Planner software?
  • How do you define a program in the Motion Planner software?
  • What is a trapezoidal motion profile?
  • How do you set up commands in the Motion Planner software?
  • What are the different types of variables that can be used in the Motion Planner software?

Typology: Lecture notes

2021/2022

Uploaded on 09/27/2022

gorillaz
gorillaz 🇬🇧

3.8

(5)

219 documents

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CHAPTER ONE
Programming
Fundamentals
IN THIS CHAPTER
This chapter is a guide to general 6K programming tasks. It is divided into these main topics:
Motion Planner programming environment ......................... 2 Restricted commands during motion............................ 17
Command syntax.................................................................. 3 Using Variables ............................................................ 18
Creating programs................................................................ 9 Program flow control.................................................... 23
Storing programs.................................................................. 10 Program interrupts ........................................................29
Executing programs ............................................................. 13 Error handling...............................................................30
Creating and executing a set-up program............................. 13 Non-volatile memory ....................................................33
Program Security.................................................................. 14 System performance considerations..............................34
Controlling execution – programs & command buffer......... 15
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22

Partial preview of the text

Download Programming a Trapezoidal Motion Profile on CNC Machines and more Lecture notes Logic in PDF only on Docsity!

C H A P T E R O N E

Programming

Fundamentals

IN THIS CHAPTER

This chapter is a guide to general 6K programming tasks. It is divided into these main topics:

  • Motion Planner programming environment ......................... 2 • Restricted commands during motion ............................ 17
  • Command syntax.................................................................. 3 • Using Variables ............................................................ 18
  • Creating programs ................................................................ 9 • Program flow control.................................................... 23
  • Storing programs.................................................................. 10 • Program interrupts ........................................................ 29
  • Executing programs ............................................................. 13 • Error handling............................................................... 30
  • Creating and executing a set-up program ............................. 13 • Non-volatile memory.................................................... 33
  • Program Security.................................................................. 14 • System performance considerations.............................. 34
  • Controlling execution – programs & command buffer......... 15

2 6K Series Programmer’s Guide

Motion Planner Programming Environment

Every 6K Series controller is shipped with Motion Planner, a Windows-based programming tool designed to simplify your programming efforts. The Motion Planner interface allows you to:

  • Create, edit, download, and upload programs (or code modules).
  • Tune your system to optimize performance.
  • Test & debug programs and controller operation with customizable displays.
  • Organize all of your programs and resource files for your programming project.

PROGRAMMING SUPPORT. To help you program with speed and efficiency, Motion Planner provides these “performance support” features:

  • Smart Editor : The smart editor is the focal point for your programming tasks: The smart editor watches over your shoulder and provides syntax checking on the fly (as you type). To get detailed information on the command you're using, just press the F1 key. At any point, you can check the entire program file for logic flow and syntax errors.
  • Programming Help with Wizards : While you are working in the Editor, you can use the wizards to speed up your programming tasks and minimize your need to learn the details of the programming language. Wizards are available for general program structure, general system setup (including servo tuning), error programming, and a host of other programming tasks.

Contents of the online help system.

This is an example of a user program. Note that the user program window has it own offering of wizards and file control buttons.

Double-click the icon to view the program in a separate window.

Main Program Editor Window: These are program icons placed by the “Standard Application” program structure wizard. The 1 st^ time you open an icon (double-click), you will be guided through the respective wizard. The next time you open the icon, you can edit the code generated from the wizard.

  • Setup program
  • Main program (can be assigned as power-up program)
  • User programs

Click this tab to view the terminal window

4 6K Series Programmer’s Guide

Spaces and tabs within a command are processed as neutral characters. Comments can be specified with the semicolon (;) character — all characters following the semicolon and before the command delimiter are considered program comments.

Some commands contain one or more data fields in which you enter numeric or binary values or text:

  • Numeric data fields. For example, A20,10 is an acceleration (A) command that sets the acceleration for axes 1 and 2 to 20 units/sec

2 and 10 units/sec

2 , respectively.

  • Binary fields. For example, DRIVE1011 is a drive enable (DRIVE) command that enables axes 1, 3 and 4 and disables axis 2.
  • Text fields. For example, STARTPpowrup is a startup program assignment (STARTP) command that assigns the program called “powrup” as the startup program to be executed automatically when the 6K product is power up or reset.
  • To check what the data field settings are for a particular command, simply type in the command without the data fields. The 6K will display the command settings. For example, after executing the A20,10 noted above, you could type in the A command by itself and the 6K controller would respond with A20,10.
  • Shortcuts. Most 6K language commands supply axis-related data, and have one field per axis, separated by commas. Each command field correlates, left to right, to the physical axis. For example, to specify a velocity of 10 on axes 6 and 8, the command “V , , , , ,10, ,10” would be used. As can be seen from the example, the required number of commas can be awkward, and could be a potential source of typographical error. The 6K products allow an axis specifier to be placed in front of a command with axis fields to identify the starting axis number for the fields in that command. For example, the above V command could be given as “6V10, ,10”. If the velocity were to be given to axis 6 only, the command would simply be “6V10”.An axis identifier placed in front of a data command without parameters (e.g. 6V) will report the value for that axis only.

Chapter 1. Programming Fundamentals 5

Description of Syntax Letters and Symbols

The command descriptions provided within the 6K Series Command Reference use alphabetic letters and ASCII symbols

within the S y n t a x description to represent different parameter requirements (see INEN example below).

INEN Input Enable

Type Inputs; Program Debug Tools Syntax <!>INEN... Units d = Ø, 1, E, or X Range Ø = off, 1 = on, E = enable, X = don't change Default E Response INEN: *INENEEEE_EEEE_EEEE_EEEE_E See Also [ IN ], INFNC, INLVL, INPLC, INSTW, TIN, TIO

Product Rev 6K 5.

Letter/Symbol Description

a .......... Represents an axis specifier, numeric value from 1 to 8.

B .......... Represents the number of the product's I/O brick. External I/O bricks are represented by numbers 1 through n (to connect external I/O bricks, see your product's Installation Guide ). On-board I/O are address at brick location zero (Ø). If the brick identifier is omitted from the command, the controller assumes the command is supposed to affect the onboard I/O.

b *......... Represents the values 1 , 0 , X or x; does not require field separator between values.

c .......... Represents a character (A to Z, or a to z)

d .......... Represents the values 1 , 0 , X or x, E or e ; does not require field separator between values. E or e enables a specific command field. X or x leaves the specific command field unchanged or ignored. In the ANIEN command, the “d” symbol can also represent a real numeric value.

i .......... Represents a numeric value that cannot contain a decimal point (integer values only). The numeric range varies by command. Field separator required.

r .......... Represents a numeric value that can contain a decimal point, but is not required to have a decimal point. The numeric range varies by command. Field separator required.

t .......... Represents a string of alpha numeric characters from 1 to 6 characters in length. The string must start with a alpha character.

! .......... Represents an immediate command. Changes a buffered command to an immediate command. Immediate commands are processed immediately, even before previously entered buffered commands.

% .......... (Multitasking Only) Represents a task identifier. To address the command to a specific task, prefix the command with “i%”, where “i” is the task number. For example, the 4%CUT command uses task 4 to execute the program called “CUT”.

, .......... (comma) Represents a field separator. Commands with the symbol r or i in their Syntax description require field separators. Commands with the symbol b or d in their Syntax description do not require field separators (but they can be included). See General Guidelines table below.

@ .......... Represents a global specifier, where only one field need be entered. Applicable to all commands with multiple command

fields. (e.g., @V1 sets velocity on all axes to 1 rps).

< > ...... Indicates that the item contained within the < > is optional, not required by that command. NOTE : Do not confuse with , , and , which refer to the ASCII characters corresponding to a carriage return, space, and line feed, respectively.

[ ] ...... Indicates that the command between the [ ] must be used in conjunction with another command, and cannot be used by itself.

  • The ASCII character b can also be used within a command to precede a binary number. When the b is used in this context, it is not to be replaced with a 0 , 1 , X, or x. Examples are assignments such as VARB1=b10001, and comparisons such as IF(3IN=b1001X1).

Order of Precedence for Command Prefix Characters (from left to right):

1 st: Immediate 2 nd: Task number 3

rd : Apply to all axes or I/O bricks 3 rd^ : Axis number

3 rd^ : I/O brick number

<%><@>

Chapter 1. Programming Fundamentals 7

Command Value Substitutions

Many commands can substitute one or more of its command field values with one of these substitution items (demonstrated in the programming example below):

VAR..........Places current value of the numeric variable in the corresponding command field.

VARB .......Uses the value of the binary variable to establish all the command fields.

VARI .......Places current value of the integer variable in the corresponding command field.

READ .......Information is requested at the time the command is executed.

DREAD .....Reads the RP240's numeric keypad into the corresponding command field.

DREADF...Reads the RP240's function keypad into the corresponding command field.

TW ............Places the current value set on the thumbwheels in the corresponding command field.

DAT..........Places the current value of the data program (DATP) in the corresponding command field.

Programming Example : ( NOTE : The substitution item must be enclosed in parentheses.)

VAR1=15 ; Set variable 1 to 15 A5,(VAR1),4,4 ; Set acceleration to 5,15,4,4 for axes 1-4, respectively VARB1=b1101XX1 ; Set binary variable 1 to 1101XX1 (bits 5 & 6 not affected) GO(VARB1) ; Initiate motion on axes 1, 2 & 4 (value of binary ; variable 1 makes it equivalent to the GO1101 command) OUT(VARB1) ; Turn on outputs 1, 2, 4, and 7 VARS1="Enter Velocity" ; Set string variable 1 to the message "Enter Velocity" V2,(READ1) ; Set the velocity to 2 on axis 1. Read in the velocity for ; axis 2, output variable string 1 as the prompting message ; 1. Operator sees "ENTER VELOCITY" displayed on the screen. ; 2. Operator enters velocity prefixed by !' (e.g., !'20). HOMV2,1,(TW1) ; Set homing velocity to 2 and 1 on axes 1 and 2, respectively. ; Read in the home velocity for axis 3 from thumbwheel set 1 HOMV2,1,(DAT1) ; Set homing velocity to 2 and 1 on axes 1 and 2, respectively. ; Read home velocity for axis 3 from data program 1. VARI1=2*3 ; Set integer variable 1 to 6 (2 multiplied by 3) D(VARI2),,(VARI3) ; Set the distance of axis 1 equal to the value of ; integer variable 2, and the distance of axis 3 equal to ; the value of integer variable 3.

RULE OF THUMB

Not all of the commands allow command field substitutions. In general, commands with a

binary command field ( in the command syntax) will accept the VARB substitution.

Commands with a real or integer command field ( or in the command syntax) will

accept VAR, VARI, READ, DREAD, DREADF, TW or DAT.

Assignment and Comparison Operators

Comparison and assignment operators are used in command arguments for various functions such as variable assignments, conditional branches, wait statements, conditional GOs, etc. Some examples are listed below:

  • Assign to numeric variable 6 the value of the encoder position on axis 3 (uses the PE operator): VAR6=3PE
  • Wait until onboard inputs 3 & 6 become active (uses the IN operator): WAIT(IN=bxx1xx1)
  • Continue until the value of numeric variable 2 is less than 36: UNTIL(VAR2<36)
  • IF condition based on if a target zone timeout occurs on axis 2 (uses the AS axis status operator, where status bit 25 is set if a target zone timeout occurs): IF(2AS.25=b1) The available comparison and assignment operators are listed below. For full descriptions, see the 6K Series Command Reference (be sure to refer only to the commands in brackets—e.g., A is the acceleration setup command, but [ A ] is the acceleration assignment/comparison operator).

8 6K Series Programmer’s Guide

  • denotes operators that have a correlated status display command.

(e.g., To see a full-text description of each axis status bit accessed with the AS operator, send the TASF command to the 6K controller.)

See page 226.

A ................... Acceleration AD................. Deceleration ANI .............. Voltage at the analog inputs on an expansion I/O brick (see page 76 for bit patterns) * ANO .............. Voltage at the analog outputs on an expansion I/O brick (see page 76 for bit patterns) * AS................. Axis status * ASX .............. Extended axis status (additional axis status items) * D ................... Distance DAC .............. Digital-to-analog converter (output voltage) value * DAT .............. Data program number DKEY............ Value of RP240 Key DPTR............ Data pointer location * DREAD ......... Data from the numeric keypad on the RP DREADF ....... Data from the function keypad on the RP ER................. Error status * FB................. Position of current selected feedback sources * FS................. Following status * IN................. Input status (input bit patterns, see page 76) * INO .............. “Other” input status (ENABLE input reported with bit 6) * LIM .............. Limit status (end-of-travel limits and home limits) * MOV .............. Axis moving status NMCY............ Current master cycle number * OUT .............. Output status (output bit patterns, see page 76) * PANI............ Position of analog input, at 205 counts/volts unless otherwise scaled (servo axes) * PC................. Commanded position * PCC .............. Captured commanded position * PCE .............. Captured encoder position * PCME............ Captured master encoder position * PCMS............ Captured master cycle position * PER .............. Position error (servo axes only) * PME .............. Current master encoder position * PMAS............ Current master cycle position * PE................. Position of master encoder * PSHF............ Net position shift since constant Following ratio * PSLV............ Current commanded position of the slave axis * READ............ Read a numeric value to a numeric variable (VAR) SC................. Controller status * SCAN............ Runtime of the last scanned PLC program * SEG .............. Number of segments available in Compiled Profile memory * SS................. System status * SWAP............ Current active status of tasks * TASK............ Number of the controlling task * TIM .............. Timer value * TRIG............ Trigger interrupt status * TW................. Thumbwheel data read US................. User status * V ................... Velocity (programmed) VAR .............. Numeric variable substitution VARI............ Integer variable substitution VARB............ Binary variable substitution VEL .............. Velocity (commanded by the controller) * VELA............ Velocity (actual, as measured by a position feedback device) * VMAS............ Current velocity of the master axis *

Bit Select Operator The bit select operator (.) makes it easier to base a command argument on the condition of one specific status bit. For example, if you wish to base an IF statement on the condition that a user fault input is activated (error status bit 7 is a binary status bit that is “ 1 ” if a user fault occurred and “Ø” if it has not occurred), you could use this command: IF(ER=bxxxxxx1). Using a bit select operator, you could instead use this command: IF(ER.7=b1).

NOTE : You can use a bit select operator to set a particular status bit (e.g., to turn on onboard programmable output 5, you would type the OUT.5-1 command; to enable error-checking bit 4 to check for drive faults, you would type the ERROR.4-1 command). You can also check specific status bits (e.g., to check axis 2’s axis status bit 25 to see if a target zone timeout

10 6K Series Programmer’s Guide

Program Example

The illustration below identifies the elements that comprise the general structure of a program.

; This is a program that executes a trapezoidal motion ; profile on axes 1 and 2 ; ********************************************************* DEL motion ; (a precaution) Delete program called "motion"

DEF motion ; Begin definition of program called "motion" DRIVE11 ; Enable drives on axes 1 and 2 MC00 ; Set position mode to preset on both axes A20,10 ; Set accel on axis 1 to 20 units/sec/sec, and ; Set accel on axis 2 to 10 units/sec/sec V8,5 ; Set velocity on axis 1 to 8 units/sec, and ; Set velocity on axis 2 to 5 units/sec D100000,75000 ; Set distance to 100,000 counts on axis 1, and ; Set distance to 75,000 counts on axis 2 GO11 ; Execute motion on axes 1 and 2 END ; End definition of program called "motion"

Use the Wizards in Motion Planner

Motion Planner provides wizards that make it easy to create your program. Below is a partial list of the wizards available.

  • Application Wizards (for program structure guidance) − Standard Application − Multitasking Application
  • Program Wizards − Setup Program − Main Program − User Program − Error Program
  • Setup Wizards − Drive − Feedback − Scaling − Limit − Servo Tuner − On-board I/O − Expansion I/O − Jogging − Joystick − Variable
  • Action Wizards − Motion − Home − Output − If − Loop − Wait − Assignment − Target Zone − Registration

These are command line comments, comprising a semi-colon and text. The comments are separated from the command by a tab. A carriage return is placed at the end of each command line.

Use DEF to begin defining the program.

Contents of the program.

Use DEL to delete the program (a precaution).

Use END to finish defining the program.

Chapter 1. Programming Fundamentals 11

Storing Programs

After a program or compiled program/profile is defined (DEF) or downloaded to the 6K controller, it is automatically stored in non-volatile memory (battery-backed RAM). Information on controlling memory allocation is provided below (Memory Allocation, see page 11).

Memory Allocation

Your controller's memory has two partitions: one for storing programs and one for storing compiled profiles & PLC programs. The allocation of memory to these two areas is controlled with the MEMORY command.

“Programs” vs. ”Compiled Profiles & PLC Programs”

Programs are defined with the DEF and END commands, as demonstrated in the Program

Example on page 10.

Compiled Profiles & PLC Programs are defined like programs, using the DEF and END

commands, but are compiled with the PCOMP command and executed with the

PRUN command (PLC programs are usually executed in PLC Scan Mode with the

SCANP). A compiled profile could be a multi-axis contour (a series of arcs and

lines), an individual axis profile (a series of GOBUF commands), or a compound

profile (combination of multi-axis contours and individual axis profiles). A PLC

program is a pre-compiled program that mimics PLC functionality by scanning

through the I/O faster than in normal program execution.

Programs intended to be compiled are stored in program memory. After they are

compiled with the PCOMP command, they remain in program memory and the

segments (see diagram below) from the compiled program are stored in compiled

memory. The TDIR report indicates which programs are compiled as compiled

profiles (“COMPILED AS A PATH”) and which programs are compiled as PLC

programs (“COMPILED AS A PLC PROGRAM”).

For information on contouring, see page 124; for information on compiled individual

axis profiles, see page 136; and for information on PLC programs, see page 104.

MEMORY

command

syntax

(example)

  (^)        

Chapter 1. Programming Fundamentals 13

Executing Programs (options)

Following is a list of the primary options for executing programs stored in your controller:

Method Description See Also

Execute from a terminal emulator

Type in the name of the program and press enter; or write a program to prompt the operator to select a program from the terminal.

Execute as a subroutine from a “main” program

Use a branch (GOTO, GOSUB, or JUMP) from the main program to execute another stored program.

Page 23

Execute automatically when the controller is powered up

Assign a specific program as a startup program with the STARTP command. When you RESET or cycle power to the controller, the startup program is automatically executed.

Page 13

Execute from a PLC program

Write a PLC program that executes a program (using EXE or PEXE) based on a specific condition (e.g., input state). Use the SCANP command to launch the PLC program in the PLC Scan Mode.

Page 104

Execute a specific program with BCD weighted inputs

Define programmable inputs to function as BCD select inputs, each with a BCD weight. A specific program (identified by its number) is executed based on the combination of active BCD inputs. Related commands: INSELP and INFNCi-B or LIMFNCi-B.

Page 82

Execute a specific program with a dedicated input

Define a programmable input to execute a specific program (by number). Related commands: INSELP and INFNCi-iP or LIMFNCi-P.

Page 88

“Call” from a high-level program

Using a programming language such as BASIC or C, write a program that enables the computer to monitor processes and orchestrate motion and I/O by executing stored programs (or individual commands) in the controller.

Page 118

Execute from an RP (remote operator interface)

Execute a stored program from the RUN menu in the RP240’s standard menu system.

Page 111

Execute from your own custom Windows program

Use a programming language (e.g., Visual Basic, Visual C++, etc.) and the 6K Communications Server (provided on the Motion Planner CD) to create your own windows application to control the 6K product.

Creating and Executing a Setup Program

The intent of the Setup program is to place the 6K controller in a ready state for subsequent motion control. The setup program must be called from the “main” program for your application; or you can designate (with STARTP) the setup program as the program to be is automatically executed when the 6K product is powered up or when the RESET command is executed. The setup program typically contains elements such as feedback device configuration, tuning gain selections, programmable I/O definitions, scaling, homing configuration, variable initialization, etc. (more detail on these “basic” features is provided in Chapter 3, Basic Operation Setup ).

The basic process of creating a setup program is:

  1. Create a program to be used as the setup program.
  2. Save the program and download it to the 6K product.
  3. Execute the STARTP command to assign your new program as the “start-up” program (e.g., STARTP setup assigns the program called “setup” as the start-up program). The next time the controller is powered up or reset, the assigned STARTP program will be executed.

Or call the setup program from the main program for your application.

14 6K Series Programmer’s Guide

Use Motion Planner’s Setup wizard to help you create the basic configuration program. By simply responding to a series of dialog boxes, a program is created with a specific name (as if you created it in the usual process with the DEF and END commands). You can further edit this program in Motion Planner's Editor if you wish. Use the following procedure:

  1. From the main Editor window, click the “Standard Application” wizard button (located on the right-hand side of the screen under Application Wizards) and select “Setup” and “Main” from the dialog. When you click “Finish”, Motion Planner places a Setup program icon and a Main program icon in the Editor window.
  2. Double-click the Setup program icon to launch the wizard. Complete the wizard dialogs and click “Finish” to complete the wizard. (The next time you open the icon, you will see a program editor with the code resulting from the setup wizard.) Setup elements include: - Product selection - Drives - Feedback (encoder, analog input) - Scaling - Hardware end-of-travel limits - Servo tuning
  3. Double-click the Main program icon to launch the wizard. Select this program as the program to launch when the 6K controller is reset or powered up (this is equivalent to the STARTP command function). In the dialog for selecting the Setup Program, select the program developed in step 2 above.
  4. Save the Editor files.
  5. Download the files to the 6K controller.

Program Security

Issuing the INFNCi-Q or LIMFNCi-Q command enables the Program Security feature and assigns the Program Access function to the specified programmable input. The “i” represents the number of the programmable input to which you wish to assign the function (see page 76 programmable input bit patterns for your product).

The program security feature denies you access to the DEF, DEL, ERASE, MEMORY, INFNC, and LIMFNC commands until you activate the program access input. Being denied access to these commands effectively restricts altering the user memory allocation. If you try to use these commands when program security is active (program access input is not activated), you will receive the error message *ACCESS DENIED.

For example, once you issue the INFNC5-Q command, onboard input 5 is assigned the program access function and access to the DEF, DEL, ERASE, MEMORY, INFNC, and LIMFNC commands will be denied until you activate onboard input 5.

NOTE : To regain access to these commands without the use of the program access input, you must issue the INEN command to disable the program security input, make the required user memory changes, and then issue the INEN command to re-enable the input. For example, if input 3 on I/O brick 2 is assigned as the Program Security input, use 2INEN.3=1 to disable the input and leave it activated, make the necessary user memory changes, and then use 2INEN.3=E to re-enable the input.

16 6K Series Programmer’s Guide

COMEXR (Effect of Pause/Continue Input)

The COMEXR command affects whether a “Pause” input (i.e., an input configured as a pause/continue input with the INFNCi-E command or the LIMFNCi-E command) will pause only program execution or both program execution and motion.

COMEXRØ: (This is the default setting.) Upon receiving a pause input, only program execution will be paused; any motion in progress will continue to its predetermined destination. Releasing the pause input or issuing a !C command will resume program execution.

COMEXR1: Upon receiving a pause input, both motion and program execution will be paused; the motion stop function is used to halt motion. After motion has come to a stop (not during deceleration) , you can release the pause input or issue a !C command to resume motion and program execution.

Other Ways to Pause

  • Issue the PS command before entering a series of buffered commands (to cause motion,

activate outputs, etc.), then issue the !C command to execute the commands.

  • While program execution is in progress, issuing the !PS command stops program execution,

but any move currently in progress will be completed. Resume program execution with the !C

command.

COMEXS (Save Command Buffer on Stop)

The COMEXS command determines the impact on motion, program execution, and the command buffer when the 6K receives a Stop command (S, !S, S1, or !S1) or an external Stop input (an input assigned a stop function with INFNCi-D or LIMFNCi-D).

COMEXS0: Under factory default conditions (COMEXS0), when the 6K receives a stop command (S, !S, S1, or !S1) or a stop input (INFNCi-D or LIMFNCi-D), the following will happen:

  • Motion decelerates to a stop, using the present AD and ADA deceleration values. The motion profile cannot be resumed.
  • If S, !S or Stop input:
    • All commands in the 6K’s command buffer are discarded.
    • Program execution is terminated and cannot be resumed.
  • If S1, or !S1 (an axis number is included in the command):
    • All commands in the 6K’s command buffer are retained.
    • Program execution continues.

COMEXS1: Using the COMEXS1 mode, the 6K allows more flexibility in responding to stop conditions, depending on the stop method (see table below).

Stop Method

What Stops? Motion Program

Resume Motion Profile. (Allow resume with a !C command or a resume input * )

Resume Program. (Allow resume with a !C command or a resume input * )

Save Command Buffer. (Save the commands that were in the command buffer when the stop was commanded) !S or S Yes Yes Yes Yes Yes !S1 or S1 Yes No No No Yes Stop input Yes Yes No Yes Yes Pause input * (if COMEXR1)

Yes Yes Yes Yes Yes

Pause input * (if COMEXR0)

No Yes No Yes Yes

  • A Pause input is an input configured with the INFNCi-E command or the LIMFNCi-E command. This is also the Resume input that can be used to resume motion and program execution after motion is stopped.

COMEXS2: Using the COMEXS2 mode, the 6K responds as it does in the COMEXS0 mode, with the exception that you can still use the program-select inputs to select programs (INSELP value is retained). The program-select input functions are: BCD select (INFNCi-B or LIMFNCi-B), and one-to-one select (INFNCi-P or LIMFNCi-P).

Chapter 1. Programming Fundamentals 17

Restricted Commands During Motion

When motion is in progress on a given axis (or task), some commands cannot have their parameters changed until motion is complete (see table below).

For the commands identified in the table, if the continuous command execution mode is enabled (COMEXC1) and you try to enter new command parameters, you will receive the error response MOTION IN PROGRESS. If the continuous command execution mode in disabled (COMEXCØ), which is the default setting, you will receive the response MOTION IN PROGRESS only if you precede the command with the immediate (!) modifier (e.g., !V2Ø); if you enter a command without the immediate modifier (e.g., V2Ø), you will not receive an error response and the new parameter will be ignored and the old parameter will remain in effect.

Multi-Tasking

If you are using multi-tasking, the restriction on commands is applicable only for the task to

which the command is direct. For example, suppose axes 1 and 2 are associated with Task 1

(TSKAX1,2) and axes 3 and 4 are associate with Task 2 (TSKAX3,4). If motion is in progress

on axes 1 and 2, Task 1 is considered “in motion” and Task 1 cannot execute a command

from the list below. However, while motion is in progress in Task 1 and not Task 2, Task 2 can

execute these commands without encountering an error.

All of the commands in the table below, except for SCALE, are axis-dependent. That is, if one axis is moving you can change the parameters on the other axes, provided they are not in motion.

Command Description Command Description CMDDIR.........Commanded Direction Polarity JOY............... Joystick Mode Enable DRES .............Drive Resolution JOYA............. Joystick Acceleration DRIVE...........Drive Shutdown JOYAA .......... Average Joystick Acceleration ENCPOL.........Encoder Polarity JOYAD .......... Joystick Deceleration ERES .............Encoder Resolution JOYADA ........ Average Joystick Deceleration FOLEN...........Following Mode Enable JOYVH^ .......... Joystick Velocity High GOL ...............Initiate Linear Interpolated Motion JOYVL .......... Joystick Velocity Low HOM ...............Go Home LHAD............. Hard Limit Deceleration HOMA .............Home Acceleration LHADA .......... Average Hard Limit Deceleration HOMAA...........Average Home Acceleration LSAD............. Soft Limit Deceleration HOMAD...........Home Deceleration LSADA .......... Average Soft Limit Deceleration HOMADA.........Average Home Deceleration PSET............. Establish Absolute Position HOMV .............Home Velocity SCALE .......... Enable/Disable Scale Factors * HOMVF...........Home Final Velocity SCLA............. Acceleration Scale Factor JOG ...............Jog Mode Enable SCLD............. Distance Scale Factor JOGA .............Jog Acceleration SCLV............. Velocity Scale Factor JOGAA...........Average Jog Acceleration JOGAD...........Jog Deceleration JOGADA.........Average Jog Deceleration JOGVH...........Jog Velocity High JOGVL...........Jog Velocity Low

  • If any axis is in motion, you will cause an error if you attempt to change this command's parameters.

Chapter 1. Programming Fundamentals 19

Using Numeric (VAR and VARI) Variables

NOTES

  • The examples below show the use of real numeric variables (VAR). Integer variables can

be used in the same operations with these exceptions:

  • Values are truncated to nearest integer value
  • Operations using square root (SQRT) and trigonometric (ATAN, COS, PI, SIN, TAN)

operators are not allowed

  • Some numeric variable operations reduce precision. The following operations reduce the

precision of the return value: Division and Trigonometric functions yield 5 decimal places;

Square Root yields 3 decimal places; and Inverse Trigonometric functions yield 2 decimal

places.

Mathematical Operations

The following examples demonstrate how to perform math operations with numeric variables. Operator precedence occurs from left to right (e.g., VAR1=1+1+1∗ 3 sets VAR1 to 9, not 5).

Addition (+) E x a m p l e^ R e s p o n s e

VAR1=5+5+5+5+5+5+

VAR1 *VAR1=35.

VAR23=1000.

VAR11=VAR1+VAR

VAR11 *VAR11=+1035.

VAR1=VAR1+

VAR1 *VAR1=+40.

Subtraction (-) E x a m p l e^ R e s p o n s e

VAR3=20-

VAR20=15.

VAR3=VAR3-VAR

VAR3 *VAR3=-5.

Multiplication (*) E x a m p l e^ R e s p o n s e

VAR3=

VAR3=VAR3*

VAR3 *VAR3=+200.

Division (/) E x a m p l e^ R e s p o n s e

VAR3=

VAR20=15.

VAR20 *+15.

VAR3=VAR3/VAR

VAR3 *+0.

VAR30=

VAR30 *+75.

VAR19=VAR30/VAR

VAR19 *+116.

Square Root (SQRT) E x a m p l e^ R e s p o n s e

VAR3=

VAR20=

VAR3=SQRT(VAR3)

VAR3 *+8.

VAR20=SQRT(VAR20)+SQRT(9)

VAR20 *+8.

20 6K Series Programmer’s Guide

Trigonometric Operations

The examples below demonstrate how to perform trigonometric operations with numeric variables.

Sine E x a m p l e^ R e s p o n s e RADIAN VAR1=SIN(0) VAR1 *VAR1=+0. VAR1=SIN(30) VAR1 *VAR1=+0. VAR1=SIN(45) VAR1 *VAR1=+0. VAR1=SIN(60) VAR1 *VAR1=+0. VAR1=SIN(90) VAR1 *VAR1=+1. RADIAN VAR1=SIN(0) VAR1 *VAR1=+0. VAR1=SIN(PI/6) VAR1 *VAR1=+0. VAR1=SIN(PI/4) VAR1 *VAR1=+0. VAR1=SIN(PI/3) VAR1 *VAR1=+0. VAR1=SIN(PI/2) VAR1 *VAR1=+1.

Cosine E x a m p l e^ R e s p o n s e

RADIAN

VAR1=COS(0)

VAR1 *VAR1=+1.

VAR1=COS(30)

VAR1 *VAR1=+0.

VAR1=COS(45)

VAR1 *VAR1=+0.

VAR1=COS(60)

VAR1 *VAR1=+0.

VAR1=COS(90)

VAR1 *VAR1=+0.

RADIAN

VAR1=COS(0)

VAR1 *VAR1=+1.

VAR1=COS(PI/6)

VAR1 *VAR1=+0.

VAR1=COS(PI/4)

VAR1 *VAR1=+0.

VAR1=COS(PI/3)

VAR1 *VAR1=+0.

VAR1=COS(PI/2)

VAR1 *VAR1=+0.