Home
Model 940 PROGRAMMING MANUAL
Contents
1. F MQUEUE FULL system flag to make sure that there is available space in the gueue If the gueue becomes full or overflows then the drive will generate a fault S curve optional modifier specifies S curve acceleration MOVE MOVEP MOVEPR MOVEDR MDV MOTION SUSPEND MOTION RESUME Statements MOVED 3 moves 3 user units forward MOVED BACK 3 moves 3 user units backward Statements Lenze PM94P01A 57 MOVEP Move to Position Statement Purpose MOVEP performs motion to a specified absolute position in User Units The commanded range for an Absolute move is from 231 to 231 This statement will suspend the programs execution until the motion is completed unless the statement is used with the C modifier If the S modifier is used then S curve accel is performed during the move Syntax MOVEP lt absolute position gt S LC C ontinue The C argument is an optional modifier which allows the program to continue executing while the motion profile is being executed If the drive is in the process of executing a previous motion profile the new motion profile will be loaded into the Motion Stack The Motion Stack is 32 entries deep The programmer should check the F_MQUEUE_FULL system flag to make sure that there is available space in the queue If the queue becomes full or overflows then the drive will generate a fault S curve optional modifier specifies S curve acceleration See Also MOV
2. in section three of the manual LANGUAGE REFERENCE The GOTO statement is one of the statements that can not be executed from within the Event Body However the JUMP statement can be used to jump to code in the main program body This technique allows the program flow to change based on the execution of an Event For more detail reference JUMP in section three of the manual LANGUAGE REFERENCE The main program body of the program contains the main part of the program which can include all motion and math statements labels I O commands and subroutine calls The main body has to be finished with an END statement 30 PM94P01A Lenze Subroutines are routines that are called from the main body of the program When a subroutine is called GOSUB the programs execution is transferred from the main program to the subroutine called It will then process the subroutine until a RETURN statement occurs Once a RETURN statement is executed the programs execution will return back to the main program to the line of code immediately following the GOSUB statement Fault handler is a section of code that is executed when the drive detects a fault This section of code begins with the ON FAULT statement and ends with an ENDFAULT statement When a fault occurs the normal program flow is interrupted motion is stopped the drive is disabled Event scanning is stopped and the statements in the Fault Handler are executed until the program
3. Compensation Rotor moment of inertia 0 000017 kgm amp Indexer program Max velocity 4500 Rpm a A Tools Hall code amp Faults Number of poles 4 3 Stamate Encoder 200 Parameter View Window Di Y Drive E5940 240V 8A 1 untitled successufully connected 49 Command Adjust analog input zero offset completed with no errors M Wi d 4 or Help press F1 lin 4 Col 1 UPPP over RS 48 Ready Estar E 21 3 gt 2 3 Microsoft _ 2 Windows 7 060215 940 untitled EJ pageo tif Mi Desktop _ gt AVEO 4 05 PM S802 MotionView is the universal programming software used to communication and configure the 94 and 940 drives The MotionView platform is segmented into three windows The First window is the Parameter Tree Window This window is used much like Windows Explorer The various parameters for the drive are represented here as folders or files Once the desired parameter file is selected all of the corresponding information for that parameter will appear in the second window the Parameter View Window The user can then enable disable or edit drive features or parameters The third window is the Message Window This window is located at the bottom of the screen and will display any and all communication status and errors MotionView Studio Drive s status ID amp address n User s program status MW Untitled MotionView94 ES940 240V 8A 1 1 RUNNING mea Project Indexer Ed
4. Input B2 is made Bin3 Inputs B1 and B2 are made Bin4 Input B3 is made Bin5 Inputs B1 and B3 are made Bin6 Inputs B2 and B3 are made Bin7 Inputs B1 B2 and B3 are made The ASSIGN command is used to assign the individual input to a bit in the INDEX variable ASSIGN INPUT lt input name gt AS BIT lt bit gt pkkkkkkk Initialize and Set Variables x ASSIGN INPUT IN Bl AS BIT 0 Assign the Variable INDEX to equal 1 when IN Bl is made ASSIGN INPUT IN B2 AS BIT 1 Assign the Variable INDEX to equal 2 when IN B2 is made ASSIGN INPUT IN B3 AS BIT 2 Assign the Variable INDEX to equal 4 when IN B4 is made Bin Location Input state INDEX Value Bin 1 Input B1 is made 1 Bin 2 Input B2 is made 2 Bin 3 Inputs B1 and B2 are made 3 Bin 4 Input B3 is made 4 Bin 5 Inputs B1 and B3 are made 5 Bin 6 Inputs B2 and B3 are made 6 Bin 7 Inputs B1 B2 and B3 are made 7 Lenze PM94P01A 17 Below the Main program has been modified to change the end place position based on the value of the INDEX variable pk kk kk k kkk kkk kkk kkk k kk Main Program kkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkk ENABLE PROGRAM START WAIT UNTIL IN A4 0 Make sure Arm retracted MOVEP 0 Move to ABS to Pick position OUT1 1 Turn on output 1 on to extend Pick arm WAIT UNTIL IN A4 1 Arm extend OUT2 1 Turn on output 2 to Engage grip
5. MOVE WHILE lt expression gt will also continue its move while it s lt expression gt is true Expression can be any valid arithmetic or logical expressions or their combination Examples MOVE WHILE APOS lt 20 Move while the position is less then 20 then stop with current deceleration rate MOVE UNTIL APOS gt V1 Move positive until the position is greater than the value in variable V1 MOVE BACK UNTIL APOS lt V1 Move negative until the position is less than the value in variable V MOVE WHILE IN Al Move positive while input Al is activated MOVE WHILE IN Al Move positive while input Al is not activated The exclamation mark in front of IN Al inverts or negates the value of IN Al This last example is a convenient way to find a sensor or switch Lenze PM94P01A 43 Motion Queue and statements execution while in motion By default when the program executes a MOVE MOVED or MOVEP statement it waits until the motion is complete before going on to the next statement This effectively will suspend the program until the requested motion is done Note that EVENTS are not suspended however and keep on executing in parallel with the User Program Like the EVENT command the Continue C argument is very useful when it is necessary to trigger an action handle I O while the motor is in motion Below is an example of the Continue C argument This program monitors I O in parallel wi
6. the drive is allowed to CONTINUE executing the user program during the move At this point multiple move profiles can be stored to the queue The Motion Queue can hold up to 32 profiles Like the EVENT command the Continue C argument is very useful when it is necessary to trigger an action handle I O while the motor is in motion Below the Pick and Place Example Program has been modified to utilize the Continue C argument Ekk kk kkk kk kkk k k RRA k kk k k k k k k Main Program kkxkkkkkkkkkkkkkkkkkkkkkkkkkkkkkXk PROGRAM_START ENABLE WAIT UNTIL IN_A4 0 Make sure Arm is retracted before starting the program MOVEP 0 Move to position 0 to pick part OUTI 1 Turn on output 1 to extend Pick arm WAIT UNTIL IN A4 1 Check input to make sure Arm is extended OUT2 1 Turn on output 2 to Engage gripper WAIT TIME 1000 Delay 1 sec to Pick part OUT1 0 Turn off output 1 to Retract Pick arm WAIT UNTIL IN A4 Check input to make sure Arm is retracted MOVED 100 C Move to Place position and continue code execution WAIT UNTIL APOS gt 25 Wait until pos is greater than 25 OUT3 1 Turn on output 3 to spray part WAIT UNTIL APOS gt 75 Wait until pos is greater than or equal to 75 OUT3 0 Turn off output 3 to shut off spray guns WAIT UNTIL APOS gt 95 Wait until move is almost done before extending arm OUT1 1 Turn on output 1 to extend Pick arm WAIT UNTIL IN A4 1 Check input to make sure Arm is ext
7. 10 range assigned to AOUT will be automatically trimmed to that range 34 PM94P01A Lenze Any value outside 10 range assigned to AOUT will be automatically trimmed to that range Example AOUT 100 AOUT will be assigned value of 10 V0 236 VOUT V0 VOUT will be assigned 10 and VO will be unchanged System Flags IN_A1 4 IN_B1 4 IN_C1 4 IR Digital inputs TRUE if input active FALSE otherwise OUT1 OUT2 OUT3 OUT4 OUTS Digital outputs OUTPUT1 OUTPUTS F_ICONTROL OFF R Interface Control Status ON OFF 27 in DSTATUS register F IN POSITION TRUE when Actual Position APOS is within limits set by INPOSLIM variable and motion completed F ENABLED R Set when drive is enabled F EVENTS OFF R Events Disabled Status ON OFF 30 in DSTATUS register F MCOMPLETE Set when motion is completed and there is no motion commands waiting in the Motion Oueue A TT E MQUEUE Emery Moton Queveempy O rara Setitany fautaetected A TT Set when registration mark was detected Content RPOS variable is valid when F_REGISTRATION this flag is active Flag resets by any registration moves MOVEPR MOVEDR or by command REGISTRATION ON F_MSUSPENDED R Set if motion suspended by statement MOTION SUSPEND Flag logic is shown below If TPOS INPOSLIM lt APOS lt TPOS INPOSLIM amp amp F MCOMPLETE amp amp F MQUEUE EMPTY F IN POSITION TRUE Else F IN POSITION FALSE End If For VELOCITY and GEAR mode F_MCOMPL
8. Example EVENT InputRise ON EVENT InputRise OFF Lenze PM94P01A 51 EVENT ON OFF Globally Enables disables events Statement Purpose Enables Disables events execution previously enabled by EVENT Eventname ON statement This is a global ON OF control Effects flag 30 in DSTATUS register F EVENTSOFF After executing EVENTS ON individual event s on off states restored Syntax EVENTS ON Restores execution of previously enabled events EVENTS OFF Disables all execution of all events Remarks Events are globally enabled after reset and controlled by individual Event Eventname ON statements See Also EVENT ON OFF Example kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk EVENT SKIPOUT IN B4 check for rising edge of input B4 JUMP TOGGLE a redirect code execution to TOGGLE ENDEVENT end the event EVENT OVERSHOOT IN B3 check for rising edge of input B3 JUMP SHUTDOWN a redirect code execution to SHUTDOWN ENDEVENT end the event ES V V Mm E T E T E NT SKIPOUT ON NT OVERSHOOOT ON kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Senner ads User COdO nsore s EVENTS OFF turns off all events denia User code EVENTS ON turns on any event previously activated FAULT User generated fault Statement Purpose Allows the user program to set a custom system fault This is useful when the custom program needs a Syntax Remarks See
9. Parameter View Window select Hard limit switch action S811 Lenze PM94P01A 19 Digital Outputs Control The 940 has 5 Digital Outputs The RDY or READY output is dedicated and will only come on when the drive is Enabled and in the RUN mode The remaining outputs are labeled individually as OUT1 OUT4 Outputs can be configured as Special Purpose Outputs If an output is configured as a Special Purpose Outputs it will activate when the state assigned to it becomes true For example if an output is assigned the function Zero speed the assigned output will come on when the motor is not in motion To configure an output as a Special Purpose Output select the 10 folder from the Parameter Tree Then select the Digital IO folder From the Parameter View Window select the Output function parameter you wish to set Output 1 function x Not assigned v Zero speed In speed window Current limit Run time fault 812 Outputs not configured as Special Purpose Outputs can be activated either via the User Program or from a host interface If an output is assigned as a Special Purpose Output neither the user program nor the host interface can override its status The Systems Variable OUTPUTS is a read write variable which allows the User Program or host interface to monitor and set the status of all four outputs as one binary number Each output allocates 1 bit in the OUT
10. e Variable can be shared across Ethernet network or seen ono Variable can be shared across Ethernet network fr nm Variable can be shared across Ethernet network fm Variable can be shared across Ethernet network fm Variable can be shared across Ethernet network User defined Network variable Variable can be shared across Ethernet network F User defined Network variable F User defined Network variable Variable can be shared across Ethernet network Variable can be shared across Ethernet network Baud rate index for ModBus operations 1 4800 2 9600 W Y R W 13 19200 4 38400 5 57600 6 115200 174 VAR MODBUS DELAY W y pw ModBus reply delay in ms Range 0 1000 Rs485 configuration W Y R W 10 normal IP over PPP 1 ModBus RS232 485 normal mode baud rate index 1 4800 2 9600 W Y R W 13 19200 4 38400 5 57600 6 115200 PM94P01A 71 Index Name Format EPM Access Description 177 VAR MOVEPS F N W Same as variable 492 but using S curve acceleration deceleration 178 VAR MOVEDS F N W Same as variable 493 but using S curve acceleration deceleration Velocity value for MDV move Writing to this variable puts MDV segment to motion stack subsequently causing motion to be executed Me VAR MPVS o N unless motion is suspended by 91 Distance is taken from 94 variable which must be written prior writing to this variable 180 VAR MAXVEL F N RW Maxveloc
11. icon from the toolbar To open the Variable Debug Window select the Debug View icon from the toolbar The Debug Window allows you to view the drives system and user variable as well as I O status Use the left arrow key to add variables Use the right arrow key to remove variables Use the Refresh key to refresh variable values Note that variable values are refreshed manually when you click on the Refresh button or automatically when the program stops when a single step is completed or when a breakpoint is encountered Drive ES940 192 168 124 124 Variable Value Hex value pe A APOS_PLS 905 00000000 00000389 E APOS 0 11312481 00000000 nd MAV 1 00000000 00000001 A 3 IREF 1 00000000 00000001 me Ee PGAIN_P 700 00000000 00000268C losT rus PGAIN D 0 00000000 00000000 RAN INPUTS 196 00000000 000000C4 ano AINT 0 11886793 00000000 ADUT AIN2 0 02440215 00000000 vo vo 0 00000000 00000000 Z vi lt ME 5 InputsA1 44 OOOO Outputs1 4 COBO V5 Vi Inputs B1 B4 OOGG Inputs C104 OOOO z 5810 1 7 Inputs and Outputs Analog Input and Output The 940 has two analog inputs These analog inputs are utilized by the dive as System Variables and are labeled AIN1 and AIN2 There value can be directly accessed read by the User Program or via a Host Interface This value can range from 10 to 10 which correlates to 10 volts The 940 has one analog outp
12. E Output 3 not used Output 4 not used Initialize and Set Variables Define and assign Variables values ARA RARA RARA RR RRA ARE RARA RAR Initialize and Set Variables xkkkkkxkkkkkx UNITS 1 ACCEL 75 DECEL 75 MAXV 10 VL NDS DEFINE Output_on 1 DEFINE Output off 0 Lenze PM94P01A 29 Events Define Event name Trigger and pgm pk kk RR RRA kk kkk kkk kk k k k k k k k Events kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk EVENT SPRAY GUNS_ON APOS gt V1 Event will trigger as position passes 25 in pos dir OUT3 Output On Turn on the spray guns out 3 on ENDEVENT End event EVENT SPRAY GUNS OFF APOS gt V2 Event will trigger as position passes 75 in neg dir OUT3 Output Off Turn off the spray guns out 3 off ENDEVENT End even Main Program Define the motion and I O handling of the machine gkkkkkkkkkkkKKKKRKKKKKKKKKR KKK Main Program kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxk PROGRAM_START ENABLE EVENT SPRAY GUNS ON ON Enable the Event EVENT SPRAY GUNS OFF ON Enable the Event WAIT UNTIL IN A4 0 Make sure Arm is retracted before starting the program MOVEP 0 Move to position 0 to pick part OUT1 Output On Turn on output 1 to extend Pick arm WAIT UNTIL IN A4 1 Check input to make sure Arm is extended OUT2 Output On Turn on output 2 to Engage gripper WAIT TIME 1000 Delay 1 sec to Pick part OUT1 Output Off Turn off output 1 to Retract Pick arm WAIT UNTIL IN A4 0 Check inpu
13. N R W User variable l l General purpose user defined variable Lenze PM94P01A 69 VAR V15 User variable General purpose user defined variable 113 115 116 129 VAR V29 Name Format EPM Access Description Units 128 VAR V28 F N R W User variable l General purpose user defined variable User variable E General purpose user defined variable 130 VAR V30 F N R W User variable l General purpose user defined variable 131 VAR V31 F N R W User variable l General purpose user defined variable 133 VAR_MOVEPR _ DISPLACEMENT 136 VAR_STOP_MOTION 137 VAR START PROGRAM W 138 VAR VEL MODE ON 139 VAR IREF Registered move displacement Writing to this variable makes the move MOVEPR using value set by 134 Stops motion 1 stops motion 0 no action Starts user program 1 starts program 0 no action Turns on profile velocity Acts as statement VELOCITY ON 0 normal operation 1 velocity mode on Internal reference for Current or Velocity mode In Velocity mode In Current mode Variable can be shared across Ethernet network Variable can be shared across Ethernet network Variable can be shared across Ethernet network Variable can be shared across Ethernet network Variable can be shared across Ethernet network Variable can be shared across Ethernet network User defined Network variable RAN Variable can be shared across Ethernet network I E U
14. Output 1 off to Disengage gripper This will drop the part in the gripper WAIT TIME 1000 Delay 1 sec to allow the part to clear the gripper OUT1 0 Retract Pick arm to make sure it is up and out of the way RESUME PROGRAM START program restarts from label PROGRAM START ENDFAULT fault handler MUST end with this statement Note The following statements can not be used in Fault Handler Code ENABLE WAIT UNTIL MOVE MOVED MOVEP MOVEDR MOVEPR MDV MOTION SUSPEND MOTION RESUME GOTO GOSUB JUMP ENABLE GEAR ON OFF VELOCITY ON OFF See section 2 1 for additional details and the Language Reference section for the statement ON FAULT ENDFAULT 14 PM94P01A Lenze 1 6 Using advanced debugging features Select the Restart icon from the toolbar to restart the program from the beginning Select either the Step into icon or Step over icons from the toolbar to execute the program statements one line at a time By selecting the Insert Remove breakpoints icon from the toolbar the user can insert Breakpoints throughout the program The drive will execute the program line by line until it comes to one of the breakpoints At this point the program will stop allowing the user to evaluate program variables check program branching or just check code execution To continue code processing you can either Step through the program using the above procedure or you can select the Go
15. WARNING AN Hazard of unexpected motor starting When using the MotionView software or otherwise operating the PositionServo 940 drive over RS 232 485 or Ethernet the motor may start unexpectedly which may result in damage to equipment and or injury to personnel Make sure the equipment is free to operate in this manner and that all guards and covers are in place to protect personnel Hazard of electrical shock Circuit potentials are at 115 VAC or 230 VAC above earth ground Avoid direct contact with the printed circuit board or with circuit elements to prevent the risk of serious injury or fatality Disconnect incoming power and wait 60 seconds before servicing drive Capacitors retain charge after power is removed Lenze PM94P01A 3 1 2 Getting started with the PositionServo Model 940 Before the PositionServo 940 can execute a motion program it has to be properly installed and configured First time users are encouraged to read through the appropriate sections in this manual for the best configuration of the 940 s programmable features and parameters They are also encouraged to reference the PositionServo User s Manual for the proper hardware installation The PositionServo 940 drive has a number of features and parameters which can be programmed via the MotionView Software Below is a list of programmable features and parameters specific for operation under program control They are listed in the order they appear in the Par
16. and executed by profiler in the order they where loaded The Motion Stack can hold up to 32 moves The SML language allows the programmer to load moves into the stack and continue on with the program It is the responsibility of the programmer to check the motion stack to make sure there is room available before loading new moves This is done by checking the appropriate flag in the System status register Incremental MOVED and Absolute MOVEP Motion MOVED and MOVEP statements are used to create incremental and absolute moves respectively The motion that results from these commands is by default a trapezoidal velocity move or S curved velocity move if the S modifier is used with the statement For example MOVEP 10 will result in a trapezoidal move But MOVEP 10 S will result in S curved move IN the above example MOVEP 10 the length of the move is determined by the argument following the MOVEP command 10 This argument can be a number a variable or any valid arithmetic expression The top velocity of the move is determined by setting the system variable MAXV The acceleration and deceleration are determined by setting the system variables ACCEL and DECEL respectively Lenze PM94P01A 39 If values for velocity acceleration and deceleration for a specified distance are such that there is not enough time to accelerate to specified velocity the motion profile will result in triangular or double S profile see picture be
17. delay gt in mS is expired WAIT MOTION COMPLETE wait until last motion in Motion Queue completes Remarks See Also DSTATUS System Variable User Variables and Flags section Example WAIT UNTIL APOS gt 2 amp amp APOS Wait until Apos is gt 2 and lt 3 APOS gt 1 WAIT WHILE APOS lt 2 amp amp APOS gt 1 Wait while Apos is lt 2 and gt 1 WAIT TIME 1000 Wait 1 Sec 1 Sec 1000mS MDV 20 20 Start MDV moves MDV 20 0 Start MDV moves Waits until motion is done WHILE ENDWHILE While Statement Purpose The WHILE lt expression gt executes statement s between keywords WHILE and ENDWHILE repeatedly while the expression evaluates to TRUE Syntax WHILE lt expression gt statement s ENDWHILE Remarks WHILE block of statements has to end with ENDWHILE keyword See Also DO UNTIL Example Execute the statements until Apos is lt 3 statement s ENDWHILE PM94P01A Lenze Appendix A Complete list of variables A complete list of 940 accessible variables is given in the table below These variables can be accessed from the User s Program or any supported interface protocol like RPC over Ethernet PPP over RS232 or MODBUS RTU over RS485 port Any variable can be accessed by its name from the user s program or by Index value using syntax lt VARINDEX gt where lt VARINDEX gt variable index from the table Any interface variable can be accessed by its index value The column Format gives
18. drive and click OK This will load a virtual dive onto the Parameter Tree From here you can set all your parameter setting as well as create your User Program When done you can use the above Saving Configuration File to PC procedure to save your work Later you can continue to work on your program offline by selecting Open configuration file from the Node pull down menu Motion source Reference The 940 can be set up to operate in one of three modes Torque Velocity or Position The drive must be given a command before it can initiate any motion The source for commanding this motion is referred to as the Reference With the 940 you have two ways of commanding motion or two types of References When the dives command signal is from an external source for example a PLC or Motion Controller it is referred to as an External Reference When the dive is being given its command from the User program or through one of the system variables it is referred to as an Internal Reference See table below Reference parameter setting External Internal Analog input AIN1 System variable IREF Analog input AIN1 System variable IREF MA MB pulse train inputs User Program Interface User Program Interface Trajectory generator output Trajectory generator Units All motion statements in the drive work with User units The statement on the first line of the test program UNITS 1 sets the relationship between User
19. exits the fault handler The Fault handler can be exited in three ways The RESUME statement will cause the program to end the Fault Handler routine and resume the execution of the main program The location called out in the RESUME command will determine where the program will commence The RESET statement will cause the program to end the Fault Handler routine and reset the main program to its first statement The ENDFAULT statement will cause the user program to be terminated Keep in mind that while the Fault Handler is being executed Events are not being processed and detection of additional faults is not possible Because of this the Fault Handler code should be kept as short as possible If extensive code must be written to process the fault then this code should be placed in the main program and the RESUME statement should be utilized Note not all of SML statements can be utilized by the Fault Handler For more details reference ON FAULT ENDFAULT in section three of the manual LANGUAGE REFERENCE Comments are allowed in any section of the program and are preceded by a semicolon They may occur on the same line as an instruction or on a line by themselves Any text following a semicolon on a line will be ignored by the compiler 2 2 Variables All SimpleServo variables have ordinal numbers Any variable can be accessed by that number from the User s program or from a Host Interface In addi
20. k kkk k Events FRR KKKKKKKKKKKKKKKKEKKKKKKKKKKKKKK KK KK KKK KKK EVENT SPRAY GUNS ON APOS gt 25 OUT3 1 ENDEVENT EVENT SPRAY GUNS OFF APOS gt 75 OUT3 0 ENDEVENT RRA ARA RARA RA RARA RAR Main Program kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkR PROGRAM START ENABLE EVENT SPRAY GUNS ON ON EVENT SPRAY GUNS OFF ON WAIT UNTIL IN A4 0 Make sure Arm retracted MOVEP 0 Move to Pick position OUT 1 Turn on output 1 on to extend Pick arm WAIT UNTIL IN A4 1 Arm extend OUT2 1 Turn on output 2 to Engage gripper WAIT TIME 1000 Delay 1 sec to Pick part OUT1 0 Turn off output 1 to Retract Pick arm WAIT UNTIL IN A4 Make sure Arm retracted MOVEP 100 Move to Place position OUTI 1 Turn on output 1 on to extend Pick arm WAIT UNTIL IN A4 1 Arm extend OUT2 0 Turn off output 1 to Disengage gripper WAIT TIME 1000 Delay 1 sec to Place part OUT1 0 Retract Pick arm WAIT UNTIL IN A4 0 Arm retracted GOTO PROGRAM START END Lenze PM94P01A 21 1 9 Variables and Define statement Variables are resources in the drive Some of these variables are read write and some are read only Certain variables are used to set the operating parameters of the drive for example ACCEL DECEL or MAXV Other variables can be used to determine the status of the drive AIN INPUTS or APOS Variables can also be used as system registers These system registers can be local to the drive V1 V31 or network v
21. no valid program in the 940 s memory the program area will be empty 8 PM94P01A Lenze Clear any existing program and replace it with the following Program UNITS 1 ACCEL 5 DECEL 5 MAXV 10 ENABLE MOVED 10 MOVEDISTANCE 10 END we After the text has been entered into the program area select the Compile and load icon from the toolbar After compilation is done the following message should appear CT X x Compilation error Check output window for details Click OK to dismiss the Complication error dialog box The cause of the Compilation error will be displayed in the Message Window located at the bottom of your screen MotionView will also highlight the program line where the error occurred S806 UNITS 1 ACCEL 5 DECEL 5 MAXV 10 ENABLE MOVED 10 i MOVEDISTANCE 10 END The problem in this example is that MOVEDISTANCE is not a valid command Change the text MOVEDISTANCE to MOVED UNITS 1 ACCEL 5 DECEL 5 ENABLE MOVED 10 MOVED 10 END sa After editing the program select the Compile and load icon from the toolbar After compilation is done the following message box should appear X i Compilation completed without errors The program has now been compiled and loaded to the drives memory and is ready to run Click OK to dismiss the dialog box 5807 Lenze PM94P01A 9 El To Run the program select the Go icon from t
22. statement will return the code execution back from a subroutine to the point in the program from where the subroutine was called If this statement is executed without a previous call to subroutine GOSUB fault 21 Subroutine stack underflow will result Syntax RETURN See Also GOTO GOSUB Example statements GOSUB MySub MOVED 10 statements END MySub statements RETURN Program jumps to Subroutine MySub Move to be executed once the Subroutine has executed the RETURN statement main program end Subroutine called out from User Program Code to be executed in subroutine Returns execution to the line of code under the GOSUB command MOVED 10 statement Lenze PM94P01A SEND SEND TO Send network variable s value Statement Purpose This statement is used to share the value of Network Variables between drives on an Ethernet network Network Variables are variables NO through N31 The variables to be sent out or synchronized with are called out in the SEND statement For example SEND N5 will take the current value of variable N5 and load it into the N5 variable of every drive on the network The SENDTO statement only update network variables of the drives with the same group ID listed in the command Syntax SEND Na Nb Nx Ny a b x y Any number from O to 31 SENDTO GroupID Na Nb Nx Ny GroupID GrouplD of the drives who s variables will be affecte
23. the target velocity With S curve acceleration the acceleration gradually builds to the peak value then gradually decreases to no acceleration The disadvantage with S curve acceleration is that for the same acceleration distance the peak acceleration is twice that of straight line acceleration which often requires twice the peak torque Note that the axis will arrive at the target position at the same time regardless which type of acceleration method is used 26 PM94P01A Lenze T T2 T T2 Velocity RMS Distance Units 5818 To use S curve acceleration in MOVED MOVEP or MDV statement requires only the additional S at the end of the statement Examples MOVED 10 S MOVEP 10 S MDV 10 20 8 MDV 10 0 8 Motion Queue The 940 drive executes the User Program one statement at a time When a move statement MOVED or MOVEP is executed the move profile is stored to the Motion Queue The program will by default wait or hang on that statement until the Motion Queue has executed the move Once the move is completed the next statement in the program will be executed This effectively will suspend the program until the motion is complete A standard move MOVED or MOVEP is only followed by one argument This argument references the distance or position to move the motor to By adding the second argument C MOVEP 0 C or MOVED 100 C
24. the torque and velocity of the motor Of course there will always be some error in the position following Such error is referred to as Position Error and is expressed as follows Position Error Target Position Actual Position When the Position Error exceeds a certain threshold value Position Error Excess fault F_Fb will be generated You can set the allowable Position Error limit and Position Error Time how long is the delay before the fault is generated These parameters can only be set by using MotionView software From the Node Tree Limits folder Position Limits Motion Modes There are three modes of operation for the 940 Torque Velocity and Position Torque and Velocity moves are generally used when the command reference is from an external device Ain Position mode is used when the command comes from the drives User Program or from an external device encoder or a step and direction pulse Setting the drives mode is done from the Parameter folder in MotionView To command motion from the User Program the drive must be configured to Position Mode Even though the drive is setup in position mode Velocity mode can be turned on and off from the User Program Executing the VELOCITY ON statement is used to activate this mode where as VELOCITY OFF will deactivate this mode This mode is used for special case indexing moves Velocity mode is the mode when the target position is constantly advanced with a rate set in
25. time is 255us servo loop rate index Name Format EPM Access Description J unis 1 VAR IDSTRING N R Drivesidentification string o 2 var name Y RW Drivessymbolicname _ Z o 10 var m D i S Yy R Marb PG 11 var MMoDEL Y R Moormda 12 VAR M VENDOR Y R Motorvendor JG VAR_M_ESET Y R reserva 14 VAR M HALLCODE Y R Halcodeindex o 15 VAR M HOFFSET Y R Reseved 16 VAR M ZOFFSET Y R Reserva M ICTRL Y R Reserva M IM Y R Moor R R ES EA MKT EA MES EA MRS v R motor Rs T R M MAXCURRENT DYT Motors max currents 24 var m maxverocrry v R Motors max velocity 25 VAR MNPOLES Y R motors poles number 26 VAR M ENCODER v R lEncoder resolution OOo 27 varm termvontaGE y A Nominal Motors terminal votage 26 var m reeDBAck y R Feedbackype To 9 Enable switch function 2 VAR_ENABLE SWITCH_TYPE W Y R W 10 inhibit only Bit 1 Run Lenze PM94P01A 65 Index Name Format EPM Access Description Peak current limit for 16kHz operation A mp Peak current limit for 8kHz operation A mp PWM freguency selection Drive mode selection 34 VAR DRIVEMODE W Y rw Porque 1 velocity 2 position Analog input 1 current reference scale in AV AV VAR VELOCITY SCALE k input 1 velocity reference scale in RPM V Reference selection 37 VA
26. with these moves are MOVEPR and MOVEDR These statements have two arguments The first argument specifies the commanded move distance or position The second argument specifies the move made after the registration input is seen If the registration move is an absolute move MOVEPR 10 30 then the second argument 30 will simply define the position to move to once the registration input is made If the registration move is an incremental move MOVEDR 10 30 then the second argument will be the distance to move from the point the registration input is seen Registration Move Position Registration Input is made pe gt n Commanded Move lt Registration gt Move S817 S Curve Acceleration Very often it is important for a move profile to be as smooth as possible This could be to minimize the wear on a machine or it could be that a smooth profile is critical to the successful completion of an operation To perform smooth motion profiles the 940 supports S curve acceleration With normal straight line acceleration the axis is accelerated to the target velocity in a linear fashion With S curve acceleration the motor accelerates slowly at the first then twice as fast as the middle straight line area and then slowly stops accelerating as it reaches the target velocity With straight line acceleration the acceleration changes are abrupt at the beginning of the acceleration and again once the motor reaches
27. Also Example FAULT 200 V0 200 FAULT VO GOTO Purpose Syntax Remarks See Also Example standard fault process for custom conditions like data supplied by interface out of range etc Custom fault numbers must be in region of 128 to 240 decimal FAULT FaultNumber Sets system fault Faultnumber constant in range 128 240 Variables are not allowed in this statement Custom fault will be processed as any regular fault There will be a record in the fault log ON FAULT Sets fault 200 Not valid Variables are not allowed here Go To Statement Transfer program execution to the instruction following the label GOTO lt label gt GOSUB JUMP GOTO Label2 Statements Label2 52 Statements PM94P01A Lenze GOSUB Go To subroutine Statement Purpose GOSUB transfers control to lt subname gt subroutine Syntax GOSUB lt subname gt lt subname gt a valid subroutine name Remarks After return from subroutine program resumes from next statement after GOSUB See Also GOTO JUMP RETURN Example DO GOSUB CALCMOVE MOVED V1 WHILE 1 END SUB CALCMOVE V1 V2 V3 2 RETURN HALT Halt the program execution Statement Purpose Used to halt main program execution Events are not halted by the HALT statement Execution will be resumed by the RESET statement or by executing the JUMP to code from EVENT handler Syntax HALT Remarks This statement is convenient when writing event driven programs See Also RESET Examp
28. E MOVEP MOVEPR MOVEDR MDV MOTION SUSPEND MOTION RESUME Example Statements MOVEP 3 moves to 3 user units absolute position Statements MOVEDR Registered Distance Move Statement Purpose MOVEDR performs incremental motion specified in User Units If during the move the registration input becomes activated goes high then the current position is recorded and the displacement value the second argument in the MOVEPR statement is added to this position to form a new target position The end of the move is then altered to this new target position This statement suspends execution of the program until the move is completed unless the statement is used with the C modifier Syntax MOVEDR lt distance gt lt displacement gt C C ontinue The C argument is an optional modifier which allows the program to continue executing the User Program while a motion profile is being processed If a new motion profile is requested while the drive is processing a move the new motion profile will be loaded into the Motion Stack The Motion Stack is 32 entries deep The programmer should check the F_MQUEUE_FULL system flag to make sure that there is available space in the queue If the queue becomes full or overflows then the drive will generate a fault See Also MOVE MOVEP MOVEPR MOVED MDV MOTION SUSPEND MOTION RESUME Example This example moves the motor 3 user units and checks for the registration input If registra
29. ETE and F MQUEUE EMPTY flags are ignored and assumed TRUE 2 12 Control structures Control structures allow you to control the flow of your program s execution Most of the power and utility of any programming language comes from its ability to change statement order with structure and loops DO UNTIL structures This statement is used to execute a block of code one time and then continue executing that block until a condition becomes true satisfied The difference between DO UNTIL and WHILE statements is that the DO UNTIL instruction tests the condition after the block is executed so the conditional statements are always executed at least one time The syntax for DO UNTIL statement is DO statements UNTIL lt condition gt Lenze PM94P01A 35 The following flowchart and code segment illustrate the use of the DO UNTIL statement Start Statements fT Move Distance 3 inches Delay 2 NO DO seconds MOVED 3 WAIT TIME 2000 Ls input 2 ON gt UNTIL IN A3 U statements YES s819 WHILE Structure This statement is used if you want a block of code to execute while a condition is true The syntax for the WHILE instruction is WHILE lt condition gt statements Stat ENDWHILE Statements YES Move Distance 3 WHILE IN A3 inches Delay 2 MOVED 3 WAIT TIME 2000 Mo ENDWHILE End s820 Statements Subroutines A subroutine is a group of SML stateme
30. Handler is a section of code that executes when the drive generates a fault This allows the program to recover from a fault rather than just disabling the drive Exiting the Fault Handler Code is done by executing either a REST or RESUME statements Without Fault Handler To simulate a fault restart the Pick and Place example program While the program is running disconnect the encoder feedback connector from the drive This will cause the drive to generate a Feedback Error F_Fb and put the drive into a Fault Mode While the drive is in Fault Mode the outputs will remain in there current state any output on will remain on program execution will stop and any motion moves will be terminated In this example the Pick and Place arm may not be in a desired location when the program goes into the fault mode Lenze PM94P01A 13 With Fault Handler Add the subroutine below to the Pick and Place program and restart the program While the program is running disconnect the encoder feedback again This will generate a Feedback Error F_Fb At this point the Fault Routine will take over and process the outputs to get the machine into a safe state pk kk kk kk kkk kk kkk k k k k k Sub Routines kkkkkkkkk k kkkk k kkkkk k kkkk k kkkk k kk kk kkk Enter Sub Routine code here ARA ARE RARA RARA RA RARA RR Fault Handler Routine x kx kkk kkk kkk kkk kkk kk kk kk k ON FAULT statement starts fault handler OUT2 0
31. IF Example DO MOVED V1 Keep looping through the Do Move statements UNTIL IN B4 Until the input is made WHILE IN A2 IN A2 is activated TRUE Lenze PM94P01A 49 ENABLE Enables servo Statement Purpose Turns power to the motor on and enables the servo Syntax ENABLE Remarks See Also DISABLE Example ENABLE servo turns on after this statement END END program Statement Purpose This statement is used to terminate finish user program and its events Syntax END Remarks END can be used anywhere in program See Also DISABLE Example ENABLE servo turns on after this statement EVENT Starts Event handler Statement Purpose EVENT keyword creates scanned event handler Statement also sets one of 4 types of events possible Syntax 1 EVENT lt name gt INPUT lt inputname gt 2 EEG lt name gt INPUT lt inputname gt 3 EEG lt name gt TIME lt period gt 4 lt name gt lt expression gt name any valid alphanumeric string inputname any valid input IN A1 IN C4 period any integer number Expressed in ms expression any arithmetic or logical expression The following statements can not be used within event s handler MOVE MOVED MOVEP MOVEDR MOVEPR MDV MOTION SUSPEND MOTION RESUME STOP MOTION DO UNTIL GOTO GOSUB HALT VELOCITY ON OFF WAIT WHILE While GOTO or GOSUB are restricted a special JUMP statement can be used for program flow change from within event handler See JUMP statement description in Language Reference secti
32. PRAY GUNS ON ON Enable the Event EVENT SPRAY GUNS OFF ON Enable the Event WAIT UNTIL IN A4 0 Ensure Arm is retracted before running the program MOVEP 0 Move to position 0 to pick part OUT1 Output On Turn on output 1 to extend Pick arm WAIT UNTIL IN A4 1 Check input to make sure Arm is extended OUT2 Output On Turn on output 2 to Engage gripper WAIT TIME 1000 Delay 1 sec to Pick part OUT1 Output Off Turn off output 1 to Retract Pick arm WAIT UNTIL IN A4 0 Check input to make sure Arm is retracted MOVED 100 Move to Place position OUT1 Output On Turn on output 1 to extend Pick arm WAIT UNTIL IN A4 1 Check input to make sure Arm is extended OUT2 Output Off Turn off output 1 to Disengage gripper WAIT TIME 1000 Delay 1 sec to Place part OUT1 Output Off Retract Pick arm WAIT UNTIL IN A4 0 Check input to make sure Arm is retracted GOTO PROGRAM START END 22 PM94P01A Lenze 1 10 IF ELSE statements IF ELSE statement allows you to execute one or more statements conditionally You can use IF or IF ELSE construct Single IF example This example increments a counter Variable V1 until the Variable V1 is greater than 10 Again V1 V1 1 IF v1 gt 10 v1 0 ENDIF GOTO Again END IF ELSE example This example checks the value of Variable V1 If V1 is greater than 3 then V2 is set to 1 If V1 is not greater than 3 then V2 is set to 0 IF V1 gt 3 V2 1 ELSE V2 0 ENDIF Whether y
33. PUTS variable For example if you set this variable equal to 15 in the User Program OUTPUTS 15 then all 4 outputs will be turned on The examples below summarize the output functions and corresponding System Flags To set the output write to its flag any non 0 value TRUE To clear the output write to its flag a 0 value FALSE You also can use flags in an expression If an expression evaluates to TRUE then the output will be turned ON Otherwise it will be turned OFF OUTL 1 turn OUT1 ON OUT2 10 any value but 0 turns output ON OUT3 0 turn OUT3 OFF OUT2 APOS gt 3 amp amp APOS lt 10 ON when position within window otherwise OFF 1 8 Events Scanned Events A Scanned Event is a small program that runs independently of the main program SCANNED EVENTS are very useful when it is necessary to trigger an action handle I O while the motor is in motion In the following example the Event SPRAY GUNS ON will be setup to turn Output 3 on when the servo s position becomes greater than 25 Note the event will trigger only at the instant the servo position becomes greater than 25 It will not continue to execute while the position is greater than 25 AAA EVENT SETUP x xk xkxk xk xk xkxkkkkkkkkkkkkkkkkkk kkkkkkkkkkkk EVENT SPRAY GUNS_ON APOS gt 25 OUT3 1 ENDEVENT A kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk The Event code should be entered in the EVENT SETUP section o
34. Pick position OUT1 1 Turn on output 1 on to extend Pick arm WAIT UNTIL IN_A4 1 Arm extend OUT2 1 Turn on output 2 to Engage gripper WAIT TIME 1000 Delay 1 sec to Pick part OUT1 0 Turn off output 1 to Retract Pick arm WAIT UNTIL IN A4 Make sure Arm retracted MOVED 10 Move to Place position OUT1 1 Turn on output 1 on to extend Pick arm WAIT UNTIL IN A4 1 Arm extend OUT2 0 Turn off output 1 to Disengage gripper WAIT TIME 1000 Delay 1 sec to Place part OUT1 0 Retract Pick arm WAIT UNTIL IN A4 0 Arm retracted GOTO PROGRAM START END Once you have made the above modifications export the program to file and save it as Pick and Place with I O then compile download and test the program ASSIGN amp INDEX Using inputs to generate predefined indexes INDEX is a variable on the drive that can be configured to represent a certain group of inputs as a binary number ASSIGN is the command that configures what inputs are utilized and how we want to configure them Below the Pick and Place program has been modified to utilize this INDEX function The previous example program simply picked up a part and moved it to a place location For demonstration purposes we will add seven different end or place locations These locations will be referred to as Bins What Bin the part is placed in will be determined by the state of three inputs B1 B2 and B3 Bini Input B1 is made Bin2
35. PosiTIONServo A Set Events handling here PROGRAM START ENABLE EVENT SPRAY GUNS ON ON EVENT SPRAY GUNS OFF ON WAIT UNTIL IN A4 0 MOVEP 0 OUT1 Output On WAIT UNTIL IN A4 1 OUT2 Output On WAIT TIME 1000 OUT1 Output Off WAIT UNTIL IN A4 0 MOVED 100 OUT1 Output On WAIT UNTIL IN A4 1 OUT2 Output Off WAIT TIME 1000 OUT1 Output Off WAIT UNTIL IN A4 0 GOTO PROGRAM START END zkkkkkk k kk k kk e I O List i Input Al not used A Input B1 not used i Input C1 not used 5 Output 1 Pick Arm B Output 2 Gripper k kkkkk kk k k kk kk Initialize and Set UNITS 1 ACCEL 75 DECEL 75 MAXV 10 p kkkk k k k k kk kkk h Events kkk kk h zkkkk k k k k k k k k Main Program x Enable the Evel Enable the Evel Make sure Arm i Move to positi Turn on output Check input to Turn on output Delay 1 sec to Turn off outp Check input to Move to Place Turn on output Check input to Turn off outpu Delay 1 sec to jRetract Pick al Check input tol FR RIK IIR IR IIR I KIKI AA 5950 Model 940 PROGRAMMING MANUAL PM94P01A Copyright 2005 by AC Technology Corporation All rights reserved No part of this manual may be reproduced or transmitted in any form without written permission from AC Technology Corporation The informati
36. R REFERENCE W Y R W 1 internal source 0 external Selects how position reference inputs operating 38 VAR STEPINPUTTYPE W Y R W 1 Quadrature inputs A B 0 Step amp Direction type Motor thermal protection function VAR MOTORTHERMALPROTECT W Y R W 0 disabled 1 enabled 40 VAR MOTORPTCRESISTANCE F y pw Motor thermal protection PTC cut off Ohm resistance in Ohms Second encoder VAR_SECONDENCODER W Y R W 0 Disabled 1 Enabled Regen circuit PWM duty cycle in 5 Selects source for repeat buffers 43 VAR ENCODERREPEATSRC w y R W 0 Encoder connected to P4 terminal 1 Feedback module if available on particular module Velocity loop Proportional gain 8 Velocity loop Integral gain Position loop Proportional gain PI N GAIN A Position loop Integral gain Position loop Differential gain Position loop integral gain limit 51 VAR VREG WINDOW W Y R W Gains scaling coefficient Range 5 4 Software Enable Disable 52 VAR ENABLE W N W 0 disable 1 enable Drive s reset cold boot 53 VAR_RESET W N W 0 no action 1 reset drive 54 var_stTaTus w N R Drive sstatusregister J 55 VAR BCR SIZE W Y R_ usersprogramByte codesize__________ Bytes User s program autostart flag 0 program has to be started manually 56 VAR_AUTOBOOT W Y R W MotionView or interface 1 program started automatically after drive booted 66 PM94P01A Lenze Index Name F
37. Registered move distance Incremental motion 132 VAR MOVEDR DISTANCE VAR MOVEDR E r dina ed dE ikea riting to this variable executes the move O MOVEDR using value set by 132 134 VAR MOVEPR DISTANCE N W Registered move distance Absolute motion as UU oe or per MOVEPR statement Amps p User defined Network variable User defined Network variable 70 PM94P01A Lenze 154 155 157 159 VAR NV13 VAR NV14 VAR NV15 VAR NV16 VAR NV17 VAR NV18 VAR NV19 Format EPM Access Description Units TI a Variable can be shared across Ethernet network CEZ 50 Variable can be shared across Ethernet network rem Variable can be shared across Ethernet network User defined Network variable o Variable can be shared across Ethernet network o mao Variable can be shared across Ethernet network EZ mm Variable can be shared across Ethernet network KA DEN Variable can be shared across Ethernet network User defined Network variable User defined Network variable 162 EN O O O al R A a4 Q O 167 168 169 170 171 172 173 VAR MODBUS BAUDRATE 139 VAR RS485 CONFIG 176 VAR PPP BAUDRATE Lenze VAR NV22 VAR NV23 VAR NV24 VAR NV25 VAR NV26 VAR NV27 VAR NV28 VAR NV29 VAR NV30 VAR NV31 VAR SERIAL ADDRESS KA DDE Variable can be shared across Ethernet network e Variable can be shared across Ethernet network
38. TA en A EEE EE A EEE wees EE EE 25 1 12 Subroutines ahd LOOPS ae av a aa Aase GE A A A a Vodn 30 2 Programming esros rer Ener ERTL eae eG dvds ao e bebe e eves bakes anes Beagle A we 31 A NN Nr A AAA titel eee E ls eave Gin away 31 22 VanabloS ox A Bd ee Acer AE A AAA SAR dekar o k o 33 2 9 AMMIMONOG y sa VASS SORA ARA AA ARAN EE AES E AAA A EE FEAR SOONER AED ee Re So meee 34 24 Logical expressions and operalbrs s s m8 sua B F4 do Kde 60 ERED TEN EREOE RHEE EERSTE REE o ROE k l A 34 25 BUWSC OPAOS Leren seere Aer 34 2 6 Boolean OperalolS earen niria eane a e AO AT a 35 27 Comparison operators reran ia AA AA We A AA aet 35 2 9 System Vari bles and Flags 0 0 ea aud Bearden 35 2 10 System Variables storage organization 2 0 ec arr rr renere verner anna eee teen eens 36 2 11 System Variables and Flags Summary 36 2 12 Control structures shui kkasenet ai dad arte aa en AN 37 2 13 Scanned Event Statements naa risk stas aa a den Book poda dradd ie 40 PAS MAN ne k be eden dd badene DA kesson b e 41 2 14 System Status Register DSTATUS register o ooooocooccoro arrene ranerne erre K rekne 47 2 15 F ultC des DFAULTS register oko o s ass ang bis A A A mene feen nie ear beid dl hral sekret 48 216 Limitations and TOSMTMCIONE 2220 ci Soka cece deo ke rm eo dh SEKT SARS MMA MEG EGG Ra be OPE AAA 49 3 Language Reference aaaanuunnnn iadi ta keV E Enan EER EE EE E n enn 50 Appendix A Comp
39. ameter Tree Window in MotionView Please refer to Position Servo Model 940 User s Manual for details on parameters not covered below Parameters Autoboot Enable Disable If this option is Enabled the drive will start executing the user program stored in the drives flash memory at Power Up If there is not a valid program existing in the flash memory then the program must be started manually via MotionView or a Host Interface DANGER AN Hazard of unexpected motor starting When using the MotionView software or otherwise operating the PositionServo 940 drive over RS 232 485 or Ethernet the motor may start unexpectedly which may result in damage to equipment and or injury to personnel Make sure the equipment is free to operate in this manner and that all guards and covers are in place to protect personnel e Group ID The Group ID feature allows you to group 940 drives together via an Ethernet network When used with the SEND and SENDTO command drives in the same group can share and updated variables Group ID Numbers can be set between O and 32767 See statements SEND and SENDTO for further explanations Communication e IP Setup Displays properties and settings for Ethernet communication port IP Address Digital I O e Inputs The 940 has 12 Digital Inputs The inputs are grouped into three set of four A1 A4 B1 B4 and C1 C4 Each group shares its own common Acom Bcom and Ccom Inputs can b
40. ammed using MDV moves Point 2 Point Point 5 6 Velocity S D o o o 5 10 15 20 25 30 Distance cm S823 The following table represents the graph show above am Number Distance moved during segment Velocity at the end of segment Segment moves MDV 3 7 56 MDV Sv 2 MDV 4 16 MDV Zi da D MDV 255 3 57 MDV 3 7 LL MDV 5 p 20 MDV B 0 END 42 PM94P01A Lenze The following equation can be used to calculate the acceleration that results from segment move Accel V2f V20 2 D Vf Final velocity VO Starting velocity D Distance S curve Acceleration Instead of using a linear acceleration the motion created using segment moves MDV statements can use S curve acceleration The syntax for MDV move with S curve acceleration is MDV lt distance gt lt velocity gt S Segment moves using S curve acceleration will take the same amount of time as linear acceleration segment moves S curve acceleration is useful because it is much smoother at the beginning and end of the segment however the peak acceleration of the segment will be twice as high as the acceleration used in the linear acceleration segment Motion SUSPEND RESUME At times it is necessary to control the motion by preloading the motion stack with motion profiles Then based on the User Program execute those motion profiles at some predetermined instance The statement MOTION SUSPEND will suspend motion u
41. ariables N1 N31 In the example below we set the trigger position for the EVENT SPRAY_GUNS_ON to be equal to V1 and the trigger position for EVENT SPRAY_GUNS_OFF to be equal to V2 The DEFINE command is used to assign a name to the state of a drive variable Output_ON 1 Output_OFF 0 You can also assign a set number a name MIN 25 MAX 75 In the example below we assign the name Output On to equal the value 1 and Output Off to equal the value 0 Defining and setting variables should be done in the Initialize and set Variables section of the program DO kee KER Initialize and Set Variables xxkkkkkkkkkkkkkkkkk UNITS 1 ACCEL 5 DECEL 5 MAXV 10 Vi 25 Set Variable VI equal to 25 V2 75 Set Variable V2 eugal to 75 DEFINE Output On 1 Define Name for output On DEFINE Output Off 0 Define Name for output Off ekkkkkkkkkkkkkkkkkkkkkxkxk EVENTS kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxk VENT SPRAY GUNS ON APOS gt VI Event will trigger as position passes 25 in pos dir OUT3 Output On Turn on the spray guns out 3 on NDEVENT End event td ES za VENT SPRAY GUNS OFF APOS gt V2 Event will trigger as position passes 75 in neg dir OUT3 Output_Off Turn off the spray guns out 3 off ENDEVENT End even Ekk kk kkk kk kkk kk kkk k k k k k Main Program kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkXk PROGRAM START ENABLE EVENT S
42. ation positon EC 218 VAR RPOS JF N R Registration position U 216 VAR POSERROR _ W N R fPositioneror EC 217 VAR CURRENT VEL F N R Current velocity demanded value UU S 218 VAR CURRENT ACCEL F N R Currentacceleration demanded value UU S Target position advance Every write to this variable adds value to the Target position 219 VAR TPOS ADVANCE W N W summing point Value gets added once per write This variable useful when loop is driven by Master encoder signals and trying to correct phase Value is in encoder counts Same as INDEX variable in user s program 220 VAR IOINDEX R W See INDEX in Language Reference section Of this manual 221 var PSLIMIT PULSES Positive Software limit switch value in Encoder counts 299 VAR NSLIMIT PULSES W y R W Negative Software limit switch value in EC Encoder counts Soft limit switch action code 0 no action 1 Fault Pe eee w Y BAN 2 Stop and fault When loop is driven by trajectory generator only With all the other sources same action as 1 Same as var 221 but value in User Units Same as var 222 but value in User Units Lenze PM94P01A 73 AC Technology Corporation member of the Lenze Group 630 Douglas Street Uxbridge MA 01569 Telephone 508 278 9100 Facsimile 508 278 7873
43. ative to a fixed zero point The zero point for a system is established during the homing cycle typically performed immediately after power up During a homing cycle the motor will make incremental moves while checking for a physical input index mark or both 40 PM94P01A Lenze Registration MOVEDR MOVEPR moves MOVEPR and MOVEDR are used to move to position or distance respectively just like MOVEP and MOVED The difference is that while the statements are being executed they are looking for a registration signal or registration input If during the motion a registration signal is detected then a new end position is generated If the move is a MOVEDR then the drive will increment the distance called out in the registration statement This increment will be referenced from the position the registration input was seen If the move is a MOVEPR then the new position will be the absolute position called out in the registration statement Example MOVEDR 5 1 Statement move a distance of 5 user units or registration position 1 user units if registration input is activated during motion There are two exceptions from this behavior Exception one The move will not be modified to Registration position displacement if the registration was detected while system was decelerating to complete the motion Exception two Once the registration input is seen there must be enough room for the motor to decelerate to a stop using the profile
44. ays performed regardless of program run state PositionServo supports incremental quadrature encoder or resolver feedback devices A second encoder can also be supported during position and velocity modes 6 PM94P01A Lenze Studio tool suite Menu 8 Toolbar Options MY Untitled MotionView94 ES940 240V 8A 1 1 STOPPED Project Indexer Edit Node Tools View Help gt Dj uj r x sje sles alejo va ej El s804 Studio tool suite Menu When developing or editing a program additional Menu options tabs become available The additional options tabs are Indexer and Edit These tabs are only available when you are in the programming area Parameter View Window These options are used to load compile save and debug the program The following are examples on how to utilize these option tabs Please note that to utilize these features you must select Indexer program from the node tree This will expand the menu options You then have to click your mouse anywhere in the Parameter View Window to activate Menu Tabs Load User program from the PC to MotionView Select Indexer from the pull down menu Select Import program from file from the drop down menu and select desired program This procedure loads the program from file to the editor window It doesn t load the program to the 940 drive s memory Compile program and load to 940 drive Select Indexer from the pull down menu Select Comp
45. be used with these operators Examples V1 V2 OxF IF INPUTS amp 0x3 Vl Vl Oxff V1 INPUTS OxF V1 IN A1 clear all bits but lowest 4 check inputs 0 and 1 set lowest 8 bits jinvert inputs 0 3 jinvert input 0 2 6 Boolean Operators These operators are used in logical expressions Examples IF APOS gt 2 amp amp APOS lt 6 APOS gt 10 amp amp APOS lt 20 statements if true ENDIF The above example check if APOS actual position is within one of two windows 2 to 6 units or 10 to 20 units In other words If APOS is more than 2 AND less than 6 OR If APOS is more than 10 AND less then 20 THEN evaluate to TRUE Otherwise it is FALSE 2 7 Comparison operators Following operators are supported ma Examples IF APOS lt 10 IF APOS gt 20 IF APOS IF V1 lt 2 amp amp V2 lt gt 4 2 9 System Variables and Flags System variables are variables that have a predefined meaning They give the programmer user access to certain drive parameters Most of these variables can be set from MotionView In most cases the value of these variables can be read and set in your program or via a Host Interface Variables are either read only write only or read and write Read only variables can only be read and can t be set For example INPUT 5 is an illegal action because you can not set an input System Flags are System Variables that can only have values of 0 or 1 For exa
46. bit number range from 0 to 11 in the INPUTS System variable Each input allocates 1 bit in the INPUTS variable See table below System Variable INPUTS bit Some inputs can have additional special functionality Travel Limit switch Enable input and Registration input Configuration of these inputs is done from MotionView Input functionality is summarized in the table below and in the following sections The status of the current state of the drives inputs are available to the programmer through dedicated System Flags or as bits of the System Variable INPUTS The table below summarizes the inputs Function Special function impar o Common for A section impar me I me CS me S Common for B section i pomer I me SCS Registration sensor input impuros Common for O section O 16 PM94P01A Lenze Read Digital Inputs Below the Pick and Place example program has been modified to utilize the WAIT UNTIL inputs statements in place of the WAIT TIME statements IN_A4 is used as a proximity sensors to detect when the pick and place arm is extended and when it is retracted When the arm is extended IN_A4 will be in an ON state and will equal 1 When the arm is retracted IN_A4 will be in an OFF state and will equal 0 pkk kkk kkk kkk kkk kkk k kk Main Program kkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkk ENABLE PROGRAM_START WAIT UNTIL IN A4 Make sure Arm retracted MOVED 10 Move to
47. ble General purpose user defined variable 107 VAR V7 F N RW User variable General purpose user defined variable 108 VAR V8 F N RW User variable l General purpose user defined variable 109 VAR vo F N R W User variable l l General purpose user defined variable 110 VAR V10 F N R W User variable l l General purpose user defined variable 111 VAR v11 F R W User variable l l General purpose user defined variable F User variable General purpose user defined variable 4 User variable VAR V1 gt E Nam General purpose user defined variable User variable VAR V14 F on paw General purpose user defined variable 112 VAR_v12 114 VAR_V16 User variable General purpose user defined variable a User variable 117 VAR V17 on pw General purpose user defined variable General purpose user defined variable General purpose user defined variable VAR V20 F N R W User variable l l General purpose user defined variable VAR V21 F N R W User variable l l General purpose user defined variable 122 IVAR v22 F N R W User variable l l General purpose user defined variable 123 VAR V23 F N R W User variable l l General purpose user defined variable 124 VAR V24 F N R W User variable l l General purpose user defined variable 125 VAR v25 F N R W User variable l l General purpose user defined variable 126 VAR V26 F N R W User variable l l General purpose user defined variable 127 VAR V27 F
48. ble in the system is stored as 64 bit in 32 32 fixed point format Maximum number can be represented by this format is 2 147 483 648 Variable resolution in this format is 2 3E 10 2 3 Arithmetic s Four arithmetic functions are supported Constants as well as User and System variables can be part of the arithmetic expressions Examples Vi V1 V2 Add two user variables Vi V1 1 Subtract constant from variable V2 V1 APOS Add User and System actual position variables APOS 20 Set System variable V5 V1 V2 V3 5 24 1 Complicated expression Subtraction Multiplication Result overflow for and operations will cause Arithmetic overflow fault 19 Result overflow underflow for and operations does not cause arithmetic fault 2 4 Logical expressions and operators Bit wise Boolean and comparison operators are considered as Logical Operators Simply put they are the operators which operate on logical values of the operands There are two possible values for logical operand TRUE and FALSE Any value contained in a User variable System variable or flag is treated as TRUE or FALSE with these types of the operators If variable value equal 0 it is considered FALSE All the other values non 0 including negative numbers are considered TRUE 2 5 Bit wise operators The following bit wise operators are supported Symbol 32 PM94P01A Lenze Both User or System variables can
49. bles that are related to the purpose of the keyword The example field contains a code segment that illustrates the usage of the keyword Assign Input As Index Bit Statement Assign keyword causes specific input to act as a particular bit of system variable INDEX After such assignments changes in input state will cause changes in particular bit input is assign to ASSIGN INPUT lt input name gt AS BIT lt bit gt Input name IN_A1 IN_A2 etc Bit INDEX variable bit number from 0 to 7 BIT 0 index bit 0 state matches state of input B4 Lenze PM94P01A DEFINE Define name Pseudo statement Purpose DEFINE is used to define symbolic names for variables and constants for programming convenience It is a pseudo statement i e it is not executable DEFINE can be used also to substitute a symbolic string Syntax DEFINE lt name gt lt string gt name any symbolic string string any symbolic string Remarks DEFINE must be located before any executable statement See Also Example DEFINE Five 5 DEFINE Three 3 DEFINE Result V1 DEFINE SUMM Five Three ProgramStart Result Five Three Is same as Vl 5 3 Result SUMM same result as above End DISABLE Turns servo OFF Statement Purpose DISABLE turns the power to the motor OFF and disables the servo Syntax DISABLE Remarks Once the DISABLE statement is executed power to the drive is turned off and the motor can move freely APOS will continue to display the current p
50. d configures the tool set accordingly The MotionView platform is divided up into three sections or windows the Parameter Tree Window the Parameter View Window and the Message Window Refer to Section 1 3 for more detail SimpleMotion Programming Language SML SML is the programming software utilized by MotionView The SML software provides a very flexible development environment for creating solutions to motion applications The software allows you to create complex and intelligent motion moves process l O perform complex logic decision making do program branching utilize timed event processes as well as a number of other functions found in PLC s and high end motion controllers User Program or Indexer Program This is the SML program developed by the user to describe the programmatic behavior of the 940 drive The User Program can be stored in a text file on your PC or in the 940 s memory The User Program needs to be compiled translated into binary form before the 940 can execute it with the aid of the MotionView Studio tools MotionView Studio MotionView Studio is a part of the MotionView software platform It is a tool suite containing all the software tools needed to program and debug a PositionServo These tools include a full screen text editor program compiler status and monitor utility online oscilloscope and a debugger function that allows the user to step through the program during program development
51. d synchronized See Also Network variables Example statements N1 12 Set N1 equal to 12 SEND N1 Set the N1 variable to 12 in every drive in the Network SEND N5 N10 Sets the N5 through N10 variable in all drives on the Network N20 25 Set N20 equal to 25 SENDTO 2 N20 Set the N20 variable to 25 only in drives with GroupID 2 statements END End main program STOP MOTION Quick Stop Motion Statement This statement is used to stop all motion When the STOP MOTION statement is executed all motion Purpose Syntax See Also Example profiles stored in the Motion Queue are cleared and motion will immediately be stopped via the deceleration parameter set in the DCEL variable If the QUICK modifier is used then the deceleration value will come from the QDECEL variable The main use for this command is to control an emergency stops or when the End Of Travel sensor is detected Note that the current position will not be lost after this statement is executed STOP MOTION Stops using DECEL deceleration rate STOP MOTION QUICK Stops using QDECEL deceleration rate MOTION SUSPEND statements DECEL 100 ODECEL 10000 statements STOP MOTION QUICK Lenze PM94P01A 63 VELOCITY ON OFF Velocity Mode Statement Purpose The VELOCITY ON statement enables velocity mode in the drive The VELOCITY OFF statement disables velocity mode and returns driv
52. d Decel Value If the new registration move is larger than the distance need to come to a stop then the motor will overshoot the new registration position Segment moves In addition to the simple moves that can be generated by MOVED and MOVEP statements complex profiles can be generated using segment moves A segment move represents one portion of a complete move A complete move is constructed out of two or more segments starting and ending at zero velocity Lenze PM94P01A 41 MDV Segments Segments are created using a sequence of MDV statements The simplified syntax for the MDV Move Distance with Velocity statement is MDV lt distance gt lt velocity gt The lt distance gt is the length of the segment move The lt velocity gt is the final velocity for the segment move The starting velocity is either zero or the final velocity of the previous segment The final segment in a complete move must have a velocity of zero If the final segment has a final velocity anything other than zero a motion stack under run fault will occur The profile shown below can be broken up to 8 MDV moves The first segment would define the distance between point 1 and point 2 and the velocity at point 2 So if the distance between point 1 and 2 was 3 units and the velocity at point 2 was 56 RPM the command would be MDV 3 56 The second segment would give the distance between point 2 and 3 and the velocity at point 3 and so on Any profile can be progr
53. d therefore the program is never suspended by these statements If last MDV statement in the Queue doesn t specify a O velocity Motion a Stack Underflow fault 24 will occur The MOTION SUSPEND and MOTION RESUME statements can be utilized to help manage the User Program and the Motion Queue If the motion profiles loaded into the queue aren t managed correctly the Motion Queue can become overloaded which will cause the drive to fault 2 14 System Status Register DSTATUS register System Status Register DSTATUS is a Read Only register lts bits indicate the various states of the 940 s subsystems Some of the flags are available as System Flag Variables and summarized in the table below o eawn SS 1 E T i 6 7 1 2 2 22 25 24 25 25 27 28 29 30 Events disabled All events disabled when this flag is set After executing EVENTS ON all events previously enabled by EVENT EventName ON statements become enabled again Lenze PM94P01A 45 2 15 Fault Codes DFAULTS register Faults in the drive are recorded in a special variable called the DFAULTS register or Fault Register Specific flags are also set in the System Status Register Whenever a fault has occurred in the drive a record of that fault will be recorded in a special system variable called the Fault Register DFAULTS In addition specific flags in the System Status Register will be set helping to indicate what class of fault the current fau
54. dex Variable Access Variable Description Units 214 TPOS R Theoreticallcommanded position UserUnits 217 mv R Commandedvelocitym User Units Sec 218 RPOS R Registration postion Valid when system flag F REGISTRATION set User Units 218 TA R Commandedacceleration LO 183 ODECEL Quick Deceleration for STOP MOTION QUICK statement User Units Sec 46 PGANP RW PositionloopP gan Pr 47 PGANI RW Positionlooptgain PG 48 PGAND RW PosiionloopDgan PG PGAIN VFF RW Position loop VFF velocity feed forward gain MEG as PGA LIM RW Positonlooplgainiimt pf CS 44 VGAINP AW velocity op Pagan 45 veani AW velocity op gain Los INPUTS Digital Inputs states The frst 12 bits correspond tothe 12 arive inputs 66 OUTPUTS RAW Digital outputs First 5 bits represents outputs From Oto 4 INDEX AW Lower8 bits are used See ASSIGN statement for detals 18s PHCUR R Motorphasecurent Ampere 54 DSTATUS R Statusflagsregiser OLO Drauets R Fauttcoderegiser OLO Analog input Scaled in volts mf an on Range form 10 to 10 Analog output value in Volts a AOUT RW Valid range from 10 to 10 V VEN When a 0 Zero value is assigned to the variable UNITS then UNITS is set to OUAD ENCODER COUNTS This is the default setting at the start of the program before UNITS lt value gt is executed 2 Any value outside
55. disturbed by the interface usually asynchronous body to the program state event Syntax ICONTROL ON Enables Interface control ICONTROL OFF Disables interface control Remarks After reset interface control is enabled by default See Also Example EVENT LimitSwitch IN Al limit switch event Jump LimitSwitchHandler jump to process limit switch ENDEVENT V0 0 EVENT LimitSwitch ON Again HALT system controlled by interface LimitSwitchHandler EVENTS OFF turn off all events ICONTROL OFF disable interface control STOP MOTION QUICK DISABLE Optional DISABLE VO 1 indicate fault condition to the interface ICONTROL ON EVENTS ON GOTO AGAIN Lenze PM94P01A 55 IF If Then Else Statement Purpose The IF statement tests for a condition and then executes the specific action s between the IF and ENDIF statements if the condition is satisfied If the condition is false no action is taken and the instructions following the ENDIF statement are executed Optionally using the ELSE statement a second action s may be specified to be executed if the condition is false Syntax IF lt condition gt statements 1 ELSE statements 2 ENDIF The lt condition gt is the condition to be tested This condition may be a comparison an input being TRUE or FALSE H or L system flag or a variable used as a flag if O false else true Comparisons compare the values of two operands and determine if the condition is TRUE or FALSE A comparis
56. e assigned individual debounce times via MotionView Debounce times can be set between 0 and 1000ms 1ms 0 001 Sec Inputs can be monitored via the user program monitored via a host interface and or be assigned Special Purpose Functions Refer to Section 1 6 for more detail e Outputs The 940 has 5 Digital Outputs One output is dedicated and will only come on when the drive is Enabled and is in the RUN mode Outputs 1 4 can be either activated via the user program activated via a host interface or be assigned a Special Purpose Function Refer to Section 1 6 for more detail Indexer Program When the Indexer program file is selected from the node tree the Parameter View Window displays the drives user program This area can now be used to enter edit and debug the user program Also additional programming features will be displayed in the menu and toolbar Refer to Section 1 3 for more detail 4 PM94P01A Lenze 1 3 Programming flow overview MotionView utilizes a basic like programming structure referred to as SimpleMotion programming Language SML SML is a quick and easy way to create powerful motion applications With SML you describe your system logistics motion I O processing and user interaction programmatically i e creating the program The program structure includes a full set of arithmetic and logical operator programming statements which allow the user to command motion process I O and control program flow Befor
57. e the 940 drive can execute the users program the program first needs to be compiled translated into binary machine code and downloaded to the drive Compiling the program is done by selecting the Compile button from the toolbar You can also compile and download the program at the same time by selecting the Compile and Load button from the toolbar Once downloaded the compiled program is stored both in the 940 s memory as well as in the internal flash memory The figure below summarizes program preparation process Prepare User Program COMPILER i Any Error NO Fix program errors YES Load compiled machine to PositionServo 940 Start Execution in debugger environment or at next power up Lenze PM94P01A 801 1 4 MotionView MotionView Studio Untitled MotionView94 ES940 240V BA 1 1 RUNNING lex Project Node Tools View Help 2 2 32 Ols ala e x s 2 32 E5940 240V 8A 1 1 Parameter name Value Units Min max Sa Motor Eick here to change the motor Parameters a Communication Motor mo MASO5D30 XXX 10 Motor vendor BD Vonage constant 5 cu nalog10 ideene pve phass 1930 Parameter Tree Window 5 El Limits Resistance phase phase 6 80 Ohm Velocity limits max phase current 2 10 Amp amp Position limits Terminal voltage max 325 voc
58. e to its default mode Default mode is Positioning The velocity value for this mode is set by setting the System Variable VEL All position related variables are valid in this mode Syntax VELOCITY ON VELOCITY OFF Remarks The VELOCITY ON statement is considered one of the motion related commands It has to be implemented when the drive is enabled If the VELOCITY ON statement is executed while the drive is disabled fault 27 Drive disabled will occur Execution of any motion related profiles while the drive is in Velocity mode will be loaded into the Motion Queue When the VELOCITY OFF statement is executed the drive defaults back to Position mode and immediately begins to execute the motion profiles stored in the Motion Queue Please note that the VEL variable can be set on the fly allowing dynamic control of the velocity See Also Example VEL 0 Set velocity to 0 VELOCITY ON VEL 10 Turn on Velocity Mode Set velocity statements VELOCITY OFF WAIT MOTION COMPLETE WHILE APOS lt 3 Turn off Velocity Mode WAIT Wait Statement Purpose This statement suspend the execution of the program until some condition s is are met Conditions include Expressions TRUE or FALSE Preset TIME expiration MOTION COMPLETE Syntax WAIT UNTIL lt expression gt wait until expression becomes TRUE WAIT WHILE lt expression gt wait while expression is TRUE WAIT TIME lt time delay gt wait until lt time
59. e will generate a fault MOVE MOVEP MOVEPR MOVED MDV MOTION SUSPEND MOTION RESUME This example moves the motor to the absolute position of 3 user units while checking for the registration input If registration isn t detected then the move is completed 2 If registration is detected then the end of the move is changed to a new absolute target position of 2 user units Segment Move Statement MDV defines incremental motion segment by specifying distance and final velocity for each segment in User Units Acceleration or deceleration is calculated automatically based on these two parameters This technique allows complicated moves to be created that consist of many segments Each MDV move starts and ends with a velocity of O Based on this a MDV move must have at least two segments The MDV statement doesn t suspend execution of the main program Each segment is loaded into the Motion Queue immediately If the last segment in the Motion Queue doesn t have a final velocity of O the drive will generate a Motion Queue Empty fault 424 If the S modifier is used in the statement then the velocity acceleration deceleration will be S curved as opposed to be linear MDV lt segment distance gt lt segment final velocity gt S S curve optional modifier specifies S curve acceleration MOVE MOVEP MOVEPR MOVED MDV MOTION SUSPEND MOTION RESUME Statements MDV 5 10 Move 5 user units and accelerate to a velocity o
60. ended OUT2 0 Turn off output 1 to Disengage gripper WAIT TIME 1000 Delay 1 sec to Place part OUT1 0 Retract Pick arm WAIT UNTIL IN_A4 0 Check input to make sure Arm is retracted GOTO PROGRAM START END Lenze PM94P01A 27 When the C argument is added to the standard MOVED and MOVEP statements the generated motion profile is treated like a MDV move With a MDV move the execution of the program is never suspended The generated motion profiles are stored directly to the Motion Queue and are then executed one by one If the MOVED and MOVEP statements don t have the C modifier then the motion profiles generated by these statements go to the motion stack and the program is suspended until each profile has been executed 1 12 Subroutines and Loops Subroutines Often it is necessary to repeat a series of steps in several places in a program Subroutines can be useful in such situations The syntax of a subroutine is simple Subroutines must be placed after the main program after the END statement and must start with the subname label where subname is the name of subroutine and must end with a statement RETURN Note that there can be more than one RETURN statement in a subroutine Subroutines are called using the GOSUB statement Loops SML language supports WHILE ENDWHILE block statement which can be used to create repetition loops Note that IF GOTO statements can also be used to create loops The following
61. ent Start Statements IF IN A2 OUT2 1 MOVED 3 Move Blanes 3 inches ENDIF Statements E z s821 IF ELSE Structure The IF ELSE statement is used to execute a statement or a block of statements one time if a condition is true and a different statement or block of statements if condition is false The simplified syntax for the IF ELSE statement is IF lt condition gt statement s ELSE statement s ENDIF The following flowchart and code segment illustrate the use of the IF ELSE instruction statements sam IF IN A2 OUT2 1 a MOVED 3 I No Set Output 2 ON Move Distance 3 inches ELSE OUT 2 0 Set Output 2 OFF Move Distance 5 MOVED 5 ices ENDIF gt Statements WAIT Statement The WAIT statement is used to suspend program execution until or while a condition is true The simplified syntax for this statement is s822 WAIT UNTIL lt condition gt WAIT WHILE lt condition gt WAIT TIME lt time gt WAIT MOTION COMPLETE 37 Lenze PM94P01A GOTO Label The GOTO statement can be used to transfer program execution to a new point marked by a label This statement is often used as the action of an IF statement The destination label may be above or below the GOTO statement in the application program Labels may be any alphanumeric string 64 characters in length beginning with a letter and followed by a colon GOTO T
62. estInputs Statements TestInputs Statements IF IN A1 GOTO TestInputs Program Structure Instruction Summary The following table contains a summary of instructions that relate to program branching Name Description O O GOTO Call a subroutine DO UNTIL Do once and keep doing until conditions becomes true 2 13 Scanned Event Statements A Scanned Event is a small program that runs independently of the main program SCANNED EVENTS are very useful when it is necessary to trigger an action handle 1 0 while the motor is in motion When setting up Events the first step is to define both the action that will trigger the event as well as the sequence of statements to be executed once the event has been triggered Events are scanned every 256uS Before an Event can be scanned however it must first be enabled Events can be enabled or disabled from the user program from another event or from itself see explanations below Once the Event is defined and enabled the Event will be constantly scanned until the trigger condition is met this scan rate is independent of the main programs timing Once the trigger condition is met the Event statements will be executed simultaneously with the user program Scanned events are used to record events and perform actions independent of the main body of the program For example if you want output 3 to come ON when the position is greater then 4 inches or if you need to turn an output 4 ON whe
63. et processed because motion is suspended MOTION RESUME Like the above statements this command will never get executed and the program will be LOCKED UP You can only unlock this situation by a reset or by the execution the MOTION RESUME command from a Host Interface MOTION SUSPEND Performing any MOVEx commands without C modifier will lock up the user program You will be able to unlock it only by performing Reset or Host Interface command Motion Resume MOVE MOVEP MOVEDR MOVED MOVEPR MDV MOTION RESUME statements MOTION SUSPEND Motion will be suspended after current motion command is finished statements MOTION RESUME Resume Statement Purpose Statement resumes motion previously suspended by MOTION SUSPEND If motion was not previously suspended this has no effect on operation Syntax MOTION RESUME See Also MOVE MOVEP MOVEDR MOVED MOVEPR MDV MOTION RESUME Example statements MOTION RESUME Motion is resumed from current command in motion Queue if any statements 60 PM94P01A Lenze ON FAULT ENDFAULT Resume Statement Purpose This statement starts the Fault Handler section of the User Program The Fault Handler is a piece of code which is executed when a fault occurs in the drive The Fault Handler program must begin with the ON FAULT statement and end with the ENDFAULT statement If a Fault Handler routine is not defined then the User Program wi
64. example illustrates calling subroutines as well as how to implement looping by utilizing WHILE ENDWHILE statements DOI eee Initialize and Set Variables xxxxxkkkkkkkkkkk UNITS 1 ACCEL 15 DECEL 15 MAXV 100 APOS 0 DEFINE LOOPCOUNT V1 DEFINE LOOPS 10 DEFINE DIST V2 DEFINE REPETITIONS V3 REPETITIONS 0 PRK KK RKK K kk kkk kk kkk kk kkk k k kkk k k k Main Program kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkXk PROGRAM START ENABLE MAINLOOP LOOPCOUNT LOOPS Set up the loopcount to loop 10 times DIST 10 Set distance to 10 WHILE LOOPCOUNT Loop while loopcount is greater than zero DIST DIST 2 decrease dist by 1 2 GOSUB MDS Call to subroutine WAIT TIME 100 Delay executes after returned from the subroutine LOOPCOUNT LOOPCOUNT 1 decrement loop counter ENDWHILE REPETITIONS REPETITIONS 1 outer loop IF REPETITIONS lt 5 GOTO MAINLOOP ENDIF END 1 kkk PRK KKK K RAR kkk kkk kk kkk k kk kkk k Sub Routines k xk xkkkkxkkkkkkkkkkkkkkkkk MDS V4 dist 3 MDV v4 10 MDV v4 10 MDV V4 0 RETURN 28 PM94P01A Lenze 2 Programming 2 1 Introduction One of the most important aspects of programming is developing a structure for the program Before you begin to write a program you should develop a plan for that program What tasks must be performed In what order do they need to be performed What things can be done to make the program easy to understand and to be maintained by others Are there an
65. f 10 MDV 10 10 Move 10 user units and maintain a velocity of 10 MDV 10 5 Move 10 user units and decelerate to velocity of 5 MDV 5 0 Move 5 user units and decelerate to velocity 0 The last MDV must have a final velocity of 0 Statements Lenze PM94P01A 59 MOTION SUSPEND Suspend Statement Purpose Syntax Remarks See Also Example This statement is used to temporarily suspend motion without flashing the Motion Queues contents If this statement is executed while a motion profile is being processed then the motion will not be suspended until after the completion of the move If executing a series of MDV segment moves motion will not be suspended until after the all MDV segment have been processed If the Motion Queue is empty then any subsequent motion statement will be loaded into the queue and will remain there until the Motion Resume statement is executed Any motion statements without the C modifier except MDV statements will lock up the User Program To illustrate this program lock up reference the following program Program locked up after MOVE statement executed statements MOTION SUSPEND Motion is put on hold or suspended MOVE 20 Motion profile is loaded into the Motion Queue and the program is suspended until the move is completed statements These statements never get executed because the drive is waiting for completion of the above move which will never g
66. f the program To SETUP an Event the EVENT command must be entered This is followed by the Event Name SPRAY_GUNS_ON and the triggering mechanism APOS gt 25 The next step is to enter in the statements or code This is the sequence of programming events you wish to occur once the event is triggered In our case we will turn output 3 on OUT3 1 To end the Event setup the ENDEVENT command must be entered 20 PM94P01A Lenze Events can be activated Turned On and deactivated Turned Off throughout the program To turn ON an Event the EVENT command is entered followed by the Event Name SPRAY_GUNS_ ON This is trailed by the desired state of the Event ON or OFF RE k k k k kk k k k RR RARE RE RR RARE KEKE RR RARE RE RA kkk kkk kkk RARA kkk kkk k RRA EVENT SPRAY GUNS_ON ON po kk k k k kk k k RRE ERK KKK RE k RARE RR KER RRE RRE kkk kkk kkk kk kkk kk kkk RARA k k kk k To learn more about Scanned Events refer to Section 2 13 Two Scanned Events have been added to the Pick and Place program shown below These Events will be used to trigger a spray gun on and off The Event will trigger after the part has been picked up and is passing in front of the spray guns POS 25 Once the part is in position output 3 is turn on activating the spray guns When the part has passed by the spray guns POS 75 output 3 is turned off deactivating the spray guns pikk kkk kkk kkk kkk kkk
67. he toolbar The drive will start to execute the User Program The motor will spin 10 revolutions in the CCW direction and then 10 revolutions in the CW direction After the all the code has been executed the program will stop and the drive will stay enabled I To Restart the program select the Restart icon from the toolbar This will disable the drive and reset the program to execute from the start Note that the program does not run itself automatically To run the program again either select the Run icon from the toolbar or select Run from the Indexer pull down menu Program Layout When developing a program it is important to structure the program It is recommended that the program be divided up into the following 7 sections Header The header defines the title of the program who wrote the program and description of what the program does It may also include a date and rev number I O List The I O list defines what the inputs and outputs of the drive are being use for For example input A1 might be used as a Start Switch Init Set Var Initialize and Set Variables defines the drives settings and system variables For example here is where acceleration deceleration and max speed are set Events An Event is a small program that runs independently of the main program This section is used to define the Event Main Pgm The Main Program is the area where the process of the drive is defined Sub Routines Th
68. hese breakpoints are marked by red dots and stop the drive from executing the program but do not disable the drive and the position variables Once the program has stopped the user can continue to run the program step through the program or restart the program Stop program execution Select Indexer from the pull down menu Select Stop from the drop down menu The program will stop after completing the current statement You can resume the program by selecting Run Please note that the STOP button doesn t stop or disable the motion it only stops the execution of the program code Lenze PM94P01A 7 Restart Program execution Select Indexer from the pull down menu Select Restart from the drop down menu The program will be reset and the drive will be disabled All the position variables will no longer be valid Studio tool suite Toolbar Options When developing a User program the MotionView Studio Toolbar becomes available The toolbar supplies shortcuts to most of the options found in the Indexer Menu Option Tab The toolbar is only available when you are in the programming area Parameter View Window These options are used to load compile save and debug the program Compile FEL TODT He EL Display Watch Window Compile amp Load Remove Breakpoint Run Set Breakpoint Reset Program Single Step Step Into Stop Disable Single Step Step Over 5805 MotionView Studio toolbar Icons 1 5 Prog
69. ile and send to drive from the drop down menu To check syntax errors without loading the program to drive select Compile from the Indexer menu If the compiler finds any syntax error compilation stops and program will not be loaded to drive s memory Errors are reported in bottom portion of the screen in Message Window Save User program from MotionView to PC Select Indexer from the pull down menu Select Export program to file from the drop down menu The program will default to saving the program in the MotoinView User Data file Run User program in drive Select Indexer from the pull down menu Select Run from the drop down menu If the program is already running then you might need to Restart or Stop the program first Execute Program Step through the User program Select Indexer from the pull down menu Select Step in Step over from the drop down menu The 940 will execute the program one step at a time The current program statement will be highlighted If the program is running it will have to be either stopped or restarted Set Breakpoint s in the program Select the point in the program where you would like the program to stop Select Indexer from the pull down menu Select Toggle breakpoint from the drop down menu A convenient way to debug a User program is to insert breakpoints at critical junctions throughout the program T
70. is is the area where any and all sub routines should reside These routines will be called out from the Main Program with a GO SUB command Fault Handler This is the area where the Fault Handler code resides If a Fault handler is utilized this code will be executed when the drive generates a fault The following is an example of a Pick and Place program divided up into the above segments kkkxkkxkkkkkkkkkkkkkkkkkkkkkkkk k HEADER kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkXk Title Pick and Place example program Author Lenze AC Technology Description This is a sample program showing a simple sequence that i picks up a part moves to a set position and drops the part PRK KKK K K K kkk kkk kkk kk kkk k k k k k I O List kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxk x Input A1 not used Input A2 not used F Input A3 Enable Input Input A4 not used Input Bl not used A Input B2 not used Input B3 not used Input B4 not used Input C1 not used E Input C2 not used A Input C3 not used A Input C4 not used Output 1 Pick Arm i Output 2 Gripper i Output 3 not used E Output 4 not used PRR RRR KER KEK KEREEKEERKERK Initialize and Set Variables x kkkkkkkkkkkkkkkkkkk UNITS 1 ACCEL 75 DECEL 75 MAXV 10 Vl V2 10 PM94P01A Lenze Ekk kkk kkk kkk k k kkk k k k k k Events xx xx xk xk xkxkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Set Events handling here jekk KK kkk kkk k
71. it Node Tools View Help MotionView Studio toolbar et 2 2 l lslale x sle al aslo eja Code line to be executed next Motor Title G Parameters Author Michael Bailey P Description Communication 5 8 10 amp Digital 10 Analog IO Limits Ga Velocity limits Position limits G Compensation I Indexer program Tools B Oscilloscope pe EREA amp Run panels WATLUSTE IN G Faults nados 7 Documents motion suspend User s program area E5940 240V 8A 1 1 RI Pose HEADER na 4 rita Driv ES940 240V 8A 1 untitled2 successufully connected Message Area Parameter s tree area 4 BD For Help press F1 Ln 5 Col 1 UPPP over RS 48 Ready S803 Motionview Studio Screen layout MotionView Studio is part of the MotionView universal program and provides a tool suite used to enter compile load and debug the user program To view and develop the user program the Indexer Program file must be selected from the Parameter Tree Window Once this file is selected the User program will be displayed in the Parameter View Window and the Studio s tool set will become available This will allow the user to edit compile and debug the User Program The displayed Program is the current program stored in the drive When Motion View starts it always loads the current program text from the 940 s memory This action is alw
72. its current position For example MOVED 10 will cause the motor to index 10 user units forwarded from it current location Lenze 24 PM94P01A MOVEP and MOVED statements generate what is called a trapezoidal point to point motion profile A Trapezoidal move is when the motor accelerates using the current acceleration setting ACCEL to a default top speed MAXV it then maintains that speed for a period of time before decelerating to the end position using the deceleration setting DECEL If the distance to be moved is fairly small a triangular move profile will be used A triangular move is a move that starts to accelerate toward the Max Velocity setting but has to decelerate before ever achieving the max velocity in order to reach the desired end point Trapezoidal Move Profile Current accel value Top Velocity Velocity Triangular Move Profile Time S815 Segment moves MOVED and MOVEP commands are simple and useful but if the required move profile is more complex than a simple trapezoid move then a MDV or segment move can be used The profile shown below is divided up into 8 segments or 8 MDV moves A MDV move Move Distance Velocity has two arguments The first argument is the distance moved in that segment This distance is referenced from the motors current position and is in User Units The second argument is the desired target velocity for the end of the segment move That is the velocity the motor will be at once the moto
73. ity for motion profile UU S In position limit UU Velocity reference for Profiled velocity UU S 186 VAR UNITS F Y RW Userunits 188 VAR PHCUR F N R Phasecurent JA 190 VAR APOS PULSES W N AW Actual position in encoder pulses EC 191 VAR POSERROR PULSES W N fR Posilonenorinencaderpuses EG 192 VAR CURRENT VEL A A ET dn PES 193 VAR CURRENT ACCEL PPSS F N A Curent acceleration demanded value value PPSS Input de bounce m in mS a re Input de bounce time in mS z Input de bounce time in mS E Input de bounce time in mS R gt Input de bounce time in mS Input de bounce time in mS 200 VAR IN EBOUNC W Y R W Input de bounce time in mS mS DE Range 0 1000 Input de bounce time in mS 202 VAR IN EBOUNC W Y R W Input de bounce time in mS mS DE Range 0 1000 203 VAR_IN EBOUNCE W Y R W Input de bounce time in mS mS DE T Range 0 1000 Input de bounce time in mS Input de bounce time in mS Output function index 207 Output function index 0 var oor2 renos w v nm ouput funtion index 209 VAR OUT3 FUNCTION W Y RAW Outputfunctionindex Current hall code Bit O Hall 1 210 VAR HALLCODE Bit 1 Hall 2 Bit 2 Hall 3 VAR ENCODER WIN OR Primary encoder current value N o O N 00 72 PM94P01A Lenze Index Name Format EM Access Description units 212 VAR RPOS PULSES W N R Registr
74. k kkk k k k k k Main Program kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxkx k PROGRAM_START ENABLE MOVED 10 Move to Pick position OUTI 1 Turn on output 1 on to extend Pick arm WAIT TIME 500 Delay 1 2 sec to extend arm OUT2 1 Turn on output 2 to Engage gripper WAIT TIME 500 Delay 1 2 sec to Pick part OUT1 0 Turn off output 1 to Retract Pick arm MOVED 10 Move to Place position OUT1 1 Turn on output 1 on to extend Pick arm WAIT TIME 500 Delay 1 2 sec to extend arm OUT2 0 Turn off output 1 to Disengage gripper WAIT TIME 500 Delay 1 2 sec to Place part OUT1 0 Retract Pick arm GOTO PROGRAM_START END PRE KR kkk kkk kkk kkk kkk k kk k Sub Routines kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkk Enter Sub Routine code here Ekk kkk kkk kkk k k kkk k k k k k Fault Handler Routine RAXXKKKKKKKKKKKKKKKkKKk Enter Fault Handler code here ON FAULT ENDFAULT Saving Configuration File to PC The Configuration File consists of all the parameter setting for the drive as well as the User Program Once you are done setting up the drives parameters and have written your User Program you can save these setting to your computer To save the settings select Save configuration As from the Node pull down menu Then simply assign your program a name Basic Motion and click Save The configuration file has a dcf extension and will default to save the file to the User Data file in MotionView Loading C
75. le Statements HALT Lenze PM94P01A 53 JUMP Jump to label from Event handler Statement Purpose This is a special purpose statement to be used only in the Event Handler code When the EVENT is triggered and this statement is processed execution of the user s program is transferred to the lt label gt argument called out in the JUMP statement This statement is particularly useful when there is a need for program s flow to change based on some event s Transfer program execution to the instruction following the label Syntax JUMP lt label gt lt label gt is any valid program label Remarks Can be used in EVENT handler only See Also EVENT Example Statements EVENT ExternalFault INPUT IN_A3 activate Event when IN_A3 goes high JUMP ExecuteStop redirect program execution to lt ExeceuteStop gt ENDEVENT statements StartMotion EVENT ExternalFault ON ENABLE MOVED 20 MOVED 100 statements END ExecuteStop STOP MOTION Motion stopped here DISABLE drive disabled GOTO StartMotion 54 PM94P01A Lenze ICONTROL ON OFF Enables interface control Statement Purpose Enables Disables interface control Effects flag 427 in DSTATUS register F ICONTROLOFF All interface motion commands and commands changing any outputs will be disabled See Host interface commands manual for details This command is useful when the program is processing critical states like limit switches for example and can t be
76. lete list of variables 0 2 0 0 0 ccna 67 Lenze PM94P01A Safety Information All safety information given in these Operating Instruction have the same layout Signal Word Characterizes the severity of the danger Note describes the danger and informs on how to proceed Signal Words Warning of hazardous DANGER Warns of impending danger electrical voltage Consequences if disregarded Death or severe injuries Warning of a general WARNING Warns of potential very hazardous situations danger Consequences if disregarded Death or severe injuries to equipment Consequences if disregarded Damage to the controller drive or its environment Information Note Designates a general useful note If you observe it handling the controller drive system is made easier Icon Warning of damage STOP Warns of potential damage to material and equipment 2 PM94P01A Lenze 1 Getting Started 1 1 Introduction Definitions Model 940 PositionServo The Model 940 is a Programmable Digital Drive Motion Controller which can be configured as a stand alone Programmable Motion Controller or as a high performance Torque and Velocity Drive for Centralized Control Systems MotionView MotionView is a universal Communication and Configuration Software utilized by the 94 and 940 drives lt has an automatic self configuration mechanism that recognizes what drive it is connected to an
77. ll be terminated anytime the drive detects a fault Subsequently if a Fault Handler is defined and a fault is detected the drive will be disabled all scanned events we be disabled and the Fault Handler routine will be executed The RESUME and RESET statements can be used to redirect the program execution from the Fault Handler back to the main program If these statements are not utilized then the program will terminate once the ENDFAULT statement is executed The following statements can t be used in fault handler MOVE MOVED MOVEP MOVEDR MOVEPR MDV MOTION SUSPEND MOTION RESUME GOTO GOSUB JUMP ENABLE GEAR ON OFF and VELOCITY ON OFF Syntax ON FAULT statements ENDFAULT See Also RESUME RESET Example statements User program FaultRecovery Recovery procedure statements END ON FAULT Once fault occurs program is directed here statements Any code to deal with fault RESUME FaultRecovery Execution of RESUME ends Fault Handler and directs execution back to User Program If RESUME is omitted the program will terminate here ENDFAULT Fault routine must end with a ENDFAULT statement REGISTRATION ON Registration On Statement Purpose This statement arms the registration input input IN_C3 When the registration input is activated the Flag Variable F_REGISTRATION is set and the current position is captured and stored to the RPOS System Variable Both of these variables are available to the Use
78. low MOVE 1 MOVE 2 Velocity Velocity Velocity 20 max velocity lt 20 Move1 4 inches Time Move2 2 inches Time Trapezoidal moves MOVE 3 MOVE 4 Velocity Velocity Velocity 20 max velocity lt 20 Move3 4 inches Time Move4 2 inches S823 ACCEL 200 DECEL 200 MAXV 20 MOVED 4 Move 1 MOVED 2 Move 2 MOVED 4 S Move 3 MOVED 2 S Move 4 All four of the moves shown above have the same Acceleration Deceleration and Max Velocity values Moves 1 and 3 have a larger value for the move distance than Moves 2 and 4 have In Moves 1 and 3 the distance is long enough to allow the motor to accelerate to the profiled max velocity and maintain that velocity before decelerating down to a stop In Moves 2 and 4 the distance is so small that while the motor is accelerating towards the profiled Max Velocity it has to Decelerate to a stop before it can ever obtain the profiled Max Velocity Incremental MOVED motion Incremental motion is defined as a move of some distance from the current position Move four revolutions from the current position is an example of an incremental move MOVED is the statement used to create incremental moves The simplified syntax is MOVED lt distance gt sign will tell the motor shaft what direction to move Absolute MOVEP move Absolute motion is defined as a motion to some fixed position from the current position The fixed position is defined as a position rel
79. lt belongs to Below is a table that summarizes the possible fault codes Note Codes from 1 to 16 are reserved for DSP subsystem errors Codes above that range are generated by various systems of the 940 Associated flags in status register Description Over current 13 Position error excess 7 Position error excess a ie Motor over temperature switchactvated O O o no fasera Gs i Reseved OOS 46 PM94P01A Lenze 2 16 Limitations and restrictions Communication Interfaces usage restrictions Simultaneous connection to the RS232 and RS485 ports is allowed for the purpose of retransmitting conversion between interfaces Usage of either the RS232 or RS485 simultaneously with Ethernet may lead to unpredictable behavior since the drive will attempt to perform commands from both interfaces concurrently Motion parameters limitation Due to finite precision in the calculations there are some restrictions for acceleration deceleration and max velocity for a move If you receive arithmetic faults during your programs execution it is likely due to these limitations Min Max values are expressed in counts or counts sample where sample position loop sample interval and equal 256uS Parameter mn mar vs Accel Decel 65 2432 counts sample 2 MaxV maximum velocity po 2048 counts sample Max move distance 0 21 Stacks and queues depth limitations Motion Queue 32 Subroutines Stack 32 Number
80. mple IN_A1 is the system flag that reflects the state of digital input1 Since inputs can only be ON or OFF then the value of IN_A1 can only be 0 or 1 Lenze PM94P01A 33 2 10 System Variables storage organization All system variables are located in drive s RAM memory and therefore are volatile However values for some of these system variables are also stored in EPM When a system variable is changed from MotionView its value changed in both RAM and EPM When a system variable is changed from the user s program its value is changed in RAM only Host interface have the function to change the value in both the EPM and in memory so the user has a choice to change variable in RAM and EPM or in RAM only 2 11 System Variables and Flags Summary A full list of system variables is shown in Appendix A Every aspect of the 940 can be controlled by the manipulation of the values stored in the System Variables All System Variables start with a VAR_ followed by the variable name Alternatively System Variables can be addressed as an NUMBER where the number is the variable Index Most frequently used variables also have alternative names shown below Variables can be Read Only R or Read Write R W types System Flags are always Read Only R Flags don t have Index number assigned to them They are the product of a BIT mask applied to a particular system variable by drive and are available to user only from the User s program In
81. native format of the variable W 32 bit integer F float real When setting a variable via an external device the value can be addressed as floating or integer The value will automatically adjusted to fit it s given form The column EPM shows if a variable has a non volatile storage space in the EPM memory The User s Program uses a RAM volatile copy of the variables stored on the EPM The EMP s values are not affected by changing the variables in the User s program Interface functions however could change both volatile and non volatile copy of the variable If the host interface request a change to the EPM non volatile value this change is done both in the User Programs RAM memory as well as in the EPM When the User s program reads a variable it always reads from the RAM volatile copy of the variable Interface functions have choice of reading from the RAM volatile or from the EPM non volatile copy of the variable At power up all RAM copies of the variables are initialized with the EPM values The column Access shows if a variable is R read only W write only or R W read write Writing to a R only variable or reading from a W only variable won t work The column Units shows units of the variable Units unique to this manual that are used for motion are UU user units EC encoder counts S seconds PPS pulses per sample Sample time is 255us servo loop rate PPSS pulses per sample per sample Sample
82. never input 2 and 3 are ON you may use the following scanned event statements EVENT PositionIndicator APOS gt 4 OUT3 1 ENDEVENT EVENT Inputs3and4 IN A4 IN Bl OUT4 1 ENDEVENT Statements Scanned events may also be used with a timer to perform an action on the periodic time basis The program statements contained in the action portion of the scanned event can be any legal program statement except Subroutine calls GOSUB DO WHILE WHILE WAIT GOTO and also motion commands MOVED MOVEP MDV STOP MOTION SUSPEND RESUME EVENT lt name gt INPUT lt inputname gt This scanned event statement is used to execute a block of code every time a specified input lt inputname gt changes its state from low gt hi If it is desired to trigger when changing from hi gt low then an exclamation point symbol should be placed in front of the lt inputname gt IN_A4 38 PM94P01A Lenze EVENT lt name gt TIME lt timeout gt This scanned event statement is used to execute a block of code with a repetition rate specified by the lt timeout gt argument EVENT lt name gt expression This scanned event statement is used to execute a block of code when the expression evaluates to true EVENT lt name gt ON OFF This statement is used to enable disable scanned event Statement can be used within event s block of code Scanned Event Statements Summary The following table contains a summary of instructions that relate to sca
83. ng it equal to 0 Assigning a variable a TRUE state is done by assigning it any value other than 0 In addition to the user variables system variables are also supported System variables are dedicated variables that contain particular values For example APOS variable holds actual position of the motor shaft For more details reference in Section 2 9 Lenze PM94P01A 31 Scope SML variables are available system wide Each of the variables can be read and set from any user program subroutine or Host Language Command at any time There is no provision to protect a variable from change This is referred as global scope Volatility All variables are volatile e they don t maintained their values after power is removed After power up the value of all of the variables are set to 0 Loading or resetting the program doesn t change variables values Flags Resolution and Accuracy As mentioned before you can use any variable as a flag in a logical expression and as a condition in a conditional expression Flags are often used to indicate that some event has occurred logic state of an input has changed or that the program has executed to a particular point Variables with non 0 values are evaluated as TRUE and variables with a 0 values are evaluated as FALSE Variables are stored internally as 4 bytes double word for integer portion and 4 bytes double word for fractional portion This way every varia
84. nned events Refer to Part 3 Language Reference for more detailed information Name gt Description EVENT lt name gt ON OFF enable disable event EVENT lt name gt INPUT lt inputname gt Scanned event on input lt gt EVENT lt name gt TIME lt value gt Periodic event with lt value gt repetition rate EVENT lt name gt expression Scanned event on expression true 2 13 Motion Moves Overview The position command that cause motion to be generated comes from the profile generator or profiler for short The profile generator is used by the MOVE MOVED MOVEP MOVEPR MOVEDR and MDV statements MOVE commands generate motion in a positive or negative direction while or until certain conditions are met For example you can specify a motion while a specific input remains ON or OFF MOVEP generates a move to specific absolute position MOVED generates incremental distance moves i e move some distance from its current position MOVEPR and MOVEDR are registration moves MDV commands are used to generate complicated profiles Profiles generated by these commands are put into the motion stack which is 32 levels deep By default when one of these statements except MDV is executed the execution of the main User Program is suspends until the generated motion is done Motion requests generated by a MDV statement or MOVE statements with the C modifier don t suspend the program They are merely put into the motion stack
85. ntil the statement MOTION RESUME is executed While motion is suspended any motion statement executed by the User Program will be loaded into the motion stack When the MOTION RESUME statement is executed the preloaded motion profiles will be executed in the order that they were loaded Example MOTION SUSPEND MDV 10 2 placed in stack MDV 20 2 placed in stack MDV 2 0 placed in stack MOVED C must use C modifier Otherwise program will hang MOTION RESUME Caution should be taken when using MOVED MOVEP and MOVE statements If any of the MOVE instructions are written without the C modifier the program will hang or lock up The MOTION SUSPEND command effectively halts all execution of motion As the program executes the MDV and MOVED statements those move profiles are loaded into the motion stack If the final MOVED is missing the C modifier then the User Program will wait until that move profile is complete before continuing on But because motion has been suspended the move will never be complete and the program will hang here indefinitely Conditional moves MOVE WHILE UNTIL The statements MOVE UNTIL lt expression gt and MOVE WHILE lt expression gt will both start their motion profiles based on their acceleration and max velocity profile settings The MOVE UNTIL lt expression gt statement will continue the move until the lt expression gt becomes true The
86. nts that is located at the end of the main body of the program It starts with a label which is used by the GOSUB statement to call the subroutine and ends with a RETURN statement The subroutine is executed by using the GOSUB statement in the main body of the program Subroutines can not be called from EVENT or FAULT handlers When a GOSUB statement is executed execution is transferred to the first line of the subroutine The subroutine is then executed until a RETURN statement is met When the RETURN statement is executed the programs execution returns to the program line in the main program following the GOSUB statement Subroutines may have more then one RETURN statement in its body Subroutines may be nested for up to 16 times Only the remaining body of the program may contain a GOSUB statement Refer to Part 3 Language Reference for more detailed information on the GOSUB and RETURN statements The following flowchart and code segment illustrate the use of subroutines Statements GOSUB CalcMotionParam MOVED V1 OUT2 1 statements END Subs usually located after END statement of main program CalcMotionParam Vi V3 2 V4 RETURN 36 PM94P01A Lenze IF Structure The IF statement is used to execute an instruction or block of instructions one time if a condition is true The simplified syntax for IF is IF condition statement s ENDIF The following flowchart and code segment illustrate the use of the IF statem
87. of events 32 Lenze PM94P01A 47 3 Language Reference Format Each statement system variable or operand is documented using the format shown below If there is no information in one of the fields the label is still shown KEYWORD Purpose Syntax Remarks See Also Example KEYWORD Long Name Type Purpose Syntax Arguments Remarks See Also Example Reference ASSIGN Purpose Syntax Input name Remarks See Also Example ASSIGN INPUT IN_B4 AS 48 Long Name Type KEYWORD value Variable KEYWORD Arguments The KEYWORD is the name of the statement system variable or system flag as it would appear in a program The long name is an interpretation of the keyword For example MOVEP is the keyword and Move to Position would be a long name The long name is provided only as an aid to the reader and may not be used in a program This field identifies what type of statement or system variable the keyword is Purpose of the keyword This field shows proper usage of the keyword Optional arguments will be contained within square brackets Arguments will be written in italics The data that is supplied with a statement that modifies the behavior of the statement For example MOVED 100 MOVED is the statement and 100 is the argument The remark field contains additional information about the usage of the statement or system variable This field contains a list of statements or system varia
88. on Remarks For syntax 1 and 2 The Event will occur when the input with the lt name number gt transition from L to H for syntax 1 and from H to L for syntax 2 For syntax 3 The Event will occur when the specified lt period gt period of time has expired This event can be used as periodic event to check for some conditions For syntax 4 The Event will occur when the expression lt expression gt evaluates to be true The expression can be any valid arithmetic or logical expression or combination of the two This event can be used when implementing soft limit switches or when changing the program flow based on some conditions Any variable user and system or constants can be used in the expression See Also ENDEVENT EVENT ON EVENT OFF 50 PM94P01A Lenze Example V0 0 V1 0 EVENT InEvent IN Al VO VO 1 count ENDEVENT EVENT period TIME 1000 1000 ms 1Sec V3 V0 V1 new count old count number of pulses per second VO V1 Save as old count EVENT InEvent ON EVENT period ON program statements END ENDEVENT END of Event handler Statement Purpose Indicates end of the event handler Syntax ENDEVENT Remarks See Also EVENT EVENT ON EVENT OFF Example EVENT InputRise IN B4 VO V 1 ENDEVENT EVENT ON OFF Turn events on or off Statement Purpose turns events created by EVENT handler statement ON or OFF Syntax EVENT lt name gt ON EVENT lt name gt OFF lt name gt Event handler name Remarks See Also EVENT
89. on and technical data in this manual are subject to change without notice AC Tech makes no warranty of any kind with respect to this material including but not limited to the implied warranties of its merchantability and fitness for a given purpose AC Tech assumes no responsibility for any errors that may appear in this manual and makes no commitment to update or to keep current the information in this manual MotionView Positionservo and all related indicia are either registered trademarks or trademarks of Lenze AG in the United States and other countries This document printed in the United States of America Table of Contents 1 Getting Started s cgerise netepi a ase eo e Fiske PE a eee AT A A ee 5 TF REO OUO OM s e AA KARA h el canst ce eh th Be Sok Ss we i de ie Se oy l 5 1 2 Getting started with the PositionServo Model 940 1 2 ce K r navn r annen 6 10 Programming NOW OYES corra panache read ened hemes ARAS LEER EE Tea eee Eke eee dd 7 1 4 MotionView MotionView Studio 2 2 ke enn nee errereen reena rennene 8 15 Programming Bases 3446 seeks rcdakee A RA OSE OLEEEE A NE KREERT n ee Ee 10 1 6 Using advanced debugging features aca io ceded Ke ARS eR LEER Pee eee Peace 17 eZ PUSAN OUPUS or TA AS AA PAR RCRA Te o le ak 17 18 Pl a a E Hie INEA AAA A a O 0 sb a ke 22 1 9 Variables and Define Statoment 1ssassersanadssser ra dame A AA A 0 A EG Ak AN iden 24 1 10 IF ELSE StatemeMS insori O RRA O a AA on a denn 25
90. on may be greater gt less than lt less than or equal lt or greater than or equal to gt The operands of a comparison may be a user variable system variables analog input values or constants IN AL an input is evaluated to true if active Vi user variable True when non 0 false when 0 INPOSITION system flag V1 gt V2 User variable comparison Vi gt APOS comparison user and system variables APOS lt 8 4 compare system variable to constant Statements 1 statements will be performed if condition is TRUE Statements 2 statements will be performed if condition is FALSE Remarks Only Statements 1 or Statements 2 will be performed It is impossible for both to take place See Also WHILE DO Example 56 IF APOS gt 4 VO 2 lf V1 lt gt V2 88 V3 gt V4 V2 9 ENDIF PM94P01A Lenze MOVE Purpose Syntax Remarks See Also Example Move Statement MOVE UNTIL performs motion until condition becomes TRUE MOVE WHILE performs motion while conditions stays TRUE The statement suspends the programs execution until the motion is completed unless the statement is used with C modifier MOVE BACK UNTIL lt condition gt C MOVE BACK WHILE lt condition gt C BACK Changes direction of the move C optional C ontinue modifier allows the program to continue while motion is being performed If a second motion profile is executed while the first profile is still in motion the
91. onfiguration File to the Drive There are times when it is desired to import or export the program source to another drive Other times the program was prepared off line In both of these scenarios the program or configuration file needs to be loaded from the PC to the drive To load the configuration file to the dive select Load configuration file to drive from the Node pull down menu Then simply select the program you want to load and click Open MotionView will first compile the selected program Once compiled the following message box should appear Motionview x i Compilation completed without errors S807 Click OK to dismiss this dialog box MotionView will then load the selected file to the dive and display the following message box when done Motionview o O y Parameters from file C Program Files AC Technology MotionView5S 04 User Data Lab1 dcf successufully loaded to drive ES940 240V 8A 1 B08205100101 5808 Click OK to dismiss the dialog box Lenze PM94P01A 11 Create a new Configuration File There are times when you are not connected to the drive and would like to develop a new application This may be accomplished by loading a virtual dive To create a new configuration file select New configuration file from the Node pull down menu The following message box should appear Select the drive model xi E945020x2x 2 E945050x4x 2 E945080x2x 1 x S809 Select the desired
92. ormat EPM Access Description____ Units msme CE v C Ea EE ano e o e mm Position error Nac Range 1 32767 Position error time time which position error 62 VAR PLIMIT ERRORTIME R W has to remain to set off position error fault Range 0 25 8000 Second encoder Position error Second encoder Position error time time 64 VAR PLIMIT SEERRORTIME nm Which position error has to remain to set off position error fault Range 0 25 8000 Rae inputs states A1 occupies NE outputs states Writing to this variables sets resets digital outputs except outputs which has been assigned special function Output 1 BitO VERSENE Output 2 Bit 1 Output 3 Bit 2 Output 4 Bit 3 Output 5 Bit 4 co Ethernet IP address IP address changes at VAR IP MASK R W E IP NetMask Mask changes at next boot up 32 bit value Ethernet Gateway IP address Address 69 var a VAR IP GaTEAY fyl changes at next boot up 32 bit value Use DHCP 70 VAR IP DHCP R W 0 manual 1 use DHCP service ri ram F Analog Input AINT current value Vjot N R 72 VARAIN2 F N R Analog input AIN2 currentvalue Volt 73 var BUSVOLTAGE F N R Busvotage 1 Mot N Heatsink temperature 74 VAR HTEMP F N Returns 0 for temperatures lt 40C and actual c heat sink temperature for temperatures gt 40 C Enable Accel Decel function for velocity mode 75 VAR ENABLE ACCELDECEL Y R W 10 disable 1 enable Accel value for velocit
93. osition of the motor Even though TPOS will be updated to the value of APOS once the ENABLE statement is executed it is recommended that the motor be re homed See Also ENABLE Example DISABLE DO UNTIL Do Until Statement Purpose DO lt statement s gt UNTIL lt condition gt executes the statement s between the DO and the UNTIL repeatedly until the lt condition gt specified becomes TRUE Syntax DO lt statement s gt UNTIL lt condition gt lt statement s gt any valid statement s lt condition gt The condition to be tested The condition may be a comparison an input being TRUE or FALSE H or L system flag or a variable used as a flag if O false else true Comparisons compare the values of two operands and determine if the condition is TRUE or FALSE A comparison may be greater gt less than lt less than or equal lt or greater than or equal to gt The operands of a comparison may be user variable system variables analog input values or constants IN AL an input is evaluated to true if active V1 User variable True when non 0 false when 0 INPOSITION System flag V1 gt V2 User variable comparison VI gt APOS comparison user and system variables APOS lt 8 4 Compare system variable to constant Remarks Unlike the WHILE statement the loop body will always be executed at least once because the DO UNTIL statement tests the lt condition gt AFTER the loop body is executed See Also WHILE
94. ou are using an IF or IF ELSE statement the construct must end with ENDIF keyword 1 11 Motion Position Feedback gt Kffterm P term Biquad covergence filter Position Current Command Dern gt P limiter I term Limit and unti wind up lterm E I Second encoder j term Current Biquad P term gt gt convergence To Torque amplifier gt limiter filter I term Limit and term unti wind up Mechanical Velocity feedback Velocity window Velocity estimator aoe 4 imary gt M 5813 940 position and velocity regulator s diagram The Position Command as shown in the regulator s diagram above is produced by a Trajectory Generator The Trajectory Generator processes the motion commands produced by the User s program to calculate the position increment or decrement also referred to as the index value for every servo loop This calculated target or theoretical position is then supplied to the Regulator input Lenze PM94P01A 23 The main purpose of the Regulator is to set the motors position to match the target position created by the Trajectory Generator This is done by comparing the input from the Trajectory Generator with the position feedback from the encoder to control
95. parameter is set to Inhibit and Input 3A is on the drive will default to the disabled state and remain there until the ENABLE statement is executed by the User Program Select Parameter from the Parameter Tree Window Select Enable switch function from the Parameter View Window Select Inhibit from the popup menu Faults When a fault condition has been detected by the drive the following events occur Ifa program is executing the user code the code execution is stopped If a fault handler routine was defined its code starts executing See below for details on Fault Handler If there is no fault handler User program is terminated Fault code will be written in DFAULTS register and will be available to user s program See list of fault codes in section 2 15 Dedicated Ready output will turn OFF Any output with assigned special function fault will turn ON Any output with assigned special function ready enabled will turn OFF Enable LED located on drive s front panel will turn OFF Display will display F XX where XX is fault code number Clearing Fault condition can be done one of the following ways 56 Select the Restart icon from the toolbar Executing the RESUME statement at the end of the Fault Handler routine see Fault Handler Example Send Reset command over the Host Interface Cycle power hard reset Fault Handler The Fault
96. per WAIT TIME 1000 Delay 1 sec to Pick part OUT1 0 Turn off output 1 to Retract Pick arm WAIT UNTIL IN A4 0 Make sure Arm retracted IF INDEX 1 In this area we use the If statement to GOTO BIN 1 Check and see what state inuputs Bl B2 amp B3 ENDIF are in IF INDEX INDEX 1 when input B1 is made GOTO BIN 2 INDEX 2 when input B2 is made ENDIF H INDEX 3 when input Bl 8 B2 are made INDEX 4 when input B3 is made INDEX 5 when input Bl amp B3 are made INDEX 6 when input B2 amp B3 are made IF INDEX 7 x INDEX 7 when input B1 B2 amp B3 are made GOTO BIN 7 We can now direct the program to one of seven ENDIF locations based on three inputs BIN 1 Set up for Bin 1 MOVEP 10 Move to Bin 1 location GOTO PLACE PART Jump to place part routine BIN_2 Set up for Bin 2 MOVEP 20 Move to Bin 2 location GOTO PLACE PART Jump to place part routine BIN 7 Set up for Bin 7 MOVEP 70 Move to Bin 7 location GOTO PLACE PART Jump to place part routine PLACE PART OUT1 1 Turn on output 1 on to extend Pick arm WAIT UNTIL IN A4 1 Arm extend OUT2 0 Turn off output 1 to Disengage gripper WAIT TIME 1000 Delay 1 sec to Place part OUT1 0 Retract Pick arm WAIT UNTIL IN A4 0 Arm retracted GOTO PROGRAM START END Note Note Any on the 12 inputs can be assigned as a bit position within INDEX variable Only bits O through 7 can be used with the INDEX variable Bits 8 31 are not used and alwa
97. r Program for decision making purposes The REGISTRATION ON statement will also resets the F_REGISTRATION flag Syntax REGISTRATION ON Flag F_REGISTRATION is reset and registration input is armed See Also MOVEDR MOVEPR Example Moves until input is activated and then come back to the sensor position statements REGISTRATION ON Arm registration input MOVE UNTIL IN C3 Move until input is activated sensor hit MOVEP RPOS Absolute move to the position of the sensor statements Lenze PM94P01A 61 RESUME Statement Purpose Resume This statement redirects the code execution form the Fault Handler routine back to in the User Program The specific line in the User Program to be directed to is called out in the argument lt label gt in the RESUME statement This statement us only allowed in fault handler routine Syntax RESUME lt label gt ON FAULT lt label gt Label address in User Program to be sent to See Also Example statements FaultRecovery statements END ON FAULT Once fault occurs program is directed here statements Any code to deal with fault RESUME FaultRecovery Execution of RESUME ends Fault Handler and directs execution back the FaultRecovery label in the User Program If RESUME is omitted the program will terminate here ENDFAULT Fault routine must end with a ENDFAULT statement RETURN Return from subroutine Statement Purpose This
98. r is in position Velocity RMS 5 10 15 20 25 30 S816 Lenze PM94P01A 25 Below is the User program for the above example Please note that the last segment move must have a 0 for the end velocity MDV 5 0 If this procedure is not followed a F 24 Fault Motion Queue Underflow will be triggered Segment moves LOOP WAIT UNTIL IN A4 Wait until input A4 is off before starting the move MDV 3 56 Move 3 units accelerating to 56 User Units per sec MDV 3 12 Move 3 units decelerating to 12 User Units per sec MDV 4 16 Move 4 units accelerating to 16 User Units per sec MDV 2 57 Move 2 units accelerating to 57 User Units per sec MDV 2 5 57 Move 2 5 units maintaining 57 User Units per sec MDV 3 11 Move 3 units decelerating to 11 User Units per sec MDV 5 20 Move 5 units accelerating to 20 User Units per sec MDV 5 0 Move 5 units decelerating to 0 User Units per sec WAIT UNTIL IN A4 1 Wait until input A4 is on before looping GOTO LOOP END Note e When a MDV move is executed the segment moves are stored to a Motion Queue If the program loops on itself then the queue will become full and a F 23 Fault Motion Queue Overflow will occur e Because the MDV moves utilize a Motion Queue the Step into or Step over debug features will not work Registration Both Absolute and Incremental moves can be used for registration moves The statements associated
99. ramming Basics The User program consists of commands which when executed will not only initiate motion moves but also process the drives I O and make decisions based on drive parameters Before motion can be initiated certain Drive and I O Parameters must be configured To configure these parameters perform the following procedure Parameter setup Select Parameter from Parameter Tree Window and set the following parameters Set the Drive mode to Position Select Drive mode from the Parameter View Window Select Position from the pull down menu Set the Reference mode to Internal Select Reference from the Parameter View Window Select Internal from the pull down menu Set the Enable Switch Function to Inhibit Select Enable Switch Function from the Parameter View Window Select Inhibit from the menu I O Configuration Input A3 is the Inhibit Enable special purpose input See section1 6 for more information Before executing a program input A3 must be activated to enable the drive and take it out of Inhibit mode Note If the drive starts to execute the user program and comes to an Enable command and input 3A is not made then the following fault will occur F_36 Drive Disable Basic Motion Program Select Indexer program from the Parameter Tree The Parameter View Window will display the current User Program stored in the 940 drive Note that if there is
100. rates the structure and operation of the Motion Queue All moves are loaded into the Motion Queue before they are executed If the move is a standard move MOVEP 10 or MOVED 10 then the move will be loaded into the queue and the execution of the User Program will be suspended until the move is completed If the move has the continue argument MOVEP 10 C or MOVED 10 C or if it is a MDV move then the moves will be loaded into Motion Queue and executed simultaneously with the User Program To Motion Profiler Queue Empty flag Queue locations 1 MOVED 20 2 MDV 10 5 User Program 3 MDV 20 5 4 MDV 10 0 Statements i MOVED 20 C l 5 eS MDV 10 5 MDV 20 5 gt Queue INPUT pointer 6 EME MDV 10 0 NA i MOVEP 0 C statements Pointer alwayes positions to next I avalable location Oueue Full flag S825 44 PM94P01A Lenze The Motion Queue can hold 32 motion profiles The System Status Register s indicate the state of Motion Queue If the Flag is set then the queue is full If the possibility of overflow exists the programmer should check this flag before executing any MOVE statements especially in programs where MOVE statements are executed in lopped fashion Attempts to execute a motion statement while the Motion Queue is full will result in fault 423 MDV statements don t have the C option an
101. s suspended 0 motion enabled 1 motion disabled Target position for absolute move Writing 92 VAR MOVEP value executes Move to position as per 3 lt 3 lt MOVEP statement using current values of acceleration deceleration and max velocity Incremental position Writing value lt gt 0 VAR MOVED W N W executes Incremental move as per MOVED statement using current values of acceleration deceleration and max velocity VAR MDV DISTANCE F N w IDistance for MDV move Velocity for MDV move Writing to this variable 95 VAR MDV VELOCITY executes MDV move with Distance value last written to variable 94 Writing value executes Move in positive direction while input true active Value specifies input Writing value executes Move in positive 97 E direction while input false not active Value specifies input Pe fcr JE C C E G Writing value executes Move negative direction while input true active Value specifies input Writing value executes Move negative direction while input false not active Value specifies 68 PM94P01A Lenze Index General purpose user defined variable General purpose user defined variable General purpose user defined variable General purpose user defined variable 104 var V4 F N R W User variable General purpose user defined variable 105 var V5 F N R W User variable General purpose user defined variable 106 VAR V6 F N RW User varia
102. second profile will be loaded into the Motion Stack The Motion Stack is 32 entries deep The programmer should check the F_MQUEUE_FULL system flag to make sure that there is available space in the queue If the queue becomes full or overflows then the drive will generate a fault lt condition gt The condition to be tested The condition may be a comparison an input being TRUE or FALSE H or L system flag or a variable is used as flag if O false else true MOVEP MOVED MOVEPR MOVEDR MDV MOTION SUSPEND MOTION RESUME Statements MOVE UNTIL VO lt 3 MOVE BACK UNTIL VO gt 4 MOVE WHILE VO lt 3 MOVE BACK WHILE VO gt 4 MOVE WHILE V0 lt 3 C MOVED Purpose Syntax See Also Example Move Distance Statement MOVED performs incremental motion distance specified in User Units The commanded distance can range from 231 to 231 This statement will suspend the programs execution until the motion is completed unless the statement is used with the C modifier If the S modifier is used then S curve accel is performed during the move C ontinue MOVED lt distance gt S C The C argument is an optional modifier which allows the program to continue executing while the motion profile is being executed If the drive is in the process of executing a previous motion profile the new motion profile will be loaded into the Motion Stack The Motion Stack is 32 entries deep The programmer should check the
103. t to make sure Arm is retracted MOVED 100 Move to Place position OUT1 Output On Turn on output 1 to extend Pick arm WAIT UNTIL IN A4 1 Check input to make sure Arm is extended OUT2 Output Off Turn off output 1 to Disengage gripper WAIT TIME 1000 Delay 1 sec to Place part OUT1 Output Off Retract Pick arm WAIT UNTIL IN A4 0 Check input to make sure Arm is retracted GOTO PROGRAM START END Sub Routine Any and all Sub Routine code should reside here pk kk kk kk kk kkk kkk kkk kkk kk Sub Routines kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Enter Sub Routine code here Fault Handler Define what the program should do when a fault is detected ARA RARA ARRE RARA RAR RRA RR Fault Handler Routine kx kx kkk kkk kkk kkk kkk kk kk F Enter Fault Handler code here ON FAULT ENDFAULT The header section of the program contains description information program name version number description of process and programmers name The I O List section of the program contains a listing of all the I O on the drive The Initialize and Set Variables section of the program defines the names for the user variables and constants used in the program The Events section contains all scanned events Remember to execute the EVENT lt eventname gt ON statement in main program to enable the events Please note that not all of the SML statements are executable from within the EVENT body For more detail reference EVENT and ENDEVENT
104. th motion START MOVED 100 C start moving max 100 revs WHILE F MCOMPLETE 0 while moving IF IN A2 1 if sensor detected OUT1 1 turn ON output for WAIT TIME 500 500 mS OUT1 0 turn output OFF WAIT TIME 500 wait 500 ms ENDIF ENDWHILE MOVED 100 Return back WAIT TIME 1000 wait time GOTO START and start all over END This program starts a motion of 100 revs While the motor is in motion input A2 is monitored If Input A2 is made during the move then output 1 is turned on for 500mS and then turned off The program will continue to loop in the WHILE statement monitoring input A2 until the move is completed If input 2 remains ON or made during the move then Output 1 will continue to toggle On and Off every 500 mS until the move is complete If input A2 is only made while the motion passes by a sensor wired to the input then output 1 will only stay on for 500 mS By adding the Continue argument C to the MOVE statement the program is able to monitor the input while executing the motion profile Without this modifier the program would be suspended until all motion is done making it impossible to look for the input during the move After the motor has traveled the full distance it then returns back to its initial position and the process repeats This program could be used for a simple paint mechanism which turns ON a paint spray as soon as the parts edge or part guide crosses the sensor s The diagram below illust
105. the VEL system variable Gear mode is the mode when the target position reference is fed from MA MB inputs scaled by the Gear Ratio gear ratio set by statement Gear Ratio The diagram below shows the Reference arrangements for the different modes of operation 37 Reference pi INTERNAL A i 214 189 TPOS Gearing MA MB inputs 479 480 Master to System ratio User s program POSITION REGULATOR Trajectory Generator 0 Torque 435 VELOCITY SCALE Hed H34 DRIVEMODE 769 Dead Band Analog input 41 i INTERNAL m 1 1 S REGULATOR REGULATOR TOMODULATOR INTERNAL a ls IREF 5814 Reference arrangement diagram Point To Point Moves location The 940 supports two types of moves absolute and incremental The statement MOVEP Move to Position is used to make an absolute move When executing an absolute move the motor is instructed to move to a know position The move to this know position is always referenced from the motors home or zero location For example the statement MOVEP 0 will cause the motor to move to its zero or home position regardless of where the motor is located at the beginning of the move The statement MOVED Move Distance makes incremental or relative moves from
106. tion isn t detected then the move is completed If registration is detected the registration position is recorded and a displacement value of 2 MOVEDR 3 2 is added to the recorded registration position to calculate the new end position Statements Statements 58 PM94P01A Lenze MOVEPR Purpose Syntax See Also Example Statements MOVEPR 3 Statements MDV Purpose Syntax See Also Example Registered Distance Move Statement MOVEPR performs absolute position moves specified in User Units If during a move the registration input becomes activated goes high then the end position of the move is altered to a new target position The new position is a generated from the second argument in the MOVEPR statement displacement This statement suspends the execution of the program until the move is completed unless the statement is used with C modifier MOVEPR lt distance gt lt displacement gt C C ontinue The C argument is an optional modifier which allows the program to continue executing the User Program while a motion profile is being processed If a new motion profile is requested while the drive is processing a move the new motion profile will be loaded into the Motion Stack The Motion Stack is 32 entries deep The programmer should check the F MQUEUE FULL system flag to make sure that there is available space in the queue If the queue becomes full or overflows then the driv
107. tion to numbers some of the variables have predefined names and can be accessed by that name from the User s program The following syntax is used when accessing variables by there ordinal number 102 20 set variable 102 to 20 23 100 copy value of variable 100 to variable 23 There are two types of variables in 940 Drive User Variables and System Variables User variables are a fixed set of variables that the programmer can use to store data and perform arithmetic manipulations All variables are of a single type see below Single type variables facility type less variables relieve the programmer of the task of remembering to apply conversion rules between types thus greatly simplifying programming User variables VO V3 User defined variables Variables can hold any numeric value including logic Boolean O FALSE and non 0 TRUE values They can be used in any valid arithmetic or logical expressions NO N31 User defined network variables Variables can hold any numeric value including logic Boolean O FALSE and non 0 TRUE values They can be used in any valid arithmetic or logical expressions Variables can be shared across Ethernet network with use of statements SEND and SENDTO Since SML is a type less language there is no special type for Boolean type variables variables that can be only 0 or 1 Regular variables are used to facilitate Boolean variables Assigning a variable a FALSE state is done by setti
108. units and motor revolutions It simply answers the question How many User units are there in one motor shaft revolution If this statement is omitted from the program the motor will operate with encoder counts as User units Time base Time base is always in seconds i e all time related values are set in USER UNITS SEC Enable Disable Inhibit drive Set Enable switch function to Run The 940 drive can be configured to receive its command reference from an external source and not utilize the internal User Program for its motion moves Essentially acting like a 94 drive When the Enable switch function parameter is set to Run and the Input 3A is made the drive will be Enabled Likewise toggling input 3A to the off state will Disabled the drive Select Parameter from the Parameter Tree Window Select Enable switch function from the Parameter View Window Select Run from the popup menu 12 PM94P01A Lenze Set Enable switch function to Inhibit In the above example the decision on when to enable and disable the drive is determined by an external device PLC or Motion controller The 940 s User Program allows the programmer to take that decision and incorporate it into the drives program By default the drive will execute the User Program whether the drive is enabled or disabled however if a motion statement is executed while the drive is disabled a fault will occur When the Enable switch function
109. ut This analog output is utilized by the dive as System Variable and is labeled AOUT It can be directly accessed written to by the User Program or via a Host Interface Its value can range from 10 to 10 which correlates to 10 volts Note If an analog output is assigned any special function from MotionView writing to AOUT from the User Program will not change its value If an analog output is set to Not assign then it can be controlled by writing to the AOUT variable Lenze PM94PO1A 15 Digital Inputs The 940 has twelve digital inputs These digital inputs are utilized by the drive for decision making in the User Program Some examples would be travel limit switches proximity sensors push buttons and hand shaking with other devices Each input can be assigned an individual debounce times via MotionView From the Parameter Tree select IO Then select the Digital Input folder The debounce times will be displayed in the Parameter View Window Debounce times can be set between 0 and 1000 ms 1ms 0 001 Sec The twelve inputs are separated into three groups A B and C Each group has four inputs and share one common per group Acom Bcom and Ccom The inputs are labeled individually as IN_A1 IN_A4 IN_B1 IN_B4 and IN_C1 IN_C4 In addition to monitoring each input individually the status off all twelve inputs can be represented as one binary number Every input has its
110. y mode Decel value for velocity mode Reset fault configuration 78 VAR FAULT RESET R W 1 on deactivation of Enable Inhibit input A3 0 on activation of Enable Inhibit input A3 Master to system lO Master to system ratio Lenze PM94P01A 67 Formal eru Aces ose oa Secondary encoder to prime encoder ratio 82 VAR S2PRATIO PRIME W y R W Secondary encoder to prime encoder ratio Prime counts range 1 32767 ES VAR EXSTATUS Extended status Lower word copy of DSP status flags Hardware limit switches 0 not used Og VER HES MODE 1 stop and fault 2 fault Analog output function range 0 8 0 Not assigned 1 Phase Current RMS 2 Phase Current Peak Value 3 Motor Velocity 85 VAR AOUT FUNCTION W Y R W 4 Phase Current R 5 Phase Current S 6 Phase Current T 7 Iq current 8 Id current VAR AOUT VELSCALE F y R W Analog output scale for velocity quantities mV Rpm Range 0 1 5 87 VAR AOUT CURSCALE F y R W Analog output scale for current related V A quantities Range 0 1 10 Analog output value Used if VAR 84 is set to Analog input 1 dead band Applied when VAR_AIN1_DEADBAND F Y R W used as current or velocity reference Range 0 50 Analog input 1 offset Applied when used as VAR_AIN1_OFFSET R W current velocity reference Range 1000 1000 Suspend motion Suspends motion produced by trajectory generator Current move will be VAR SUSPEND MOTION R W completed before motion i
111. y procedures that are repetitive Most programs are not a simple linear list of instructions where every instruction is executed in exactly the same order each time the program runs Programs need to do different things in response to external events and operator input SML contains program control structure instructions and scanned event functions that may be used to control the flow of execution in an application program Control structure instructions are the instructions that cause the program to change the path of execution Scanned events are instructions that execute at the same time as the main body of the application program Program Structure Header Enter in program description and title information PRR RERERE RE RARE RR RA RRA k kkk k HEADER kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxk Title Pick and Place example program Author Lenze AC Technology Description This is a sample program showing a simple sequence that picks up a part moves to a set position and drops the part VO List Define what I O will be used Ekk kkk kkk kkk k kk kk k k k kk k k k kk k k k k k k I O List kkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxk Input A1 not used Input A2 not used Input A3 Enable Input Input A4 not used Input B1 not used Input B2 not used Input B3 not used Input B4 not used Input Cl not used Input C2 not used Input C3 not used A Input C4 not used Output 1 Pick Arm i Output 2 Gripper
112. ys set to 0 Unassigned bits in the INDEX variable are set to 0 BITS 8 31 not used A1 o az aa o o jojo 18 PM94P01A Lenze Limit switch input functions Inputs A1 and A2 can be configured as special purpose inputs They are configured from the Digital I O folder in MotionView and can be set to one of following three settings The Not assigned setting designates the inputs as general purpose inputs which can be utilized by the User Program The Fault setting will configure A1 and A2 as Hard Limit Switches When either input is made the drive will be disabled the motor will hard stop and a the drive will generate a fault The Stop and fault setting will configure A1 and A2 as End of Travel limit switches When either input is made the drive will initiate a rapid stop before disabling the drive and generating a Fault The speed of the deceleration will be set by the value stored in the QDECEL System Variable Note il The Stop and Fault function is available in Position mode when the parameter Reference is set to Internal i e when the motion command is derived from the User Program In all other cases the Stop and Fault will function acts the same as the Fault function Hard limit switches action x Stop and fault y Not assigned Fault i Stop and fault el To set this parameter select the IO folder from the Parameter Tree Then select the Digital IO folder From the
Download Pdf Manuals
Related Search
Related Contents
XO Osseo in XO 4 Unit User Guide 防犯性の高い面格子と、合せ複層ガラスとの組合せ+ 大きな相乗効果が Handbuch Der HTC Media Link HD 1 Mb PDF: D05300_18_MiniScale user guide 1 Généralités sur le système SPIP 2 Organisation du site フ ッ 化 物 イ オ ン 選 択 電 極 I Manual del usuario: FreeStyle Optium Neo H Uniden DECT2180 Owner's Manual Copyright © All rights reserved.
Failed to retrieve file