Contents Contents General Information ..................14 Structure of the safety notes ..............14 Liability for defects ..................15 Exclusion of liability................... 15 Copyright....................15 Safety Notes ...................... 16 General information .................. 16 Designated use ..................17 Target group ..................... 17 Programming errors ..................
Page 4
Contents Interrupts....................45 5.5.1 Example..................46 ® Interrupts for MOVIDRIVE A and B............46 5.6.1 Interrupt activation ..............46 5.6.2 Error interrupt................46 5.6.3 Touch probe DI02 interrupt............47 5.6.4 Timer0 interrupt ................. 48 ® Variable interrupts with MOVIDRIVE B........... 49 5.7.1 Calling up the variable interrupt ..........
Page 5
Contents Cam controllers..................84 6.8.1 Standard cam controller............. 85 6.8.2 Expanded cam controller ............89 Position Detection via Binary Inputs............... 96 Types of built-in encoders................. 96 Principle of the position detection ............. 96 ® Position detection with MOVIDRIVE B............ 97 ®...
Page 6
Contents 11.2 Starting the programming tool..............121 11.3 Sequence control system................ 121 11.4 Digital inputs and outputs................ 121 11.5 Values of the DIAG11 variable for the error IPOS ILLOP ....... 122 P9xx IPOS Parameters..................123 12.1 P90x IPOS reference travel ..............123 12.1.1 P900 Reference offset .............
Page 7
Contents 12.6 P95x absolute encoder (SSI) ..............138 12.6.1 P950 Encoder type ..............138 12.6.2 P951 Counting direction ............138 12.6.3 P952 Cycle frequency.............. 139 12.6.4 P953 Position offset..............139 12.6.5 P954 Zero offset ..............139 12.6.6 P955 Encoder scaling.............. 139 12.6.7 P956 CAN encoder baud rate..........
Page 8
Contents 13.20 Overview of the icons................174 Compiler – Programming ................175 14.1 Preprocessor................... 176 14.2 Preprocessor statements ................ 176 14.3 #include....................178 14.4 Include folders..................179 14.5 #define ....................179 14.6 #undef ..................... 180 14.7 #declare ....................181 14.8 SEW standard structures ................ 182 14.9 User-defined structures................
Page 9
Contents Compiler – Functions ..................204 17.1 User-defined functions ................204 17.2 Overview of commands for standard functions ........205 17.2.1 Standard bit functions .............. 205 17.2.2 Standard communication functions.......... 206 17.2.3 Standard positioning functions..........206 17.2.4 Standard program functions ............ 206 17.2.5 Standard setting functions ............
Page 10
Contents 18.3 Querying bits and input terminals ............248 18.3.1 Testing single bits ..............248 18.3.2 Testing several bits..............248 18.4 Querying an edge ................... 249 18.4.1 Example 1................249 18.4.2 Example 2................251 18.5 Value of a number................... 252 18.6 MoviLink command .................
Page 11
Contents Assembler – Programming ................288 22.1 Basics ..................... 288 22.1.1 Program header............... 288 22.1.2 Task 1 / Task 2 / Task 3 ............288 22.1.3 Comments ................288 22.1.4 Program branches ..............288 22.1.5 Subroutine system ..............288 22.1.6 Program loops .................
General Information Structure of the safety notes General Information Structure of the safety notes The safety notes in these operating instructions are designed as follows: Pictogram SIGNAL WORD Type and source of danger. Possible consequence(s) if disregarded. • Measure(s) to prevent the danger. Pictogram Signal word Meaning...
General Information Liability for defects Liability for defects Compliance with this manual and the operating instructions of the units is prerequisite for fault-free operation and fulfillment of any right to claim under warranty. You should therefore read the manual and operating instructions of the units before you start work- ing with the software and units.
Safety Notes General information Safety Notes The following basic safety notes must be read carefully to prevent injury to persons and damage to property. The operator must ensure that the basic safety notes are read and observed. Ensure that persons responsible for the system and its operation as well as persons who work independently on the units have read through the manual carefully and understood it.
Safety Notes Designated use Designated use plus® Use the positioning and sequence control system with IPOS for the following units from SEW-EURODRIVE GmbH & Co KG: ® • MOVIDRIVE ® • MOVITRAC • plus® In addition, the following discontinued products support IPOS ®...
System Description Introduction System Description Introduction plus® The basic functions and options of IPOS units ensure that the program is no longer only an open-loop speed controller. ® In fact, the positioning and sequence control system integrated in MOVIDRIVE often take a great deal of the load off the machine controller (PLC), or maybe even re- place it.
System Description ® IPOSplus – features 3.1.2 Creating programs plus® You can create IPOS programs using either the Assembler or the Compiler. Both ® programming tools are included in the MOVITOOLS MotionStudio software package. INFORMATION Application modules solve typical drive tasks without the user having to create a pro- gram.
Page 20
System Description ® IPOSplus – features • Absolute encoder processing. plus® • 1024 32-bit variables are available in the IPOS program (see Technical data (page 25)). plus® • With IPOS , all inverter parameters can be read and written via communication commands.
Page 21
System Description ® IPOSplus – features • Programming in the Compiler also offers: – Program creation in a high-level language – Symbolic variable names – Possibility of creating program modules that can be used again in other projects – Clear, modular and structured programming –...
System Description ® Controlling IPOSplus units plus® Controlling IPOS units plus® IPOS units can be controlled as follows: • Control via input terminals on the unit plus® • IPOS control word on "System variable" H484 CTRL. WORD • RS-485 interface •...
System Description Technology options / application modules 3.4.2 Application modules An application module is a protected user program designed by SEW that can be loaded into the inverter. A comprehensive package of coordinated functions, easy-to-use input boxes and finely- tuned user guidance make startup easier to handle. The user cannot adjust the plus®...
Page 24
System Description Technology options / application modules Overview of application modules Flying saw 473369867 Internal Synchronous Operation ISYNC ® (only MOVIDRIVE B and MCH) 473374219 Rotatory positioning 473378571 The intelligent application modules in the technology option offer a new level of function- ality.
System Description Technical data Technical data ® 3.5.1 MOVIDRIVE plus® Encoder resolution: IPOS always operates with 4096 increments/motor revolution X15, motor encoder (Pre-requisite: Encoder resolution of 128, 512, 1024 or 2048 pulses/motor revolution (any other encoder resolutions are not permitted) or resolver) X14, external encoder X62, absolute encoder (including absolute ®...
System Description Technical data 3.5.3 Encoder resolution: MQx module has no encoder inputs but supports the position detection via binary inputs (counter input). For the technical data of the binary inputs, refer to section "Position detection via binary inputs" (page 96) Maximum program length/program memory: 4 kByte Command processing time:...
System Description Reference documents Reference documents plus® This document describes the IPOS positioning and sequence control integrated in ® MOVIDRIVE The following reference list is an overview of the documents referred to in this documen- tation. You do not have to have read these documents to be able to program with plus®...
IPOS Variables Introduction IPOS Variables Introduction The integrated positioning and sequence control system uses global variables that are used by all the tasks and interrupts. There are no local variables that are only declared either in a task or a function. All variables (page 25) are 32-bit variables treated as signed integers during calcula- tions and comparisons.
IPOS Variables Overview of the system variables Overview of the system variables Some IPOS variables are assigned set functions and are referred to as system variables (page 25). The symbolic names are available in the Compiler when one of the following lines is in- serted at the start of the program: #include <constb.h>...
Page 30
IPOS Variables Overview of the system variables Name Description Compiler / Assembler StatusWord / The status word can be used to query the operating status of the inverter. STAT.WORD Bit function with level "1" Bit function with level "1" 0 No function 13 Imax signal (P442) 1 /Malfunction 14 /Motor utilization 1...
Page 31
IPOS Variables Overview of the system variables Name Description Compiler / Assembler AnaOutpIPOS / Analog outputs of the terminal expansion board type DIO11, only SET. ANA.OUT IP The value of variable H479 is output on an analog output when the corresponding terminal is programmed to "IPOS OUTPUT".
Page 32
IPOS Variables Overview of the system variables Name Description Compiler / Assembler OutputLevel / Signal level of the binary outputs, READ only. OUTPUT LVL IPOS name DIO (+ DIO) DIO + DIP DIO + -field- DIP + field- Fieldbus ® MOVIDRIVE ®...
Page 33
IPOS Variables Overview of the system variables Name Description Compiler / Assembler plus® ControlWord / IPOS control word (unit functions READ and SET). plus® CTRL.WORD The IPOS control word can always be used, irrespective of the operating mode, control signal source and plus®...
Page 34
IPOS Variables Overview of the system variables Name Description Compiler / Assembler WdogTimer / Time for the user watchdog, READ and SET. WD.TIMER The watchdog timer counts down to 0. The WATCHDOG ON (WDON) command activates the timer and determines the cycle time. Value range: 0 ...
Page 35
IPOS Variables Overview of the system variables Name Description Compiler / Assembler SetpPosBus / Setpoint position bus, READ. SP.POS.BUS Contains the setpoint position which is sent via the fieldbus process data. The setpoint position is only accepted if "POSITION LO" and "POSITION HI" are programmed in the PO-data description (parameter group P87_).
Page 36
IPOS Variables Overview of the system variables Furthermore, the following variables are assigned functions or reserved in ® MOVIDRIVE B Name Description Compiler / Assembler Reserved CCount_MotOn Activate C track (zero pulse) counter for motor encoder X15. 0 = Counter disabled/1 = Counter enabled CCount_ExtOn Activate C track (zero pulse) counter for external encoder X14.
Page 37
IPOS Variables Overview of the system variables Name Description Compiler / Assembler OutpLevelB / Signal level of the binary outputs, READ only. OUTPUTLVLB IPOS DIO (+ DIO + DIP DIO + - DIP + Fieldbus ® MOVIDRIVE name DIO) fieldbus fieldbus P873 = sta- ®...
Page 38
IPOS Variables Overview of the system variables Name Description Compiler / Assembler IPOS_Setp / IPOS setpoint, correcting variable of the PID controller when H540 = 1. When H540 = 0 or 2 the setpoint can also be written directly from the user program. IPOS_SETP H524 can be used as a torque setpoint or speed setpoint when P100 Setpoint source = IPOS and P700 Operating mode 1 = xxx&M-control, CFC or SERVO.
Page 39
IPOS Variables Overview of the system variables Name Description Compiler / Assembler PID_SetpMin / PID controller: Minimum output value for correcting variable, H557 and P284 are identical PID.SETMIN -32000 (-32000) <= x <= 32000 (32000); Default: 0 a,min PID_SetpMax / PID controller: Maximum output value for correcting variable, H558 and P285 are identical PID.SETMAX -32000 (-32000) <= x...
Task Management and Interrupts Introduction Task Management and Interrupts Introduction plus® IPOS can process several subprograms at the same time. One subprogram corre- sponds to one task. The following functions can trigger interrupts for task 1: • Timer0 overflow • System error/unit error •...
Page 41
Task Management and Interrupts ® Task management for MOVIDRIVE A and B ® Toolbar for MOVIDRIVE 473926155 [1] = Status of task 1: START = started [2] = Status of task 2: PSTOP = stopped [3] = Lightning icon to start task 1 [4] = STOP icon to stop the entire IPOS processing ®...
Page 42
Task Management and Interrupts ® Task management for MOVIDRIVE A and B The following table gives an overview of the functions and properties of the tasks and interrupts. Task 1 Task 2 Task 3 (only "Task1" inter- Variable ® MOVIDRIVE rupt interrupt (only...
Task Management and Interrupts ® Tasks for MOVIDRIVE ® Tasks for MOVIDRIVE ® In addition to the general section in chapter "Task Management for MOVIDRIVE A and ® B", this section provides specific implementation information for MOVIDRIVE A: The motion sequence with the positioning commands is programmed in task 1. Program the following functions in task 2: •...
Task Management and Interrupts ® Tasks for MOVIDRIVE When you assign the maximum number of additional commands/ms to task 1 and task 2, the following combinations are possible: Task 1 Task 2 P938 Command/ms P939 Command/ms Example: P938 = 2, P939 = 3 => Task 1 processes 3 commands/ms, task 2 processes 5 commands/ms 5.4.2 Task 3...
Task Management and Interrupts Interrupts 5.4.4 Example ® ® MOVIDRIVE B positions a travel drive. A PLC controls MOVIDRIVE via a fieldbus. ® Change the individual parameters directly on MOVIDRIVE using SEW keypads. Proposed solution: Task 1: Programming the motion sequence Task 2: HMI communication with the operator terminal Task 3: Fieldbus communication with the PLC It is important to distribute the additional commands correctly, depending on the appli-...
Task Management and Interrupts ® Interrupts for MOVIDRIVE A and B 5.5.1 Example A WAIT 1000 ms command in task 1 is interrupted after 500 ms. If the processing of task 1 is resumed after 175 ms, the remaining runtime is 325 ms. ®...
Task Management and Interrupts ® Interrupts for MOVIDRIVE A and B Sample fnErrorInterrupt() H2++; while( !(StatusWord & 0b10)) //only leave while-loop when drive is fault-free H1++; main() _SetInterrupt(SI_ERROR, fnErrorInterrupt); while(1) H0++; H0 is incremented as long as the inverter is functioning correctly. If a fault occurs, H2 is increased by one and H1 is incremented until the inverter functions correctly.
Task Management and Interrupts ® Interrupts for MOVIDRIVE A and B 5.6.4 Timer0 interrupt The entire interrupt routine is run through once when the timer has elapsed (=0). After one run-through, an Assembler command from task 1 is processed before the system checks whether the time = 0.
Task Management and Interrupts ® Variable interrupts with MOVIDRIVE ® Variable interrupts with MOVIDRIVE ® ® All interrupts in MOVIDRIVE B units are the same as those used in MOVIDRIVE ® (see section "Task Management for MOVIDRIVE A and B"), plus 4 additional variable interrupts.
Task Management and Interrupts ® Variable interrupts with MOVIDRIVE INFORMATION The data structure of the command is described in the system function (Compiler – functions / Assembler – commands). The behavior of the interrupt can by adapted dynamically during runtime, by either •...
Page 51
Task Management and Interrupts ® Variable interrupts with MOVIDRIVE Example solved in Required parameter settings the Compiler P620 = IPOS output, P960 = for example SHORT /*=========================================== IPOS source file ============================================*/ #include <constb.h> #include <iob.h> // necessary parameter settings: // P620 = IPOS output, P960 = for example SHORT VARINT hOPENvalve, hCLOSEvalve;...
Page 52
Task Management and Interrupts ® Variable interrupts with MOVIDRIVE // Activate interrupt routine and task3 _SetTask(ST3_START, fnTask3); _SetVarInterrupt( hOPENvalve,fnOPENvalve ); /*------------------------------------- Main program loop --------------------------------------*/ while(1) { //cyclical program section ... } //End while (1) } //End main() Example solved in Necessary parameter settings: the Assembler P620 = IPOS output, P960 = for example SHORT...
Position Detection and Positioning Encoder evaluation Position Detection and Positioning Encoder evaluation ® MOVIDRIVE offers various options for positioning: • external encoders • Motor encoder (incremental encoder/resolver) ® • Hiperface encoder (absolute encoder) • SSI absolute encoder The values are provided in system variables for processing. The connections for the motor encoder (X15) and external encoder (X14) are in the con- trol electronics MxV..., MxS...
Position Detection and Positioning Motor encoder (X15) plus® The position values are always available for IPOS control in the variables H509 to plus® H511. Even if positioning was performed without IPOS , impulse encoders con- plus® nected to X14 and X15 can be recorded and further processed in the IPOS pro- gram.
Page 55
Position Detection and Positioning Encoder combinations Direct position control with absolute encoder and motor encoder plus® • Direct position control in IPOS by means of the SSI absolute encoder connected via DIP11. ® • An incremental encoder / resolver / Hiperface (X15) is always required on the motor for speed feedback.
Page 56
Position Detection and Positioning Encoder combinations Position control with motor encoder, plus® Processing the second encoder in the IPOS program as master encoder plus® • Position control is performed in IPOS using the motor encoder connected to X15. • An encoder is always required on the motor for speed feedback.
Position Detection and Positioning External encoder (X14) External encoder (X14) ® The following encoders can be connected to the MOVIDRIVE A and B drive inverters on X14. To find out which encoder type your unit supports, refer to the system manual or the operating instructions.
Page 58
Position Detection and Positioning External encoder (X14) The following block circuit diagram applies: P941 H511 P942 P943 H510 P944 476710667 = Non-linearized position value of encoder = Actual position value for ramp generator and position controller P941 = Actual position source P942 = Encoder factor numerator P943...
Page 59
Position Detection and Positioning External encoder (X14) INFORMATION The calculation of P210 (P gain hold controller) is optimized for P941 = motor encoder at start up. If you use an external encoder or absolute encoder, the parameter may have to be set to a lower value. The following applies for position detection with an external encoder on X14: •...
Position Detection and Positioning SSI absolute encoder (DIP) SSI absolute encoder (DIP) 6.5.1 Startup ® The drive must be started up in conjunction with the MOVIDRIVE drive inverter as de- ® scribed in the MOVIDRIVE system manual. It must be possible to move the drive using a suitable setpoint and control signal source.
Position Detection and Positioning SSI absolute encoder (DIP) 6.5.3 2. Set direction of rotation of the motor P35_ Move the drive in the positive direction (defined according to application) at low speed. If the actual position P003 or H511 counts upwards, you do not have to change para- ®...
Position Detection and Positioning SSI absolute encoder (DIP) 6.5.7 6. Set Zero offset P954 Zero offset is used for assigning the value you want to a specific position. Enter the pa- rameter as described for P954 in the chapter "IPOS Parameters". 6.5.8 7.
Position Detection and Positioning Referencing Set a maximum of half the value of the calculated preset value. If P955 is ≥ 32, only enter plus® a quarter of the calculated preset value. Start an IPOS program with a positioning operation between two valid points at moderate speed. Reduce or increase parameter P910 "Gain X controller"...
Page 64
Position Detection and Positioning Referencing If a hardware limit switch is reached during reference travel with type 1 or type 2 and the reference point has not yet been found, the drive turns and continues reference travel in the other direction. Once the drive has found the reference point, the following functions are performed: •...
Page 65
Position Detection and Positioning Referencing When deciding whether to reference to the reference cam or zero pulse, note the follow- ing points: • The zero pulse moves when the motor is replaced. • The reference cam could become inaccurate as a result of age, wear or switching hysteresis.
Page 66
Position Detection and Positioning Referencing The following explains the different types of reference travel with different starting points in the drive using travel diagrams. Explanation of the reference travel type diagrams • nRef1 =Reference speed 1 • nRef2 =Reference speed 2 •...
Position Detection and Positioning Referencing 6.6.1 Type 0: Reference travel to zero pulse The reference position is the first zero pulse CCW of the starting position of reference travel. A reference cam is not required. Only P902 Reference speed 2 is used for reference travel.
Position Detection and Positioning Referencing plus® If reference travel is started with the IPOS command Go0, the drive is referenced to the falling edge of the reference cam or to the zero pulse after the falling edge of the reference cam, depending on whether the argument "ZP" or "CAM" is set. nRef1 nRef2 RefOffCAM...
Position Detection and Positioning Referencing 6.6.4 Type 3: CW limit switch The reference position is the first zero pulse to the left of the CW limit switch. The setting "Left end of the CW limit switch" is not important because after reference travel, the drive could be located in the switch hysteresis of the limit switch and the error "29 Limit switch reached"...
Position Detection and Positioning Referencing plus® If the reference travel is started via the IPOS command Go0, you have to set the argument "ZP". nRef1 nRef2 RefOffZP RefZP LHWLS RHWLS RHWL 476760203 6.6.6 Type 5: No reference travel plus® The reference position is the current position. The arguments in the IPOS com- mand Go0"ZP"...
Position Detection and Positioning Referencing If reference travel is started via the positive edge on the "REF.TRAVEL START" input, the drive is either referenced to the falling edge of the reference cam or to the zero pulse after the falling edge of the reference cam, depending on the setting in P904 Refe- rencing to zero pulse.
Position Detection and Positioning Referencing The reference cam must start just before or in line with the CCW hardware limit switch and must project into the limit switch. This ensures that no contact is made with the hard- ware limit switch during reference travel. nRef1 nRef2 RefOffCAM...
Position Detection and Positioning Modulo function Modulo function 6.7.1 Introduction The modulo function can be activated for endless unidirectional rotary applications such as, for example, rotary tables or transport chains. This ensures that all position data in the range 0 to (modulo value – 1 incr.) is displayed. When the modulo value defined by the user (for example, 100 mm or 360°) is exceeded, the modulo position value is reset to zero.
Position Detection and Positioning Modulo function 6.7.2 Operating principle When the modulo function is active, position setpoints are expressed in output units rather than in increments on the motor shaft. Examples of output units (GM = motor encoder / GS = synchronous encoder): •...
Page 75
Position Detection and Positioning Modulo function The actual position H455 is calculated according to the following block diagram: H509 H453 P941 Bit 1 MODULO P961 H455 H510 P962 P963 H456 H511 P961 x P963 476895243 P941 = Actual position source P961 = Modulo numerator P962 = Modulo denominator P963 = Modulo encoder resolution...
Page 76
Position Detection and Positioning Modulo function plus® The diagram below shows the relationship between the current position of the IPOS encoder, for example, the motor encoder H511 and the actual position in the modulo representation. The actual modulo position always moves within the output unit, for ex- ample, from 0°...
Position Detection and Positioning Modulo function 6.7.3 Travel strategies When the modulo function is activated, a number of travel strategies can be used for po- sitioning. The travel strategy for referencing is dependent on this setting. Referencing Reference travel is started in the same way as for referencing without the modulo function.
Page 78
Position Detection and Positioning Modulo function Modulo short route (note: when MOD.TAGPOS = 120° the axis only moves in a coun- terclockwise direction when the drive is positioned at least 1 increment CCW of 300°, since 300° + 180° = 120° and 300° 180° = 120°). Therefore, to position an axis that is at 0°, 1 revolution in a clockwise direction, H454 must be set to 0x 10000.
Page 79
Position Detection and Positioning Modulo function "CCW" Modulo mode "CCW" (P960=CCW) The drive moves from the current actual position H455 MOD.ACTPOS counter-clock- wise to the target position H454 MOD.TAGPOS. Target position that can be represented: H454 MOD.TAGPOS = - k × 360° + 0 ... 360° = - k × 2 + 0 ...
Position Detection and Positioning Modulo function 6.7.4 Project planning Definition of drive unit • Gear unit and the additional gear make up the output unit 360° • Determine the maximum target position in "Number of drive units" • Determine 16 bit or resolution (encoder x modulo numerator) for 360° ↓...
Page 81
Position Detection and Positioning Modulo function In this example, the following numbers of teeth were ascertained: Z1 = 17 / Z2 = 74 / Z3 = 8 / Z4 = 33 / Z5 = 16 / Z6 = 93 477251979 The following calculations must be performed to determine the SHELL parameters modulo numerator, modulo denominator and modulo encoder resolution: ×...
Page 82
Position Detection and Positioning Modulo function Chain conveyor Step 1: Defining the output unit with carrier Now, the previous example shall be extended: A gear wheel is mounted to the gear unit that drives a chain. There are 35 chain links between each carrier.
Position Detection and Positioning Modulo function Step 3: Modulo range of representation and maximum target position Check the modulo range of representation: The product of the modulo encoder resolution and modulo numerator must be < 2 (decimal 2 147 483 648). Modulo numerator x modulo encoder resolution = 1021977 ×...
Position Detection and Positioning Cam controllers • How can positioning be continued once the enable has been revoked? • Set the bits H453.0 (ModuloCtrl variable and TargetReset_Off bit). • How does the axis act when the _AxisStop( AS_PSTOP ) command is activated during positioning? •...
Position Detection and Positioning Cam controllers 6.8.1 Standard cam controller Characteristics of • It is available with encoder for all operating modes. the standard cam • Per declaration and request of a data structure, one output with delay compensation controller is set or reset depending on the four position windows (defined by a CCW and CW limit value).
Page 86
Position Detection and Positioning Cam controllers Startup of the cam Compiler: _GetSys(Cam1 ,GS_CAM ); controller initializes the cam controller and generates the status of an output with the data structure as of the variable cam1 Assembler: GETSYS Hxx = CAM initializes the cam controller and generates the status of an output with the data structure as of the variable Hxx Data structure of...
Page 87
Position Detection and Positioning Cam controllers Example A travel drive has a travel range of ten motor revolutions. An output is to be set when the drive is in the first and in the last motor revolution or in a range of +/- 10° around the center of the travel range. A second output is to be set when the drive is in the second revolution.
Page 88
Position Detection and Positioning Cam controllers Example solved in /*============================================= the Compiler IPOS source file ===============================================*/ #include <const.h> #include <io.h> //Declaration GSCAM Cam1, Cam2; //Declaration of cam outputs 1 and 2 /*============================================= Main function (IPOS initial function) ===============================================*/ main() /*------------------------------------- Initialization --------------------------------------*/ °°Cam1.SourceVar = numof(ActPos_Mot);...
Position Detection and Positioning Cam controllers Example solved in (The SET command is not necessary and serves demonstrative purposes only) the Assembler 477809419 6.8.2 Expanded cam controller Characteristics of • Is available as of MDx_A / MCV / MCS / MCFsoftware version .14, MCH as of the expanded cam software version .13 and MDx_B.
Page 90
Position Detection and Positioning Cam controllers • Any changes in the data structure will be adopted every 1 ms. This step changes the limits of a position window during the execution time; these will be considered during the next processing cycle of the cam. This option makes it possible to use other cam areas for the return travel in case of a reversing axis.
Page 91
Position Detection and Positioning Cam controllers SEW standard structure Variable Name Description GSCAM_EXT CamState Bit 31 must always be set, otherwise processing in the firmware stops. • 0x8000 0000 = function inactive, no new cam outputs will be gener- ated, set outputs will be retained and only deleted after a reset or voltage off/on.
Page 92
Position Detection and Positioning Cam controllers Structure CAM_EXT_OUT Variable Name Description DeadTime Delay time compensation for this channel (-500 ms..0..+500 ms) to compensate the delay time of an actuator connected to the inverter. The output is preset, depending on the rate of change of the reference variable value, in such a way that the output is switched in advance by this time interval.
Page 93
Position Detection and Positioning Cam controllers Example A modulo rotary table has two processing stations installed 180° apart from each other. It is driven by a gear unit with a ratio of 1:5. An output is to be set when the drive is in the +/-5°...
Page 94
Position Detection and Positioning Cam controllers Example solved in the Compiler ====================================================================== Program frame for applications with expanded cam function ====================================================================== #include <const.h> #include <io.h> // Variable structure for the cam controller defined externally in *.h #include <camdef.h> CamStructure CamData0; ControlStructure MyCamControl;...
Page 95
Position Detection and Positioning Cam controllers Example solved in the Assembler 477835787 Manual – IPOSplus®...
Position Detection via Binary Inputs Types of built-in encoders Position Detection via Binary Inputs Types of built-in encoders For asynchronous AC motors, SEW-EURODRIVE offers a position detection with a sim- ple incremental encoder (without position control). Those are built-in encoders. The following table illustrates recommended encoders for the respective products: Encoder Unit...
Position Detection via Binary Inputs ® Position detection with MOVIDRIVE ® Position detection with MOVIDRIVE ® For MOVIDRIVE B, SEW-EURODRIVE recommends the EI76 built-in encoder. ® The binary inputs (counter inputs) of the MOVIDRIVE B have the following technical data: Binary inputs Encoder signals (2 tracks) Track A and track B...
Position Detection via Binary Inputs ® Position detection with MOVITRAC INFORMATION ® If MOVIDRIVE B is equipped with an encoder option, it is not possible to evaluate the track signals of the binary inputs (counter inputs). ® • Use the MOVIDRIVE B without encoder option.
Position Detection via Binary Inputs Position detection with MQx Position detection with MQx 7.5.1 Proximity sensor evaluation The MQx modules allow simple positioning based on the NV2 proximity sensor system. The two proximity sensors send 24 pieces of angle information per revolution. These are plus®...
Position Detection via Binary Inputs Position detection with MQx 7.5.3 Position detection with built-in encoder The binary inputs (counter inputs) of the MQx have the following technical data: Binary inputs Encoder signals (2 tracks) Track A and track B Phase position 90°...
Position Detection via Binary Inputs Position detection with MQx 7.5.6 Counter The MQx modules have a counter that can be connected to either DI0 or DI1. The pos- itive edges are counted to a maximum input frequency of 4 kHz. You must change the setting of the corresponding input to "MQX ENCODER IN"...
® IPOSplus and Fieldbus Introduction plus® IPOS and Fieldbus Introduction Cyclical process data and acyclical parameters are exchanged between a PLC and input/output signal stations via fieldbus, SBus or RS-485. For information on the supported communication interfaces, refer to the respective sys- tem manual.
® IPOSplus and Fieldbus Binary inputs and outputs Binary inputs and outputs ® If neither a DIO nor DIP is inserted in MOVIDRIVE , the bits in control word 2 / status plus® word 2 can be addressed in the IPOS program as follows: •...
® IPOSplus and Fieldbus Cyclical process data 8.3.2 Cyclical user-specific process data Users have the option of choosing the description of the cyclical process data them- selves. To do so, assign the parameter setting PO data for the output data or PI data for the input data in the process data configuration.
® IPOSplus and Fieldbus Acyclical communication Assembler SET H320 SET H332 SET H321 :GETSYS H320 = PO-DATA SET H300 = H324 AND H300 & FFFF SET H301 = H323 AND H301 & FFFF ADD H300 + H301 SHL H300 << 16 SET H354 = H300 SET H300...
® IPOSplus and Fieldbus Special features of communication via RS-485 Special features of communication via RS-485 ® ® With MOVIDRIVE and MOVITRAC B, due to the low transmission speed, you should limit the use of the RS-485 interface to acyclical (parameter) communication. Fieldbus control words and fieldbus status words For detailed information regarding the control and status word, refer to section "SEW unit profile"...
® IPOSplus and Synchronized Motion Introduction plus® IPOS and Synchronized Motion Introduction ® ® MOVIDRIVE and MOVITRAC B allow for master-slave operation. ® Further, you can synchronize several MOVIDRIVE units more exactly, for example, for applications with the following functions: •...
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card 9.3.1 Activating and deactivating the free running function The system variable H476 DRS CTRL can be used to set and reset the two program- mable outputs of DRS11. Free running function: DRS11B INØ..5...
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card 9.3.2 Setting the zero pointfor DRS11B plus® The angular offset of DRS11 can be reset using IPOS without an external signal. The H484 CTRL. WORD system variable is used for this process. The process of resetting the angular offset between the master and slave can be mon- itored in the status LED of the DRS card.
Page 110
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card Sample program plus® with IPOS /*================================================================== Compiler IPOS source file ==================================================================*/ #include <const.h> #include <io.h> /*----- Define inputs --------------------------------------*/ #define E_Free running DI10 // Input DI10 #define E_Set zero point DI11 // Input DI11 /*----- Define outputs --------------------------------------*/ #define A_DRS_OUTP0 0 // Output DRS X40:9...
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card 9.3.3 Activating and deactivating the offset function Via the system variable DRS CTRL. H476 you can set/reset the two programmable out- puts of the DRS11. Offset wiring example: DRS11B INØ..5 DCOM...
Page 112
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card plus® Requirement A position offset can be applied using IPOS via a cable connection from terminal X40:10 to X40:2 (Offset1). Command Set the drive to the function "Offset1": Slave drive changes its position in relation to the sequence in master to the value stored in offset1.
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card 9.3.4 Switching between positioning and synchronous operation The "Free running" function makes it possible for the drives to run separately at a con- trolled speed. However, when this function is activated, the drive cannot move to a spec- ified position using position control.
Page 114
® IPOSplus and Synchronized Motion Synchronous operation with a DRS option card /*==================================================================== IPOS source file ====================================================================*/ #include <const.h> #include <io.h> /*----- Define inputs ------------------------------------*/ #define E_Free running DI10 // Input DI10 #define E_Set zero point DI11 // Input DI11 #define E_Switch_Pos_Sync DI12 // Input to switch between // Positioning and synchronous operation...
® IPOSplus and Synchronized Motion Synchronous operation with technology option "Cam" plus® • IPOS variables H360 to H450 are reserved for synchronous operation and should not be used in the application program see section "Overview of System Variables (page 29)". plus®...
® IPOSplus and Synchronized Motion Synchronous operation with technology option "Cam" 9.5.1 Requirements The electronic cam option places the following requirements on the drive system: • Encoder feedback • Operating mode: "CFC" or "Servo" ... & IPOS plus® • IPOS variables H360 to H450 are reserved for synchronous operation and should not be used in the application program (see section 3.2 "Overview of System Variables").
® ® IPOSplus for MOVITRAC B – Characteristics Requirements plus® ® IPOS for MOVITRAC B – Characteristics 10.1 Requirements ® Units from the MOVITRAC B series can be ordered as standard units or as technology ® plus® units. Unlike MOVIDRIVE B, the standard unit must first be enabled for IPOS fore you can start programming.
® ® IPOSplus for MOVITRAC B – Characteristics Functionality 10.2 Functionality ® plus® ® In general, MOVITRAC B IPOS has the same functions as MOVIDRIVE B in VFC operating mode. In addition there are the following restrictions: ® • Restrictions regarding the range of commands with MOVIDRIVE ®...
® IPOSplus for MQx – Characteristics Introduction plus® IPOS for MQx – Characteristics 11.1 Introduction In the same way as for MFx modules, modules of the MQx series allow a cost-effective ® fieldbus interface to MOVIMOT drives. In addition, the MQx modules are equipped with control functions that help you determine how the drive responds to external input via fieldbus and integrated I/Os.
® IPOSplus for MQx – Characteristics Starting the programming tool 11.2 Starting the programming tool You can access the fieldbus interface via the diagnostics and programming interface (under the screw plug on the front) of the MQx modules. • Connect the serial interface of your PC with the programming interface of the MQx. Use the UWS21A.
® IPOSplus for MQx – Characteristics Values of the DIAG11 variable for the error IPOS ILLOP 11.5 Values of the DIAG11 variable for the error IPOS ILLOP An IPOS ILLOP error is generated as a general error message when an error occurs in plus®...
P9xx IPOS Parameters P90x IPOS reference travel P9xx IPOS Parameters DANGER Risk of crushing if the motor starts up unintentionally. Severe or fatal injuries. • Ensure that the motor cannot start unintentionally. plus® • Note that modifying these parameters without knowledge of the IPOS program, which may be active, can cause unexpected movements and place unwanted loads on the mechanical driveline.
P9xx IPOS Parameters P90x IPOS reference travel Reference offset becomes active after reference travel has been completed success- fully. INFORMATION ® In case of a reference travel of a drive system with absolute encoder (HIPERFACE DIP), P905 Hiperface offset X15 (page 126) / P947 Hiperface offset X14 (page 136) or DIP offset P953 Position offset (page 139) will be recalculated and overwritten by the reference travel depending on the actual position source.
Page 125
P9xx IPOS Parameters P90x IPOS reference travel – First search direction is CW. – Reference position = First zero pulse or falling edge to the right of the reference – Machine zero = reference position + reference offset • Type 3: CW limit switch –...
P9xx IPOS Parameters P90x IPOS reference travel 12.1.5 P904 Reference travel to zero pulse Setting range: YES/NO plus® • YES: Reference travel takes place to the zero pulse of the selected IPOS encoder. • NO: Reference travel takes place to the falling edge of the reference cam. 12.1.6 P905 Hiperface offset X15 Setting range: –(2 –...
P9xx IPOS Parameters ® P91x IPOSplus parameters plus® 12.2 P91x IPOS parameters 12.2.1 P910 Gain X controller Setting range: 0,1 – 0,5 – 32 plus® Setting value for the P controller of the position control loop in IPOS . The value from P210 P gain hold controller is adopted here in the default setting.
P9xx IPOS Parameters ® P91x IPOSplus parameters 12.2.5 P916 Ramp type This parameter specifies the type of the positioning ramp. This influences the speed or acceleration characteristics during positioning. INFORMATION The following ramp types are not supported if P702 Motor category is set to "Linear": •...
Page 129
P9xx IPOS Parameters ® P91x IPOSplus parameters Ramp type Positioning characteristics POSITION INTERPOLATION The position specifications sent cyclically by the external controller are 12 BIT interpolated. Position resolution: 1 revolution corresponds to 4096 incre- ments (12 bit). • Position specification using process data: –...
P9xx IPOS Parameters ® P91x IPOSplus parameters 12.2.6 P917 Ramp mode Setting range: MODE 1/MODE 2 This parameter determines the use of P912 Positioning ramp 2 with ramp type set to LINEAR. • P917 = MODE 1: Deceleration for travel to target position (spot braking) takes place with P912 Positioning ramp 2.
P9xx IPOS Parameters P92x IPOS monitoring 12.3 P92x IPOS monitoring 12.3.1 P920/P921 SW limit switch CW/CCW Setting range: –(2 –1) – 0 – 2 –1 The software limit switches let the user limit the range in which travel commands are ac- cepted.
P9xx IPOS Parameters ® P93x IPOSplus special functions plus® 12.4 P93x IPOS special functions 12.4.1 P930 Override Setting range: ON/OFF The override function makes it possible to change the travel speed for positioning oper- plus® ations which is programmed in the IPOS program.
P9xx IPOS Parameters ® P93x IPOSplus special functions 12.4.6 P939 Speed task 2 Setting range: 0 – 9 additional Assembler commands/ms The standard setting for task 2 is 2 Assembler commands/ms. The speed can be in- creased by up to 9 additional Assembler commands/ms with P939. P938 and P939 share the resources for the speed increase;...
P9xx IPOS Parameters ® P94x IPOSplus encoder plus® 12.5 P94x IPOS encoder 12.5.1 P940 IPOS variable edit Setting range: ON/OFF plus® IPOS variables edit with DBG60B keypad only, not in SHELL. plus® IPOS variables can be changed if P940 is set to "ON". 12.5.2 P941 Actual position source Setting range: Motor encoder (X15) / Ext.
P9xx IPOS Parameters ® P94x IPOSplus encoder 12.5.4 P944 Encoder scaling ext. encoder Setting range: x1 / x2 / x4 / x8 / x16 / x32 / x64 Before setting P944, make sure that P942 and P943 are set to "1". The significance of the travel resolution of the motor encoder and external encoder is adapted.
P9xx IPOS Parameters ® P94x IPOSplus encoder 12.5.6 P945 Synchronous encoder counting direction (X14) Setting range: NORMAL/INVERTED Defines the counting direction of the synchronous encoder. The setting must be made so the counting direction of the motor encoder (X15) and the synchronous encoder (X14) match.
P9xx IPOS Parameters ® P94x IPOSplus encoder 12.5.8 P948 Automatic encoder replacement detection Setting range: ON/OFF ® This parameter is only effective with Hiperface encoders. ® • ON: A replaced Hiperface encoder is detected. Reference travel is required before the "IPOS referenced" bit is set. Note the following when operating a linear motor with AL1H motor encoder: If the linear motor was commutated in the dialog "Encoder adjustment"...
P9xx IPOS Parameters P95x absolute encoder (SSI) 12.6 P95x absolute encoder (SSI) ® The DIP parameters are described in detail in the "MOVIDRIVE MDX61B Absolute En- coder Card DIP11B/DEH21B" manual. The DIP11B option cannot be used with ® MOVIDRIVE MDX61B size 0. 12.6.1 P950 Encoder type The absolute encoder connected to the DEH21B/DIP11B option (X62) is selected.
P9xx IPOS Parameters P95x absolute encoder (SSI) 12.6.3 P952 Cycle frequency Setting range: 1 – 200% Defines the cycle frequency at which absolute encoder information is transmitted from the encoder to the inverter. A cycle frequency of 100% corresponds to the nominal fre- quency of the encoder in relation to a 100 m cable length.
P9xx IPOS Parameters ® P96x IPOSplus modulo function Sets the baud rate of the connected CAN encoder. plus® 12.7 P96x IPOS modulo function plus® The IPOS modulo function is used for endless positioning, for example with circular plus® indexing tables or chain conveyors. Refer to the IPOS manual for detailed informa- tion.
P9xx IPOS Parameters P97x IPOS synchronization 12.8 P97x IPOS synchronization 12.8.1 P970 DPRAM synchronization Setting range: ON/OFF ® MOVIDRIVE B allows for synchronized operation with option cards (e.g. DHP11B, DFE24B). ON: Synchronized operation with option card is activated. Important: The inverters may either be synchronized by SBus1, SBus2 or by DPRAM. The inverters must not be synchronized from several interfaces at the same time.
Compiler – Editor Technical features Compiler – Editor 13.1 Technical features plus® plus® • Integrated IPOS positioning and sequence control. IPOS units do not required any additional hardware. • Program creation in a high-level language • Symbolic variable names • Option of writing program modules that can be used again in other projects •...
Compiler – Editor First steps 13.2 First steps This description is intended to help you familiarize yourself with the programming of the plus® IPOS Compiler as quickly as possible. You are given an introduction into the basic functions of the Compiler by means of an example which is created and developed step- by-step from one chapter to the next.
Page 144
Compiler – Editor First steps ® Establishing com- Proceed as follows to establish a communication with MOVITOOLS MotionStudio and munication and scan your network: scanning the net- 1. Set up a communication channel (e.g. "serial") to communicate with your units. work For a detailed description on how to configure a communication channel, refer to the ®...
Compiler – Editor First steps plus® The IPOS programming interface opens: 482065675 [1] Menu bar [2] Toolbar [3] Project window [4] Program window [5] Status bar 13.2.2 Step 2: Creating a new project To create a new project, choose [Project]/[Create new...] from the menu bar. Use the following dialog window to specify the basic project properties: 482580363 The first line contains the name of the project.
Page 146
Compiler – Editor First steps The second line specifies the directory in which the project is to be saved. Choose the directory using the [Browse] button. The directory must already exist. If a subfolder with the name of the project is to be created in the specified path, you must mark the "Create project subfolder"...
Page 147
Compiler – Editor First steps When you click [Save] another window appears. You create the program structure here. Defining the program structure 482809355 In the "main function" group, mark the "Initialization part" check box. Once you have left the dialog box by confirming your entry with [OK], the "Main" function is automatically generated with the initialization part.
Compiler – Editor First steps The "Main" function contains an initialization part and the main program loop. This is a correct program that could be run, but it does not, however, contain any functions. The program window now looks as follows: 482850699 If you make changes to the source text, save the project using [File]/[Save All].
Page 149
Compiler – Editor First steps The program should, therefore, have the following structure: 483418763 "Changed" is displayed in the status bar. This means the program has been changed compared with its status when last saved. Save the program. "Saved" is now displayed in the status bar.
Page 150
Compiler – Editor First steps You can use the insert tool while you are editing the program. Click the right mouse but- ton to open the context menu containing the [Insert Instruction...] menu item. This menu item allows you to call up the insert tool. Calls insert tool 483423627 You can use the insert tool to select various C-constructions, system functions and pre-...
Compiler – Editor First steps plus® 13.2.4 Step 4: Compiling and starting the IPOS program plus® In this chapter, you will compile the program you created in step 3, load it into IPOS and run the program. Compiling the pro- To generate a program in a form that the inverter can understand, the project must be gram compiled.
Page 152
Compiler – Editor First steps Error messages As syntax errors can occur during programming, an error reporting system has been in- plus® during compilation tegrated in the IPOS Compiler. If the program detects an error, it displays the line in which the error occurs and generates a corresponding error message classifying the error.
Page 153
Compiler – Editor First steps Loading the pro- As the next step, the program must be loaded into the inverter. To do so, press the gram into the unit icon or choose [Project]/[Compile and download]. The program is compiled again and loaded into the inverter once it has been compiled successfully.
Compiler – Editor ® Settings for the IPOSplus Compiler plus® 13.3 Settings for the IPOS Compiler You can make a number of settings for the entire Compiler. To do so, choose [Options]/ [Settings]. The following dialog box appears: Editor settings 483719691 In the Editor settings, you can select the colors for the background and the text.
Page 155
Compiler – Editor ® Settings for the IPOSplus Compiler Compiler settings 483721227 You can make settings for the Compiler process on the Compiler tab page. • Generate IPOS program file (*.MDX): An *.MDX file is generated during compilation. The MDX file contains the Assembler code of the program in text form and can be loaded into the inverter via SHELL (Copy unit data) or opened in the Assembler.
Page 156
Compiler – Editor ® Settings for the IPOSplus Compiler Directory settings: 483837963 plus® In the IPOS Compiler, a program can either be created as a project or as an indi- vidual source file. If the program is created as an individual source file, you must make the following set- tings as shown in the window above: In the [List File Output Directory] field, specify the folder in which the list file should be saved if this function has been activated in the Compiler settings.
Compiler – Editor Search function On the [Run] tab, you can set the speed parameters for task 1 and task 2. These settings are described in detail in section "Task Management and Interrupts / Tasks for ® MOVIDRIVE B". 13.4 Search function Choose [Search]/[Search for...] from the menu bar.
Compiler – Editor Creating a new project 13.5 Creating a new project plus® An IPOS program consists of one or more source text modules. Each module is stored in a separate file with the extension *.IPC. Information about the project is stored in a project file with the extension *.ICP.
Compiler – Editor Creating a new project In the next dialog box that appears, give the new source file a name. If you exit the box by selecting [Save], another dialog box opens. This dialog box can be used for defining a basic program structure which is displayed as an empty program template in the Editor window.
Page 160
Compiler – Editor Creating a new project For instance, if a structure with an initialization part and a task 2 is selected, in which task 2 is to have the function name ”Monitoring", the resulting Editor window displays the following program structure: Compiler program: 484392715 INFORMATION...
Compiler – Editor Saving a project You also have the option of adding an existing source file to a project. To do so, click the right mouse button on the Source file root node and select [Add source file to project] from the context menu that appears.
Compiler – Editor Setting up a project management structure 13.7 Setting up a project management structure A project management structure allows you access to all data relating to a project. For example, the following folder structure gives a clear overview: Main project (e.g.
Page 163
Compiler – Editor Setting up a project management structure Example: Customer: Müller Machine: Hoist station ® MOVIDRIVE : hoist axis, fork drive Complete documentation Hoist axis Documentation Source Parameters Measurements Fork drive Documentation Source Parameters Measurements A project management structure such as this permits anyone who has to familiarize themselves with the machine or the program to obtain a rapid overview.
Compiler – Editor Opening a project 13.8 Opening a project If the Compiler is opened, the Editor is opened with the last source text to be processed plus® in the last project that was opened, as long as the IPOS Compiler was exited when the Editor window was open.
Compiler – Editor ® Handling projects with MOVIDRIVE 13.9.2 Loading a project from the inverter Choose [Project]/[Upload...] to load a project stored in the inverter to the PC/laptop. 484532491 You can enter the name of the project folder in a dialog box. Select a target directory via the [Browse] button.
Compiler – Editor Compiling a project 13.10 Compiling a project To generate a program in a form that the inverter can understand, the project must be compiled. If a project consists of several source files, all source files are compiled to an plus®...
Compiler – Editor Compiling and downloading 13.11 Compiling and downloading Two basic steps are required to transfer the program to the inverter. First, the source text must be compiled. Second, the program must be transferred to the inverter. Trigger these two steps by choosing [Project]/[Compile + download]. The basic conditions for compiling are the same in principle as those described in the previous section.
Compiler – Editor Debugger 13.15 Debugger The integrated debugger is a useful tool for working through a program for test purposes or for troubleshooting in individual steps. To use the debugger, the program must be transferred to the inverter. Three different functions are available for debugging. Function Symbol Description...
Compiler – Editor Variable window 13.16 Variable window It is useful to open a Variable window so you can observe the contents of the variables during debugging or normal running of the program. The Variable window is called up by selecting [All Variables] from the [Display] menu in the menu bar.
Page 170
Compiler – Editor Variable window To set up a watch window choose [Display]/[Variable Watch]/[Edit Window...] from the menu bar. The following window is displayed: Selecting variables 485591563 Double click on the variable you want to display, or select a number of variables and press [Add] to assign the required variables to the watch window.
Compiler – Editor Program information The values of the variables can be displayed in different formats. You can select from the following formats: signed decimal, hexadecimal, binary or ASCII. To change from one format to another, first select the required variable by clicking it. Then call up a con- text menu by pressing the right mouse button, and select the required format from there.
Compiler – Editor Entering instructions 13.18 Entering instructions plus® In principle it is possible to enter the entire source text of an IPOS program by typing it in using the keyboard. In this case, use the syntax based on the programming lan- guage C.
Compiler – Editor Comments 13.19 Comments Good use of comments makes it easier to read a program and also makes it possible for someone who does not know the program to become familiar with it quickly. A long comment, which may span several lines, for example, starts with '/*' and ends with '*/'.
Compiler – Editor Overview of the icons 13.20 Overview of the icons Symbol Menu item Description File → new Creates new source file File → open Opens source file File → save Saves source file File → compile Compiles source file File →...
Compiler – Programming Compiler – Programming plus® The source text of a program written with the IPOS Compiler is made up of various parts. These must first be considered individually /******************************************** File name: Program_structure.IPC Date: 04.02.2002 Author: Thomas Ambrus Comment with notes on the program SEW-EURODRIVE Bruchsal Technical Documentation Brief description:...
Compiler – Programming Preprocessor 14.1 Preprocessor plus® The IPOS Compiler is a multi-pass Compiler that processes the source text in sev- eral run-throughs. During the first run-through, the preprocessor processes the state- ments – referred to below as directives – which are intended for it, tests the statements for conditional compiling, deletes comments and finally creates a temporary file for the Compiler.
Compiler – Programming #include In addition to the '#ifndef' statement, there is also the '#ifdef' (ifdefined) statement. This statement does not have to be negated. An if-else construction is also possible. In this case, this means that the part of the statement following the "#else" is processed if the "#ifdef"...
Compiler – Programming Include folders 14.4 Include folders There are various procedures depending on the folder in which the file to be included is located. 1. If the path of the file to be included is set in the Folders tab in the Compiler settings, then the statement is #include <FileName>...
Compiler – Programming #undef Equally, the '#define' directive can be used to assign symbolic names to constant val- ues. As a result, the line '#define MAX_SPEED 1500' makes it possible for "MAX_SPEED" to be written in the source text rather than 1500. This makes it easier to read the source text.
Compiler – Programming #declare Compiler error due to missing definition: 493925131 14.7 #declare plus® This directive allows IPOS variables to be declared symbolically and relative to a base variable. This facilitates the portability of source text modules as far as assigning variable numbers is concerned, because the user only has to change the number of the base variable in order to change all the variable numbers used in the source text.
Compiler – Programming SEW standard structures 14.8 SEW standard structures SEW standard structures provide ready-made structures for commands that are depen- dent on structures. The following table shows a list of the standard structures available for each specific statement. For the corresponding elements, refer to the description of the respective command, see section Standard functions (page 208).
Page 183
Compiler – Programming SEW standard structures The insert tool can be used for support when declaring and initializing standard struc- tures. The cursor must be positioned in the Editor window at the place where the decla- ration for the structure variables is to be inserted. Call up the insert tool by clicking the right mouse button.
Compiler – Programming User-defined structures 14.9 User-defined structures Users can define their own structures in addition to the SEW standard structures. First of all, the structure must be created. This is done in the declaration part of the program. The 'typedef struct' keyword is used for this. This can be explained by taking an example which creates a position table.
Page 185
Compiler – Programming User-defined structures Once you have inserted the structure, a declaration line is added to the Editor window that declares the structure variables of this structure type. This line must still be edited in the Editor. Additional elements can be added within the structure type in the same way.
Compiler – Programming long 14.10 long As an alternative to assigning variables using #define, the key word long can be used to declare an individual variable. In this case, the variable number is assigned by the Com- piler during compilation. The key word long initiates a declaration of one or more global variables.
Compiler – Programming #pragma 14.12 #pragma The #pragma directive can be used to influence the variable range occupied by the key words 'long' and 'initial long'. Syntax: #pragma Directive Parameter1 Parameter2 ... The Compiler supports the following #pragma directives: plus® #pragma list Causes the source text lines to be included in the resulting IPOS program as comments.
Compiler – Programming Explanation of const.h and io.h / constb.h and iob.h 14.13 Explanation of const.h and io.h / constb.h and iob.h The const.h header file defines many useful identifiers. As far as beginners are con- cerned, only the symbolic names of the system variables are of importance initially. The other identifiers are important for expert users who no longer use the insert tool.
Page 189
Compiler – Programming Explanation of const.h and io.h / constb.h and iob.h The io.h header file defines macros that make it easier to query terminal levels. The fol- lowing example illustrates this point. if( DI00 ) H1 = 1; // execute command block, if terminal DI00 has NOT level 0 else H1 = 0;...
Compiler – Programming Identifiers 14.14 Identifiers Although we have already used identifiers several times, this section provides additional information about them. An identifier is understood to be the name that can be adopted by a Macro identifier (Define section), a symbolic variable name or a function name. Only letters, numbers and an underscore can be used in an identifier, and the identifier must start with a letter or an underscore.
Compiler – Programming ® IPOSplus variables in the Compiler plus® 14.16 IPOS variables in the Compiler plus® The IPOS variables are practically an element of the language and are not allowed to be declared explicitly. They all have the same data type (32 bit with sign) and are valid globally throughout the entire source text.
Compiler – Programming Indirect addressing – pointer INFORMATION Multiple declarations of global variables are not allowed: long a, b, c; long d, a; It is a good idea to use the option of defining global variables when the number of the variable is not important for the application.
Compiler – Programming numof() 14.19 numof() The key word numof() returns the number of a variable. The identifier of a direct or sym- bolic variable is given as the argument. The argument is not allowed to be a composite expression. #define setpoint H200 #declare setpoint2 setpoint:1 H1 = numof(H7);...
Compiler – Operators Order of priority of operators Compiler – Operators Operators are used to link identifiers to one another and to statements in order to per- plus® form certain operations. The IPOS Compiler provides operators for performing ar- ithmetical operations, bit operations, assignment operations or comparison operations. Operators are divided into various categories and have a specified order of priority.
Compiler – Operators Unary operators Category 1 has the highest priority, category 2 (unary operators) has the second highest priority, etc. The comma operator has the lowest priority. Operators in the same category have the same ranking. The unary operators (category 2), conditional operators (category 13) and assignment operators (category 14) assign from right to left;...
Compiler – Operators Binary operators 15.3 Binary operators These operators link two operands together and are located between two operands. 15.3.1 Example H1 = H2; // The binary assignment operator (=) assigns variable H1 the value of H2 H1 = H2 - 3; // The binary minus operator (-) forms the difference between H2 and 3 Combined assignment operators lead to an abbreviated notation.
Compiler – Constructions if...else Compiler – Constructions plus® The IPOS Compiler provides constructions that are also available in other high- level languages. The following constructions are available: • if...else • • while • do...while • switch...case...default These are supplemented by statements such as 'continue' and 'break', which are used as control elements within these constructions.
Compiler – Constructions Example if ( H1 < 2 ¦¦ H1 > 14 ) H2 = 10; Variable H2 is set to the value 10 if H1 is less than 2 or greater than 14. In other words: H2 is set to the value 10 if the value of H1 is not between 2 and 14. 16.2 for 16.2.1 Syntax for ( Expression1 ;...
Compiler – Constructions while Example H1 = 20; H2 = 0; for ( H0 = 0; H0 < 10; ++H0 ) H1 = H1 + 2; if ( H1 > 32 ) continue; ++H2; The if query with the continue statement means variable H2 is no longer incremented as soon as H1 is greater than 32.
Compiler – Constructions do...while The statements within the block are carried out as long as H1 is greater than 5. H2 gets the value 5 when the loop breaks off. As in the for loop, it is also possible to use the break and continue statements here. The break statement once again causes the while loop to be exited.
Page 201
Compiler – Constructions do...while First, the statement is performed. As a statement block, it may also contain several statements. This is followed by the test of whether the expression has the value TRUE (not equal to zero) or FALSE (equal to zero). If the value is TRUE, the statement is per- formed again, otherwise the loop is exited.
Compiler – Constructions switch...case...default A continue statement is also possible. It causes the program to skip to the end of the statement block and then to check the expression. H2 = 0; H2 = H2 +3; if ( H2 > 20 ) break;...
Compiler – Constructions return The default branch must – if available – be the last line in a switch statement. switch ( H1 ) case 1: ++H2; break; case 2: ++H3; break; default: ++H4; break; plus® plus® This program extract increments IPOS variable H2 if the value of IPOS vari- plus®...
Compiler – Functions User-defined functions Compiler – Functions 17.1 User-defined functions The user can program functions (subprograms). Used-defined functions cannot be called when function arguments are transferred. However, this is also unnecessary be- cause all variables are global and cannot be encapsulated with local variables. The structure of a function is as follows: FunctionName() // Statements...
Compiler – Functions Overview of commands for standard functions 17.2 Overview of commands for standard functions plus® plus® A large part of the IPOS machine commands that are familiar from the IPOS plus® Assembler language are reproduced in the IPOS Compiler's high-level language in the form of certain syntactical constructions.
Compiler – Functions Overview of commands for standard functions 17.2.2 Standard communication functions Command Function Availability Reference ® ® MOVIDRIVE MOVITRAC _MoviLink Process and/or parameter data observe the unit-specific command structure (page 222) exchange via RS-485 or system bus. _MovCommDef Process data transfer via RS-485 (page 227) ®...
Compiler – Functions Overview of commands for standard functions 17.2.5 Standard setting functions Command Function Availability Reference ® ® MOVIDRIVE MOVITRAC _Copy Block-by-block, consistent copying (page 210) of variables. _GetSys Reads an internal system value. observe the unit-specific command structure (page 211) _SetInterrupt Defines a function as interrupt rou-...
Compiler – Functions Standard functions 17.3 Standard functions This chapter lists the standard functions in alphabetical order. This makes it easier to find the standard function you are looking for. 17.3.1 _AxisStop Syntax _AxisStop( typ ) plus® Description The drive axis is stopped when the IPOS control word is written.
Compiler – Functions Standard functions 17.3.2 _BitClear Syntax _BitClear( H, bit ) Description _BitClear sets the bit within variable H to zero. Key points H Variable name Constant expression for bit position Example main() _BitClear( H100, 3 ); // deletes bit 3 in H100 17.3.3 _BitMove Syntax _BitMove( H2 , bit2, H1, bit1 )
Compiler – Functions Standard functions Example main() _BitMoveNeg( H1, 3,H2, 4 ); // copies H1.3 = NOT (H2.4) _BitMoveNeg( H1, 1,H1, 0 ); // copies H1.1 = NOT (H1.0) 17.3.5 _BitSet Syntax _BitSet( H, bit ) plus® Description Within the IPOS variable h, _BitSet sets the bit with the number bit to one.
Compiler – Functions Standard functions Key points fnr Constant expression for the number of the fault (see list of faults in the operating instructions) Constant expression for a fault response that can adopt the following values: FR_NORESP: No response; error is not displayed. FR_DISPLAY: Error is only displayed;...
Page 212
Compiler – Functions Standard functions GS_ANINPUTS: Voltage value / current value of the analog inputs 1 and 2 Voltage input: -10 V ... 0 ... +10 V = -10000 ... 0 ... 10000 Current input: 0 ... 20 mA = 0 ... 5000 / 4 ... 20 mA = 1000 ... 5000 –...
Page 213
Compiler – Functions Standard functions GS_ACTSPEEDEXT: Actual speed of the external encoder (X14) – H = Time base, average value filter for speed detection of external encoder. Setting range: 5 ms ... 31 ms – H + 1 = Encoder type –...
Page 214
Compiler – Functions Standard functions The following standard SEW structures are available for the _SetSys statement: Instruction type Standard structure Elements Brief description _GetSys GSAINPUT Input1 Voltage value of analog input 1 Input2 Voltage value of analog input 2 GSAOUTPUT Output1 Voltage value for optional analog output 1 Output2...
Page 215
Compiler – Functions Standard functions Instruction type Standard structure Elements Brief description CamSource Bit 31 switches between preset reference variables and an indicator to a random reference variable. Bit 31 = 0: • 0 = encoder X15 (motor encoder, H511) •...
Page 216
Compiler – Functions Standard functions Instruction type Standard structure Elements Brief description GSACTSPEEDEXT TimeBase Cycle time for speed detection of external encoder, setting range: 5 ms ... 31 ms EncType 0 = encoder X14,1 = DIP encoder Numerator Numerator for user scaling Value range: -2 ...
Compiler – Functions Standard functions Example #include <const.h> GSAINPUT Ain; main() _GetSys( Ain,GS_ANINPUTS ); // Read analog inputs into structure Ain 17.3.9 _Go0 Syntax _Go0( type ) Description This command triggers reference travel of the axis. The argument defines the type of the reference travel.
Compiler – Functions Standard functions Key points type Expression for setting the travel type during reference travel. type can adopt one of the following values: GO0_C_W_ZP GO0_U_W_ZP GO0_C_NW_ZP GO0_U_NW_ZP GO0_C_W_CAM GO0_U_W_CAM GO0_C_NW_CAM GO0_U_NW_CAM GO0_RESET The meaning of the individual letters is as follows: C (Conditional) = Reference travel only if reference travel has not yet been performed U (Unconditional) =...
Compiler – Functions Standard functions Parameter settings for all positioning commands Parameters Explanation P913/P914 Travel speeds (can be changed in the program using SETSYS). P911/P912 Positioning ramps (acceleration) (can be changed in the program using SETSYS). P915/P203 Precontrol that can be used to influence the jerk. ®...
Compiler – Functions Standard functions Example // Standard structures for speed and ramp SSPOSSPEED tPosSpeed; SSPOSRAMP tPosRamp; main() // Set speed and ramp tPosSpeed.CW = tPosSpeed.CCW = 1000 * 10; // Speed 1000 rpm tPosRamp.Up = tPosRamp.Down = 1000; // Ramp is based on 3000 _SetSys (SS_POSRAMP, tPosRamp);...
Compiler – Functions Standard functions function name Name of the event function. (Important: In contrast to a function call, only the name of the function without () is specified here) Example #include <constb.h> #define DI02 0b100 // DI02 = 0b100 TerminalIsOne () // Statements of the event function main()
Compiler – Functions Standard functions Example main() _Memorize( MEM_STDATA ); // Save variables H0 ... H127 to EEPROM 17.3.14 _MoviLink Syntax _MoviLink ( H ) Description The MOVLNK command allows extensive changes to be made to the inverter parame- ters and any other units which may be connected via the system bus or the RS-485. To ensure the safety of people and systems, take particular care when changing the in- verter parameters.
Page 223
Compiler – Functions Standard functions Key points H Start variable of the command structure The command structure is set up as follows: H + 0: Bus type (communication interface) H + 1: Address (target address) H + 2: Format (process and/or parameter data) H + 3: Service (read/write service) H + 4: Index (number of the parameter to be modified or read, see parameter index directory) H + 5: DPointer (Number of the variable H"...
Page 224
Compiler – Functions Standard functions Instruction type Standard Elements Brief description structure MLDATA WritePar (H"+0) Parameter that is sent for write services ReadPar (H"+1) Parameter that is sent for read services PO1 (H"+2) Process output data 1 PO2 (H"+3) Process output data 2 PO3 (H"+4) Process output data 3 PI1 (H"+5)
Page 226
Compiler – Functions Standard functions Parameter set- Data exchange via parameter channel tings for the Addressing via RS-485 (P810 ... P812) receiver Parameters Address Explanation P810 0 ... 99 Individual addressing (sender address) P811 101 ... 199 Group addressing (multicast), the sender can write to all receivers with the same group address at the same time P812 Timeout monitoring function (deactivated if set to 0 ms or 650 ms)
Compiler – Functions Standard functions INFORMATION ® ® With MOVIDRIVE B and MOVITRAC B, the timeout monitoring is checked for tele- grams received within the defined timeout interval. ® With MOVIMOT , the timeout monitoring is activated with the first received cyclic frames (ML_FT...
Page 228
Compiler – Functions Standard functions A variable structure containing the process data is defined in the Compiler by the MCP- DATA variable name;: Data structure for H": H"+0 Contains the error code after connection, or zero if there was no error 0x05000002 indicates the connection has timed out.
Compiler – Functions Standard functions 17.3.16 _MovCommOn The _MovCommOn command can only be used with MQx modules. Syntax _MovCommOn() Description The command starts cyclical communication, communication links set up using Mov- CommDef are activated. As of this point, no MovCommDef command is permitted. Equally, no MOVILINK command to address ≠...
Compiler – Functions Standard functions Example main() _Nop( 17.3.18 _SBusCommDef Syntax _SBusCommDef( object type, H) Description This statement sets up a data object for cyclical or acyclical data transfer. This object can be used to transfer up to 2 variables (8 bytes) via the system bus. The data object is written to a variable structure, the initial variable of which is specified in h.
Page 231
Compiler – Functions Standard functions SCD_TRACYCL Initializes a data object, whose data is transmitted immediately once. The object has the following structure: H+0: Object number H+1: Number of data bytes and data format H+2: Number of the variable H" where the data to be sent begins H+3: Status of the transmission command INFORMATION Prior to transmitting acyclical telegrams, the SBus must also be activated with...
Page 232
Compiler – Functions Standard functions If objects defined via SCREC are received via SBus1 or SBus2, this is signaled in the corresponding system variables H522 and H523, see System variable overview (page 29). Bit 24 of the ObjectNo defines whether the data are transmitted or received with the CAN identifier (bit 0 ...
Page 233
Compiler – Functions Standard functions INFORMATION Observe the following rules when selecting the object number CAN Identifier: 1. In the entire SBus network, an object number can only be set up for transmission once. 2. Within a unit, an object number may only be set up once; either to be sent or re- ceived once.
Compiler – Functions Standard functions Example See _SBusCommStat 17.3.19 _SBusCommOn Syntax _SBusCommOn() ® Description In MOVIDRIVE B, the command has been replaced by _SBusCommState. However, due to downward compatibility, it can still be used. This statement triggers the reception of data and the cyclical transmission of previously defined data objects.
Compiler – Functions Standard functions Example #include <constb.h> T0Interrupt () // Statements of the interrupt routine for timer 0 main() // Inform system of TO interrupt and start _SetInterrupt( SI_TIMER0,T0Interrupt ); while(1) // Main program task 1 17.3.22 _SetSys Syntax _SetSys( sys , H) plus®...
Page 237
Compiler – Functions Standard functions SS_BRAKE: Switching the brake function on/off – H = 0 -> off – H = 1 -> on SS_RAMPTYPE: Specify positioning ramp type (changes P916) – H = 0 -> linear – H = 1 -> sine –...
Compiler – Functions Standard functions The following standard SEW structures are available for the _SetSys statement: Instruction type Standard structure Elements Brief description _SetSys SSPOSRAMP Acceleration positioning ramp (ms) Down Deceleration positioning ramp (ms) SSPOSSPEED Positioning speed CW (0.1 rpm) Positioning speed CCW (0.1 rpm) SSPIDATA3 Number of the process input data to be transmitted...
Compiler – Functions Standard functions Example #include <constb.h> MyTask3 () // Statements of task 3 main() // Inform system of task 3 and start _SetTask ( ST3_START,MyTask3 ); while(1) // Main program 17.3.24 _SetTask2 Syntax _SetTask2( control word, function name ) Description This function is used to determine a user-defined function as task 2 and to start or stop this task.
Compiler – Functions Standard functions 17.3.25 _SetVarInterrupt Syntax _SetVarInterrupt ( h1 , function name ) ® ® Description This command is not available in MOVIDRIVE A, only as of MOVIDRIVE The command activates a variable interrupt with the data structure as of variable H1. If the condition for the interrupt is fulfilled, the "function name"...
Compiler – Functions Standard functions Variable VARINT element Description structure Mode 0: No interrupt event. This can be used to deactivate this one interrupt without deactivating them all. 1: One of the bits of the reference variable, masked out using the Com- pVar mask, has changed its status: ([*SrcVar(t) ^ *SrcVar(t-T)] &...
Compiler – Functions Standard functions Example #include <constb.h> SpeedZero () // Event function // Statements of the event function main() while(1) // Main program task 1 _SystemCall( SC_N0,SpeedZero ); // if speed == zero, call function 17.3.27 _TouchProbe Syntax _TouchProbe( action ) Description Enables or locks a touch probe input.
Compiler – Functions Standard functions Example main() _TouchProbe( TP_EN1 ); // Enables the touch probe input DI02 17.3.28 _Wait Syntax _Wait( time ) Description Waits for the period (in milliseconds (ms)) specified in a constant. Key points time Constant that specifies the wait time in milliseconds; no variable possible. INFORMATION If the waiting time is to be variable, you will have to initialize a timer (H487 ...H489) instead of a WAIT command and program a loop until the timer has expired.
Compiler – Functions Standard functions An input combination can be selected by setting the appropriate bits in the mask to 1. For example, to query DI00 and DI03, mask must be: 0b1001 Example #include <constb.h> main() _WaitInput( 1,0b100 ); // as long as terminal DI02 == HIGH ("1"), wait 17.3.30 _WaitSystem Syntax _WaitSystem( event )
Compiler – Functions Standard functions 17.3.32 _WdOn Syntax _WdOn( time ) Description Sets the value of the watchdog counter to the value specified in 'time.' If the watchdog timer elapses, task 1 and task 2 are stopped and an error message is issued. The ap- plication has to prevent the watchdog timer from running down by cyclically resetting the counter.
Compiler – Examples Setting bits and output terminals Compiler – Examples 18.1 Setting bits and output terminals There are two ways of setting individual bits in variables: 1. The _BitSet ( Hx, y ) function sets bit y in variable x to one. 2.
Compiler – Examples Clearing bits and output terminals 18.2 Clearing bits and output terminals There are two ways to clear individual bits in variables: 1. The _BitClear ( Hx, y ) function clears bit y in variable x. 2. The bit-by-bit AND operation Hx & K sets those bits in variable x to one that are also set to one in constant K.
Compiler – Examples Querying bits and input terminals 18.3 Querying bits and input terminals To query what level a certain input terminal has, a bit must be tested with a variable. The variable is either H483 (InputLevel), which contains the levels of the binary inputs, or a variable h of your choice which contains the levels after the _GetSys() function has been performed.
Compiler – Examples Querying an edge 18.4 Querying an edge 18.4.1 Example 1 In addition to the level of an input terminal, the rising and falling edge can also be queries and evaluated. In the following sample programs, output DO02 is toggled to DI02 for a positive or negative edge.
Compiler – Examples Querying an edge 18.4.2 Example 2 In example 2, the program section within the if query is processed depending on the ris- ing edge at DI02. /*============================================= IPOS source file ===============================================*/ #include <constb.h> #include <iob.h> long BinInputsNew, BinInputsOld; /*============================================= Main function (IPOS initial function) ===============================================*/...
Compiler – Examples Value of a number 18.5 Value of a number plus® The following sample program demonstrates how the IPOS Compiler can be used to create the absolute value of a number. In task 1 a revision program is running that moves the drive relatively 400000 increments CW and 400000 increments CCW.
Compiler – Examples MoviLink command 18.6 MoviLink command The _MoviLink command exchanges data or parameters between units via SBus or RS-485. It is also possible to read or change internal unit parameters. The following three examples are to illustrate the function of the _MoviLink command: •...
Compiler – Examples MoviLink command 18.6.3 Reading a parameter via SBus /*========================================= Process data configuration of inverter connected via SBus is written to variable lPDData in task 1. The received values correspond to the following process data configuration: 0 = PARAM + 1PD 1 = 1PD 2 = PARAM + 2PD 3 = 2PD...
Compiler – Examples SCOM communication 18.7 SCOM communication The following example shows a program that sends two variables cyclically every 10 ms via SBus. Another program receives the data that is sent. With the _SBusCommDef command, you set up a data object for cyclical data transmis- sion.
Compiler – Examples SCOM communication 18.7.2 Sender The variables H208 and H209 are transmitted cyclically every 10 ms to another inverter. The values of H208 and H209 can be changed using input DI17. DI17 = 0: H208 = 111111 / H209 = 222222 DI17 = 1: H208 = 222222 / H209 = 444444 Task 2 is not implemented in this sample program.
Compiler – Examples Touch probe interrupt processing // Main program loop while(1) if( DI17 ) Data_Var1 = 222222; Data_Var2 = 444444; else Data_Var1 = 111111; Data_Var2 = 222222; 18.8 Touch probe interrupt processing Crates are transported to a filling station on a timing belt. A proximity sensor (DI02) de- tects when the next crate arrives.
Page 259
Compiler – Examples Touch probe interrupt processing Timing belt with proximity sensor: DI10 = 1 TP_Max_Pos TP_Pos X13:3 / DIO2 506321163 PD: Pulse direction TP: TP event DI10 = 1: Start TP_Pos: Remaining travel PW: Pulse width PTP: Position after TP event FS: Filling station X13:3/DI02: proximity switch TP_Max_Pos: Maximum target position...
Page 260
Compiler – Examples Touch probe interrupt processing SSPOSSPEED tPosSpeed; SSPOSRAMP tPosRamp; /*============================================= Interruptroutine Touchprobe ===============================================*/ Touchprobe() lPosition = TpPos1_Mot + TP_Pos; //calculate new target position _TouchProbe( TP_DIS1 ); //Deactivate touch probe /*============================================= Main function (IPOS initial function) ===============================================*/ main() //Initialization State = 0;...
Compiler – Examples State machine, fieldbus control with emergency mode 18.9 State machine, fieldbus control with emergency mode A drive is to be controlled via the fieldbus in normal mode. However, in the event of a bus fault, manual operation via terminal and analog value should be possible. Further, provisions have to be made for a mixed mode (fieldbus setpoint + analog setpoint).
Page 262
Compiler – Examples State machine, fieldbus control with emergency mode /*=================================================== Operating mode is selected with input terminals DI10 and DI11 and indicated at the outputs DO10 and DO11. The following operating modes are possible: Mode 0: Control and setpoint via field bus Mode 1: Control via field bus, setpoint added to analog value 1 Mode 2: Control via terminals, setpoint analog 1...
Page 263
Compiler – Examples State machine, fieldbus control with emergency mode /*=================================================== Main program ===================================================*/ main() // Initialization ================================= // Initialize data structure bus data busdata.BusType = 3; //bus type fieldbus busdata.Len = 3; busdata.PO1 = 0; busdata.PO2 = 0; busdata.PO3 = 0;...
Compiler – Examples State machine, fieldbus control with emergency mode 18.9.1 Mode 0 Control and setpoint only via fieldbus Control is performed exclusively via the fieldbus. A reduced control word (0 = rapid stop, 6 = enable) is also to be used. The setpoint is specified in bipolar terms via the fieldbus (-1500 rpm ...
Compiler – Examples Compiler programming frame 18.10 Compiler programming frame The following sample program can be used as the basic frame when creating an plus® IPOS program. It includes a state machine with four operating modes: • DISABLE: No operating mode is selected •...
Page 267
Compiler – Examples Compiler programming frame Drive feedback to PLC/bus monitor (process input data) ------------------------------------------------------------------------------- 1. word = status word, user-specific 2. word = actual speed [1/10 rpm] 3. word = actual position in incr. (only low word) Assignment of status word, user-specific 15 14 13 12 11 10 ¦...
Page 268
Compiler – Examples Compiler programming frame // Variables for controlling operating modes long lOpMode; //Operating mode currently selected long lGlobalStateMachine; //Status of the global state machine #define DISABLE //global state machine: Status DISABLE #define JOGGING //global state machine: Status JOGGING #define HOMING //global state machine: Status HOMING #define POSITIONING...
Page 269
Compiler – Examples Compiler programming frame /*------------------------------------- Main program loop --------------------------------------*/ while(1) //Process main state machine switch (lGlobalStateMachine) // Either no operating mode has been selected, or a selection is not possible case DISABLE: break; // "Jog" mode case JOGGING: fnJogging(); break;...
Page 270
Compiler – Examples Compiler programming frame /*============================================= = Function: fnJogMode() = Jog axis. With 2 inputs, the axis can be moved to the right and to the left. = If the jog mode is not set, the drive remains in hold control. If the jog mode is activated when the drive is released = the main state machine would spring to state 99.
Page 271
Compiler – Examples Compiler programming frame /*============================================= = Function: fnHoming() = Axis reference travel = Parameters of the group 97x are effective = A positive edge on REF-START starts a new reference travel ===============================================*/ fnHoming() // Instructions for entering the main state "Homing" // Define substate lSubStateHoming = HOMING_STOPPED;...
Page 272
Compiler – Examples Compiler programming frame /*============================================= = Function: fnPositioning() = Positioning ===============================================*/ fnPositioning() // Instructions for entering the main state "Positioning" // Define substate lSubStatePositioning = POSITIONING_STOPPED; // Acknowledge mode _BitSet(lPE_StatusWord,11); _BitSet(lPE_StatusWord,12); // cyclical processing as long as the main state is set to "Positioning" // Import PO data _GetSys( tPA.BusType ,GS_PODATA );...
Page 273
Compiler – Examples Compiler programming frame /*============================================= = Function: fnTask2() = For time-critical program sections that can run asynchronously = from task one ===============================================*/ fnTask2() // Read inverter state _GetSys( lDriveState,GS_SYSSTATE ); // Read error number _GetSys( lErrorCode,GS_ERROR ); // Import PO data _GetSys( tPA.BusType ,GS_PODATA );...
Page 274
Compiler – Examples Compiler programming frame // "Referencing" mode case HOMING: if (lDriveState> =0xA) if (lOpMode==JOGGING) lGlobalStateMachine = JOGGING; if (lOpMode==DISABLE) lGlobalStateMachine = DISABLE; if (lOpMode==POSITIONING) lGlobalStateMachine = POSITIONING; else lGlobalStateMachine = DISABLE; break; // "Positioning" mode case POSITIONING:if ((lDriveState> =0xA)&&(MY_REFERENCED)) if (lOpMode==JOGGING) lGlobalStateMachine = JOGGING;...
Compiler – Error Messages Compiler – Error Messages The source text errors that are recognized by the pre-processor and the Compiler are divided into error classes and error codes. Error class Error code Possible cause STATEMENT NOT FOUND Statements missing from body of loop SEMICOLON Semicolon missing after statement CONDITIONAL...
Assembler – Introduction Setting the user travel units Assembler – Introduction 20.1 Setting the user travel units In the program header of the Assembler, the travel distance factors "NUMERATOR", "DENOMINATOR" and "UNIT" can be entered to determine the user travel unit (e.g. mm, rev.).
Page 277
Assembler – Introduction Setting the user travel units INFORMATION If the numerator or denominator are non-integer values, the conversion can be made more accurate if both numerator and denominator are multiplied by the same expan- sion factor (e.g. 10, 100, 1000, etc.). Doing so will not limit the travel range. Travel distance Number of increments the motor moves to travel a defined distance.
Assembler – Introduction First steps 20.2 First steps plus® 20.2.1 Starting the IPOS Assembler plus® ® The IPOS Assembler is started from the MOVITOOLS MotionStudio. plus® plus® • Start the IPOS Assembler just like you would start the IPOS Compiler. plus®...
Assembler – Introduction First steps 20.2.2 Creating a new program plus® To familiarize yourself with the IPOS Assembler you will write your first program to increment a variable from 0 to 99 in steps of 500 ms. 511514635 Assembler commands are entered using the insert tool. To open the dialog box of the insert tool, click the icon 511519755 To insert the first Assembler command in the program, in the [main menu] window, click...
Assembler – Introduction First steps Now use the insert tool to insert the remaining commands in the program. The following table lists the parameters for all the program commands. If you need information on a command, highlight it and press the <F1> key. Command Label Target...
Assembler – Editor Assembler – Editor plus® The Editor is displayed after the IPOS Assembler has been started: 511872523 [1] Menu bar [4] Variable window [2] Toolbar [5] Status bar [3] Program window The status bar shows whether the unit is online or offline. It also displays the program memory content as a percentage and the number of program lines selected.
Assembler – Editor Example 21.1 Example The encoder of a motor supplies 4096 increments per revolution. There is a spindle on the motor with a slope of 10 mm/revolution that moves a trolley horizontally. The user wants to specify the positions to which the drive is to move in mm. In this case, set the numerator and denominator as follows.
Assembler – Editor Compiling and downloading When you select a command, an input screen appears in which you have to enter the arguments available for the selected function. Once you have entered all the arguments, press [OK] to insert the command in the program. You can use the <Del>...
Assembler – Editor Starting/stopping programs The status bar shows whether the program has been downloaded successfully. 512034955 plus® The IPOS program is now stored in the unit's non-volatile memory. plus® ® IPOS programs can also be downloaded from one MOVIDRIVE to another ®...
Assembler – Editor Debugger 21.6.1 Execute to cursor Choose [Run]/[Run to cursor] or the icon in the toolbar to run the program up to the current cursor position. 21.6.2 Single step Choose [Run]/[Single step] or the icon in the toolbar to process the program line in which the cursor is currently positioned.
Assembler – Editor Loading the program from the inverter 21.7 Loading the program from the inverter plus® In the IPOS Assembler you have the option of uploading a program stored in the inverter. To do so, choose [Program]/[Upload] or click on the icon in the toolbar.
Assembler – Programming Basics Assembler – Programming 22.1 Basics plus® ® The IPOS Assembler is part of the MOVITOOLS MotionStudio program package. The Assembler program is entered over a number of screens. 22.1.1 Program header For user programs in which positioning commands are used, enter the user travel units in the program header.
Assembler – Programming Basics 22.1.6 Program loops Program loops consist of a loop start (LOOPB) and a loop end (LOOPE). The number of loop cycles is determined in the argument of the LOOP command. Nested loops are possible; but a maximum of 16 layers should not be exceeded. INFORMATION Do not exit program loops with a jump command.
Assembler – Programming Basics 22.1.10 Variables All variables (H0 - H1023) can be read and written. The variables have a value range from -2 ... +2 - 1. If the variables H0 ... H127 are entered in the variable list or written plus®...
Assembler – Programming Binary inputs/outputs 22.2 Binary inputs/outputs 22.2.1 Binary inputs plus® Direct query The terminal level of binary inputs can be queried in the IPOS program using jump commands. To do so, in the input screen select the terminal level (HI/LO) that should lead to the jump command being performed.
Page 292
Assembler – Programming Binary inputs/outputs Query via system The terminal level of the binary inputs in the basic unit and any installed option are rep- ® variable resented cyclically in the system variables H483 INPUT LVL (MOVIDRIVE A) / H520 ®...
Assembler – Programming Binary inputs/outputs 22.2.2 Binary outputs Reading binary The terminal level of the binary inputs in the basic unit and any installed option are rep- ® outputs resented cyclically in the system variables H482 OUTPUT LVL (MOVIDRIVE A) / H521 ®...
Page 294
Assembler – Programming Binary inputs/outputs Setting individual The BSET and BCLR commands are used for setting/resetting individual outputs. To outputs do so, the bit number corresponding to the terminal must be entered as an operand in the command mask. In the following example, output DO01 should be set to "1": 512416139 Overview of commands and parameters for setting/resetting binary outputs: Table 4: Commands for setting binary outputs...
Page 295
Assembler – Programming Binary inputs/outputs Setting several It is possible to set several binary outputs at the same time, e.g. to output a binary coded outputs table position number. This is done by writing the decimal value of the table position number to system variables H480 or H481.
Assembler – Programming Analog inputs/outputs 22.3 Analog inputs/outputs Table 6: Overview of the analog inputs/outputs Analog inputs/outputs Inputs Outputs Basic unit Option DIO11 option Input/output Terminal designation AI11 AI12 AGND AI21 AI22 AGND AOV1 AOC1 AGND AOV2 AOC2 AGND The analog inputs are differential inputs. The inputs/outputs can be used optionally as either voltage or current inputs/outputs.
Assembler – Commands General information Assembler – Commands 23.1 General information • The result of the calculation operation is always assigned to the left-hand argument (always a variable). The second argument (variable or constant) always remains unchanged. The result of a mathematical operation is always a whole number. •...
Assembler – Commands Overview of commands 23.2.8 Comparison commands Commands for comparing variables and constants. Command Key points ANDL H = H && H ANDL (page 358) LOGICAL AND CPEQ H = H == H CPEQ (page 355) COMPARE EQUAL H = H == K CPGE H = H >= K...
Assembler – Commands Arithmetic commands 23.3 Arithmetic commands 23.3.1 Fundamental operations ADD / SUB / MUL / DIV The four basic arithmetical functions are performed taking account of signs. They can also be performed with variables H and constants K. The 1st argument is always a vari- able H, the 2nd argument can either be a second variable H or a constant K.
Assembler – Commands Arithmetic commands MUL/MULTIPLY The MUL command multiplies a variable with a constant or a variable (observing the signs). Command structure Mxxx: Label (optional) Mxxx MUL X1 * X2 X1: Variable (factor and product) X2: Variable or constant (factor) MUL HXX * HYY Variable HXX is the result of the multiplication of variables HXX and HYY.
Assembler – Commands Arithmetic commands MOD/MODULO The command supplies the integer remainder when a variable has been divided by a variable or a constant. The sign of the result is the same as the sign of the first variable. Command structure Mxxx: Label (optional) Mxxx MOD X1 mod X2 X1: Variable (dividend and remainder of division)
Assembler – Commands Arithmetic commands The XOR command performs a bit-by-bit XOR operation between a variable and a sec- ond variable or a hexadecimal constant. Command structure Mxxx: Label (optional) Mxxx XOR X1 XOR X2 X1: Variable (result and output value) X2: Variable or constant (output value) XOR HXX XOR HYY Variable HXX is the bit-by-bit XOR operation of variables HXX and HYY.
Page 306
Assembler – Commands Arithmetic commands SHR/SHIFT The SHR command moves the content of a variable to the right by the number of bits RIGHT specified in a variable or constant. Zeros are moved along from the left. Command structure Mxxx: Label (optional) Mxxx SHR X1 >>...
Assembler – Commands Bit commands 23.4 Bit commands 23.4.1 Bit commands BSET/BCLR/BMOV/BMOVN BSET/BIT SET The BSET command sets a bit within a variable to 1. The bit places in the variable have the numbers 0 ... 31. The least significant bit has the number 0. For example, if a bit is set in the system variable H481 STD.OUT IP, a binary output can be set directly.
Page 308
Assembler – Commands Bit commands BMOVN/BIT The BMOVN command copies a bit from one variable to a bit in another variable, negat- MOVE NEGATE ing it in the process. The bit places of a variable have the numbers 0 ... 31. The least significant bit has the number 0.
Assembler – Commands Communication commands 23.5 Communication commands 23.5.1 MOVLNK Description, see _MoviLink (page 222) Command struc- ture Instruction Standard structure Elements Brief description type _MoviLink MOVLNK BusType (H+0) Possible bus types: ML_BT_S0 = 1 (RS485 #1) ML_BT_S1 = 2 (RS485 #2) ML_BT_SBUS1 = ML_BT_SBUS = 5 ML_BT_SBUS2 = 8 Address (H+1)
Page 310
Assembler – Commands Communication commands The following table shows the elements with unit-specific characteristics. Element Unit-specific characteristics ® ® MOVIDRIVE MOVITRAC BusType (H+0) only only only ® 2: (RS485 at X13) 2: (RS485 at FSC/FIO11B) 2: (RS485 to MOVIMOT 5: (SBUS at X12) 5: (SBUS at FSC/FIO21B) 8: (via DFC11B) Format (H+2)
Page 311
Assembler – Commands Communication commands Example 1 Reading an "internal" unit parameter (analog input AI1) plus® The following IPOS program and parameter setting are used to read the display pa- rameter P020 with the index number 8331 and then to write it to variable H011. The vari- able structure has been entered here in the editing window for variables The variable structure can also be created in the program using SET commands.
Page 312
Assembler – Commands Communication commands Settings above: Sender (Master) / below: Receiver (slave) 514453899 H0 Bus-Type = SBus H1 Address = SBus address of receiver (slave) H2 Frametype 134 = only Para H3 Service = Read H4 Index 11005 = Index of H5 H5 D-Pointer = Data pointer value at H9 Manual –...
Page 313
Assembler – Commands Communication commands ® Example 3 Controlling a MOVIMOT unit via RS-485 and 3PD ® ® MOVIMOT must be started up in accordance with the MOVIMOT operating instruc- tions. ® Communication with MOVIMOT is only possible via RS-485. Control is only possible via the process data channel with 2PD or 3PD (min.
Assembler – Commands Communication commands INFORMATION ® ® With MOVIDRIVE B and MOVITRAC B, the timeout monitoring is checked for tele- grams received within the defined timeout interval. ® With MOVIMOT , the timeout monitoring is activated with the first received cyclic frames (ML_FT...
Assembler – Commands Communication commands Variable structure of the parameter data H*+0 Contains the error code after the parameter service has been performed, or contains zero if there was no error The errors are coded according to MOVILINK. H*+1 0: No action or parameter data exchange is complete. 1: Start of the parameter data exchange H*+2 1: Read service...
Assembler – Commands Communication commands 23.5.4 SCOM An SCOM command (System bus COMmunication) can be used to transfer up to 2 vari- ables (8 bytes) via the system bus. The SCOM command initializes the transfer object and defines whether the object should be sent acyclically or cyclically or whether objects are to be received.
Page 317
Assembler – Commands Communication commands Unit [2] receives the data. Unit [3] ignores data but is waiting for data with object number 1102. Sender and receiver settings Sender Receiver plus® plus® IPOS program with command: IPOS program with command: – SCOM TRANSMIT CYCLIC H –...
Page 318
Assembler – Commands Communication commands Object structure Object number (CAN-Bus-ID): The object number is used for addressing the data object. The object numbers of the sender (TRANSMIT) and receiver (RECEIVE) must be the same for the data exchange. Cycle time in ms: Specifies the time interval after which the data is sent again. Valid cycle times: See _SbusCommDef (page 227) Note:...
Page 319
Assembler – Commands Communication commands TRANSMIT This argument initializes a data object, whose user data is transmitted once immedi- ACYCLIC ately. Variable H of the SCOM TRANSMIT ACYCLIC H command defines the start of the communication and user data. A SCOMON command is not required. A SCOM TRANSMIT ACYCLIC H command is used to send several variables.
Page 320
Assembler – Commands Communication commands Object structure Object number: The object number is used for addressing the data object. The object num- bers of the sender (TRANSMIT) and receiver (RECEIVE) must be the same for the data exchange. Number of data bytes and data format Value Function 0...3...
Assembler – Commands Communication commands The length of a variable corresponds to 4 bytes. This means for a data length of 8 bytes, two consecutive variables are transmitted. Receiver settings 514591883 H0 Objectno. 1025 = user-defined H1 Len = Variable length 8 bytes H2 D-Pointer = Data pointer value at H5 11111...
Assembler – Commands Communication commands Structure Command structure Mxxx: Label (optional) Mxxx SCOMON 23.5.6 SCOMST This statement initializes the CAN interface, starts or stops the data reception and the acyclic transmission of predefined data objects via SBus 1 or SBus 2. The data objects re initialized via the SCOM function.
Assembler – Commands Positioning commands 23.6 Positioning commands 23.6.1 Reference travel GO0 The GO0 command triggers reference travel or sets an absolute encoder. In doing so, the operating status and the 7-segment display changes from "A" (technology option) to "c" (reference mode). Operating mode P700 is not affected. The argument of GO0 and parameters P900 -P903 determine the reference travel be- havior.
Page 324
Assembler – Commands Positioning commands INFORMATION For type 3 and 4 and for the CAM setting, the drive must be referenced and positioned right next to the hardware limit switch. For hoist applications and the lower reference point in particular, when the drive is positioned to the lower point, it can collide with the hardware limit switch at the slightest overshoot.
Assembler – Commands Positioning commands 23.6.2 GOA absolute positioning / GOR relative positioning The argument of the travel command includes the target position. INFORMATION If the target position is specified via a variable, the value can only be entered in incre- ments (based on 4096 increments/motor revolution).
Page 326
Assembler – Commands Positioning commands GOR/GO RELA- This command performs relative positioning to the position specified in the second ar- TIVE gument X2. Argument X2 can be a constant, variable or an indirect variable. The entered travel distance is added to the current target position H492 (TARGET PO- SITION) of the drive and displayed there.
Page 327
Assembler – Commands Positioning commands plus® Once the END command has been performed, the IPOS program automatically starts processing from the first line. Example 2 The program shown below causes movement to take place between the positions 0 and 409600 increments. A waiting period of 1 second elapses when a position is reached. The speed is increased from 100 rpm to 3,000 rpm when the drive moves beyond posi- tion 40960.
Page 328
Assembler – Commands Positioning commands Endless positioning plus® The absolute travel range of IPOS is limited to values in the range –2 ... 0 ... 2 –1. With the relative travel command, a maximum travel distance of 2 can be added to any actual position (see number circle).
Assembler – Commands Program commands 23.7 Program commands 23.7.1 Program command END plus® The END statement indicates the textual (not logical) end of an IPOS program. The END statement is not an IPOS command; you cannot delete it. 23.7.2 Subroutine call CALL CALL Subroutines are called up with a CALL command (CALL Mxx).
Assembler – Commands Program commands 23.7.3 Jump commands JMP JMP/terminals The program jumps to the specified label if the input terminals marked in the mask are all set to level 1 or level 0 (AND relation). The bits 0 ... 5 indicate the terminals of the basic unit, bits 6 ... 13 the terminals of the option card (DIO11A).
Page 331
Assembler – Commands Program commands Structure Command structure Mxxx: Label (optional) Mxxx JMP X1 OP X2, Myyy Variable Operator: > / > = / < / <= / = / != H = variable K = constant 0 = zero (in a comparison with zero, only the operators = and != are possible).
Assembler – Commands Program commands 515235723 23.7.4 Loop commands LOOP INFORMATION Do not exit program loops with a jump command. Jump commands and subroutines are allowed within a program loop. LOOPB/LOOP This command in combination with a LOOP command creates a program loop. The BEGIN number of loop cycles (>...
Assembler – Commands Program commands Structure Command structure Mxxx: Label (optional) Mxxx LOOPE Example In the example below, variable H0 is incremented from 0 to the value 5 in 5 loop cycles. Program processing starts again with the SET H0 = 0 command after 5 loop cycles. 515243147 23.7.5 No Operation NOP / remark REM / return RET / TASK / TASK2 / wait WAIT NOP/NO OPERA-...
Page 334
Assembler – Commands Program commands Structure Command structure Mxxx: Label (optional) Mxxx RET TASK This command is used to define the start address of task 2 and task 3 and to start or stop these with the argument X1 (START/STOP); that is, the control word of the task is written.
Page 335
Assembler – Commands Program commands WAIT The WAIT command waits for the length of time specified in ms in the argument and then continues program processing for this task once the time is up. INFORMATION If the waiting time is to be variable, you will have to initialize a timer (H487 ... H489) instead of a WAIT command and program a loop with the JMP command until the timer has expired.
Assembler – Commands Set commands 23.8 Set commands 23.8.1 Copy variables COPY COPY The COPY command copies the number of successive variables specified in the 3rd ar- gument. The second argument of the COPY command indicates the number of the first source variable;...
Page 337
Assembler – Commands Set commands ANALOG INPUTS -10 V ... 0 ... +10 V = -10000 ... 0 ... 10000 Voltage value analog input 1 [mV] Voltage value analog input 2 [mV] The GETSYS H = CAM command simulates a cam controller. Using the GETSYS command, a standard cam controller with 1 output per cam can be used per drive.
Page 338
Assembler – Commands Set commands RELATED TORQUE Relative torque/relative torque VFC. The relative torque is the display value based on the rated unit current for the REL. TORQUE VFC torque at the motor output shaft. The absolute torque can be calculated from this value using the following formula: ×...
Assembler – Commands Set commands 23.8.3 Set commands variable SET / fault response SETFR / Indirect addressing SETI / Interrupt SETINT / system values SETSYS The SET command loads argument X1 with the content of argument X2 (variable H or constant K).
Page 340
Assembler – Commands Set commands Structure Command structure Mxxx: Label (optional) Mxxx SETFR #X1 = X2 Fault code of the fault for which the response is to apply. The following error numbers are permitted: 08: n-monitoring 11: Overtemperature 26: External terminal (P830) 28: Fieldbus timeout (P831) 31: TF sensor (P835) 39: Reference travel...
Page 341
Assembler – Commands Set commands SETI/SET INDI- Variable X1 gets the value of variable whose number is contained in variable X2. RECT H = [H] INFORMATION Is the number of the indirectly addressed variables outside the defined range (e. g. ®...
Page 342
Assembler – Commands Set commands Structure Command structure Mxxx: Label (optional) Mxxx SETI [X1] = X2 Hxxx = Number of the target variable. Hyyy = Source variable. Example SET H01 = 50 SET H0 = 10 M01 :SETI [H0] = H01 ADD H0 + 1 ADD H01 + 10 JMP H0 <= 15 , M01...
Page 343
Assembler – Commands Set commands Structure Command structure Mxxx: Label (optional) Mxxx SETINT X1, Myyy DISABLE Deactivating the interrupt, the jump flag (Mxx) is of no importance. ERROR Triggers an interrupt in case of a unit fault. The interrupt routine runs cyclically until the error has been removed, at which point, the routine is left using the RET command.
Assembler – Commands Set commands Example 2 The following example illustrates the principle of this process: :SETINTERROR M01 JMP UNCONDITIONED , M0 M01 :ADD H0 + 1 H0 counts up as long as the unit error still occurs. After the fault reset, H0 contains the value from the EEPROM, for example, 0.
Page 345
Assembler – Commands Set commands Structure Command structure Mxxx: Label (optional) Mxxx SETSYS X1, X2 Number of the first source variable. X1: System values that can be selected The internal fixed setpoints (parameter group P160/P170) can be altered in steps of 0.1 rpm plus®...
Page 346
Assembler – Commands Set commands ACT. POSI- Sets the motor encoder actual position ACTPOS.MOT (H511) TION SPLINE Internal drive calculation of an analytical cam disk. The function is only available in MDX B MULTIAXIS with SD version -15C. The spline calculation is initialized via the system function after up to 20 curve points (x-y = value pairs, x = master position, y = slave position) have been specified in a master encoder range.
Assembler – Commands Set commands 23.8.5 VARINT Syntax VARINT Hxx, Mxx ® ® Description This command is not available in MOVIDRIVE A, only as of MOVIDRIVE The command activates a variable interrupt with the data structure as of variable Hxx. If the condition for the interrupt is fulfilled and task 2 or 3, in which this interrupt is pro- cessed, is started, the commands are performed as of the label Mxx.
Page 348
Assembler – Commands Set commands Variable VARINT element Description structure Mode 0: No interrupt event. This can be used to deactivate this one interrupt without deactivating them all. 1: One of the bits of the reference variable, masked out using the CompVar mask, has changed its status: ([*SrcVar(t) ^ *SrcVar(t-T)] &...
Assembler – Commands Special unit commands 23.9 Special unit commands 23.9.1 ASTOP / MEM / TOUCHP / WDOFF / WDON ASTOP/AXIS The ASTOP command is used to stop or re-enable the drive (see H484 bit 1). The ar- STOP gument of the command (RAPID STOP, HOLD CONTROL, TARGET POSITION) de- fines the stop type (ramp, control when stopped, etc.) or re-enables the drive (IPOS EN- ABLE).
Page 350
Assembler – Commands Special unit commands Individual variables can also be stored using the MOVILINK command. 516345867 Structure Command structure Mxxx: Label (optional) Mxxx MEM X1 No data is stored STORE ALL Programs and data in the working memory are saved in the non-volatile memory (EEPROM) LOAD ALL Programs and data are loaded from the non-volatile memory (EEPROM) to the working mem- ory.
Page 351
Assembler – Commands Special unit commands The argument can be used to select the edge change that causes a touch probe. 516734219 The touch probe positions are stored in the following variables: Encoder Encoder position Position Position Touch probe 1 Touch probe 2 (DI02) (DI03)
Page 352
Assembler – Commands Special unit commands Example 1 In the program, the drive travels between the absolute positions 0 revs. and 100 revs. If there is a change of signal level at touch probe input DI03 whilst the drive is moving to the target position of 100 revs., a further 10 revs.
Page 353
Assembler – Commands Special unit commands Example 2 As an alternative to the example above, a program branch (jump flag M100) can be ex- ecuted when the touch probe position is reached. This is achieved using the "SETINT TOUCHP1 M100" command. 516742923 WDOFF/WDON / The watchdog is called up in the time interval specified in the argument.
Page 354
Assembler – Commands Special unit commands Example The drive moves for as long as the level at DI05 is set to 1 ("high"). The "watchdog" func- tion ensures that the drive does not travel for more than 10 s. If the 10 second limit is exceeded, the drive is stopped.
Assembler – Commands Comparison commands 23.10 Comparison commands 23.10.1 Comparison operations CPEQ / CPGE / CPGT / CPLE / CPLT / CPNE A variable is compared with a 2nd argument (variable or constant). The following com- parisons are possible: • Equal to (CPEQ) •...
Page 356
Assembler – Commands Comparison commands Example 1 SET H0 = 13 SET H1 = 50 CPGE H0 > = H1 After the program has been processed, H0 has the value zero and H1 the value 50. Example 2 SET H0 = -3 CPGE H0 >...
Page 357
Assembler – Commands Comparison commands CPLT/COMPARE The CPLT command compares, observing the signs, whether variable X1 is less than LESS THAN as variable or constant X2. Variable X1 contains the result. It is not equal to zero if the condition is fulfilled; otherwise, the result is zero. The result can be processed further, for example, with a subsequent jump command.
Assembler – Commands Comparison commands 23.10.2 Logical operations ANDL / ORL / NOTL ANDL LOGICAL The ANDL command is the logical AND operation of two variables. The result is written to variable X1. Variable X2 remains unchanged. The result is zero when one of the two variables = 0.
Page 359
Assembler – Commands Comparison commands NOTL/LOGICAL The NOTL command carries out the logical negation of a variable. The result is written to variable X1. Variable X2 remains unchanged. The result is one when variable X2 = 0. The result is zero when variable X2 != 0. Structure Command structure Mxxx:...
Assembler – Examples "Flashing light" sample program Assembler – Examples 24.1 "Flashing light" sample program 24.1.1 Sample "Controller" This sample program switches digital output DOØ1 on and off every 2 seconds. Quick-start (exam- Requirements ple) Mains connection and/or 24 V supply (backup voltage terminals X10:9 (+24 V / VI24) and X10:10 (0 V / DGND)) connected;...
Assembler – Examples "Flashing light" sample program 24.1.2 Sample "Positioning" This sample program alternates the position of the drive 10 motor revolutions CW and CCW every 2 s. Quick-start (exam- Requirements ple) • Inverter / motor / encoder connected • Inverter started up in VFC-n-Reg.
Assembler – Examples "Hoist" sample program "10 motor revolutions back and forth" sample program: 516923787 The program consists of: 3 remark lines Travel relative 10 motor revolutions CW Wait 2 seconds Travel relative 10 motor revolutions CCW Wait 2 seconds End program End of program / jump to start of program The RET command is not mandatory in this example as the program was not called as...
Assembler – Examples "Hoist" sample program Travel distance Circumference of the drive wheel in mm factor denominator d × π 50 mm × π =157.0796327 157,08 × 100 (expansion factor) = 15708 Unit The unit after the travel-specific information is to be displayed in mm. Travel speed 1350 rpm Position window...
Assembler – Examples "Hoist" sample program 24.2.9 Program source code (with remarks) Comment NUMERATOR: 2048000 DENOMINATOR: 15708 UNIT: mm ****************************************** Program: hoist With the first 3 inputs of the option DIO11A, the drive moves to position 0;1000;2000. File: Hub 100.mdx Author: SEW/AWT Date: 01.06.98...
Assembler – Examples "Jog mode" sample program Reference travel Reference subroutine ========================================== Travel release M20: ASTOP IPOS ENABLE Reference travel, no wait, start at zero pulse, U,NW, ZP Cancel reference travel M22: JMP LO I0000000000000001, M21 and the bit in the status word "IPOS Reference" = 0 H319 = 0 BMOV H319.0...
Assembler – Examples "Jog mode" sample program 24.3.3 Input terminals Level Terminal terminal function Meaning DI00 /Controller inhibit Switch power section on/off DI01 Enable Controlled standstill DI02 Reset Reset after fault (moving clear of limit switches) DI03 Reference cam Switch for zero or offset value DI04 Limit switch right Limit switch for stopping (+)
Assembler – Examples "Jog mode" sample program 24.3.5 Program source code (with remarks) Comment NUMERATOR: 1 DENOMINATOR: 1 UNIT: Inc ****************************************** Sample program: Jog mode File: Tipp.mdx Author: SEW/AWT Date: 01.06.98 Function: Jog mode - endless travel possible - No need to reference the axis - Travel limits are observed;...
Page 371
Assembler – Examples "Jog mode" sample program Program branch distributor Program branch distributor ========================================== Activate interrupt routine for hardware limit switch pro- SETINT ERROR cessing reset/move clear of limit switch M100: JMP LO I0001000000000000, M101 DI16 = 1 → Reference travel CALL DI15 = 1 →...
Assembler – Examples "Table positioning" sample program Jog CW ------------------------------------------ Move for as long as DI14 = 1 and Jog + DI15 = 0, ------------------------------------------ Query: Is software limit switch active? M30: JMP LO I0000010000000000, M31 HI I0000100000000000, M31 Add 1000 motor revolutions to the current actual position CALL and use the result as the new target position H319 == 1...
Assembler – Examples "Table positioning" sample program A "1" signal at output DO15 "Table position valid" indicates that the selected table posi- tion has been reached. This output is reset once a new table position is selected. By ad- ditionally evaluating output DO16 "IPOS in position", it is also possible to detect when the selected table position is exited even when the controller is deactivated ("Controller inhibit"...
Assembler – Examples "Table positioning" sample program 24.4.3 Input terminals Level Terminal terminal function Meaning DI00 /Controller inhibit Switch power section on/off DI01 Enable Controlled standstill DI02 Reset Reset after fault (moving clear of limit switches) DI03 Reference cam Switch for zero or offset value DI04 Limit switch right Limit switch for stopping (+)
Assembler – Examples "Table positioning" sample program 24.4.5 Program source code (with remarks) Comment NUMERATOR: 1 DENOMINATOR: 1 UNIT: Inc ****************************************** Program: Table positioning File: Tab.mdx Author: SEW/AWT Date: 01.06.98 Function: Table positioning: - The first 4 inputs of the DIO11 option are used to select the positions in the corresponding variables 0-15 in binary coded format.
Page 376
Assembler – Examples "Table positioning" sample program Set speed and acceleration values for table position- Program start ing (see variable description in the remarks for the ========================================== program source code) Initialization ------------------------------------------ SET H300 = 15000 H301 = 15000 H302 = 1000 H303 = 1000 ------------------------------------------ Program branch distributor...
Page 377
Assembler – Examples "Table positioning" sample program Main program table positioning Main program table positioning ========================================== Check for referenced axis Table positions are only approached with a referenced ------------------------------------------ drive M50: SET H321 = 0 (DO17 = 10 bit position in output terminal system vari- BMOV H321.0 = H473.20 able H473;...
Index Index DPRAM synchronization ........141 DRS11A, binary inputs ..........30 Absolute encoder ...........53 DRS11A, status message........30 absolute encoder (SSI) ........138 DRS_Ctrl / DRS CTRL...........30 Absolute encoder, actual position ......35 DRS_Status / DRS STATUS .........30 ActPos_Abs / ACTPOS ABS........35 ActPos_Extt / ACTPOS EXT........35 ActPos_Mot / ACTPOS MOT .........35 Actual position source ..........134 Encoder scaling ...........
Page 379
Index IPOS special functions .........132 PID controller IPOS synchronization ..........141 Actual value address .........38 IPOS travel parameters........127 Actual value offset ..........38 Actual value scaling ...........38 IPOS variable edit ..........134 IPOS_Setp / IPOS_SETP ........38 D component .............38 Filtered and scaled actual value ......38 I component ............38 Maximum actual value ........38 Jerk time ..............132...
Need help?
Do you have a question about the IPOS plus and is the answer not in the manual?
Questions and answers