Manual: Ipos Positioning and Sequence Control System
Manual: Ipos Positioning and Sequence Control System
Manual: Ipos Positioning and Sequence Control System
Manual
Contents
1 General Information .......................................................................................... 14
1.1 Structure of the safety notes ..................................................................... 14
1.2 Liability for defects .................................................................................... 15
1.3 Exclusion of liability................................................................................... 15
1.4 Copyright................................................................................................... 15
2 Safety Notes ...................................................................................................... 16
2.1 General information .................................................................................. 16
2.2 Designated use ......................................................................................... 17
2.3 Target group ............................................................................................. 17
2.4 Programming errors .................................................................................. 17
3 System Description........................................................................................... 18
3.1 Introduction ............................................................................................... 18
3.1.1 Scope of this documentation ..................................................... 18
3.1.2 Creating programs ..................................................................... 19
plus®
3.2 IPOS – features ................................................................................. 19
3.3 Controlling IPOSplus® units ....................................................................... 22
3.3.1 Active control signal source ....................................................... 22
3.4 Technology options / application modules ................................................ 22
3.4.1 Technology options.................................................................... 22
3.4.2 Application modules................................................................... 23
3.5 Technical data........................................................................................... 25
3.5.1 MOVIDRIVE® B ......................................................................... 25
3.5.2 MOVITRAC® B .......................................................................... 25
3.5.3 MQx ........................................................................................... 26
3.6 Reference documents............................................................................... 27
3.6.1 General manuals ....................................................................... 27
3.6.2 Manuals for serial interfaces/fieldbuses .................................... 27
3.6.3 Manuals for synchronized axis movements............................... 27
3.6.4 Manuals for application modules ............................................... 27
3.6.5 Manuals for the MQx fieldbus interfaces ................................... 27
4 IPOS Variables................................................................................................... 28
4.1 Introduction ............................................................................................... 28
4.2 Overview of the system variables ............................................................. 29
5 Task Management and Interrupts .................................................................... 40
5.1 Introduction ............................................................................................... 40
5.2 Task management for MOVIDRIVE® A and B .......................................... 40
5.3 Tasks for MOVIDRIVE® A......................................................................... 43
5.4 Tasks for MOVIDRIVE® B......................................................................... 43
5.4.1 Processing time for task 1 / task 2............................................. 43
5.4.2 Task 3 ........................................................................................ 44
5.4.3 Implementation information ....................................................... 44
5.4.4 Example..................................................................................... 45
Manual – IPOSplus® 3
Contents
5.5 Interrupts................................................................................................... 45
5.5.1 Example..................................................................................... 46
5.6 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
5.7 Variable interrupts with MOVIDRIVE® B................................................... 49
5.7.1 Calling up the variable interrupt ................................................. 49
5.7.2 IPOS access to the internal interrupt control ............................. 50
6 Position Detection and Positioning................................................................. 53
6.1 Encoder evaluation ................................................................................... 53
6.2 Motor encoder (X15) ................................................................................. 54
6.3 Encoder combinations .............................................................................. 54
6.4 External encoder (X14) ............................................................................. 57
6.4.1 Positioning on external encoder (X14)....................................... 57
6.4.2 Slip compensation with external encoder .................................. 57
6.5 SSI absolute encoder (DIP) ...................................................................... 60
6.5.1 Startup ....................................................................................... 60
6.5.2 1. Select encoder type P950...................................................... 60
6.5.3 2. Set direction of rotation of the motor P35_ ............................ 61
6.5.4 3. Set counting direction P951 for the SSI absolute encoder .... 61
6.5.5 4. Set encoder scaling P955...................................................... 61
6.5.6 5. Set position offset P953......................................................... 61
6.5.7 6. Set Zero offset P954.............................................................. 62
6.5.8 7. Set encoder factors P942 and P943...................................... 62
6.5.9 8. Set P941 actual position source ............................................ 62
6.6 Referencing............................................................................................... 63
6.6.1 Type 0: Reference travel to zero pulse...................................... 67
6.6.2 Type 1: CCW end of the reference cam .................................... 67
6.6.3 Type 2: CW end of the reference cam....................................... 68
6.6.4 Type 3: CW limit switch ............................................................. 69
6.6.5 Type 4: CCW limit switch........................................................... 69
6.6.6 Type 5: No reference travel ....................................................... 70
6.6.7 Type 6: Reference cam flush with CW limit switch .................... 70
6.6.8 Type 7: Reference cam flush with CCW limit switch ................. 71
6.6.9 Type 8: Without enable.............................................................. 72
6.7 Modulo function......................................................................................... 73
6.7.1 Introduction ................................................................................ 73
6.7.2 Operating principle .................................................................... 74
6.7.3 Travel strategies ........................................................................ 77
6.7.4 Project planning ......................................................................... 80
6.7.5 Project planning examples......................................................... 80
6.7.6 Frequently asked questions....................................................... 83
4 Manual – IPOSplus®
Contents
Manual – IPOSplus® 5
Contents
6 Manual – IPOSplus®
Contents
Manual – IPOSplus® 7
Contents
8 Manual – IPOSplus®
Contents
Manual – IPOSplus® 9
Contents
10 Manual – IPOSplus®
Contents
Manual – IPOSplus® 11
Contents
12 Manual – IPOSplus®
Contents
Manual – IPOSplus® 13
General Information
1 Structure of the safety notes
1 General Information
1.1 Structure of the safety notes
The safety notes in these operating instructions are designed as follows:
General danger
Specific danger,
e.g. electric shock NOTICE Possible damage to property Damage to the drive system or its environ-
ment
14 Manual – IPOSplus®
General Information
Liability for defects
1
1.4 Copyright
© 2009 – SEW-EURODRIVE. All rights reserved.
Copyright law prohibits the unauthorized duplication, modification, distribution, and use
of this document, in whole or in part.
Manual – IPOSplus® 15
Safety Notes
2 General information
2 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. If you are unclear about any of the information in this documentation,
please contact SEW-EURODRIVE.
The following safety notes refer to the use of the IPOSplus® positioning and sequence
control system. Also take into account the supplementary safety notes in the individual
sections of this documentation and in the documentation of the units.
16 Manual – IPOSplus®
Safety Notes
Designated use
2
Manual – IPOSplus® 17
System Description
3 Introduction
3 System Description
3.1 Introduction
The basic functions and options of IPOSplus® 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® can
often take a great deal of the load off the machine controller (PLC), or maybe even re-
place it.
Reducing the central control offers SEW customers significant potential savings in terms
of hardware and the complexity of electrical installation.
The programming work is divided between the PLC and inverter control. However, users
must familiarize themselves with the system. This includes getting to know IPOSplus® if
you want to make effective use its benefits.
18 Manual – IPOSplus®
System Description
3
IPOSplus® – features
INFORMATION
Application modules solve typical drive tasks without the user having to create a pro-
gram. Instead of programming, you only have to set the parameters for a tried and
tested program (application module) created by SEW-EURODRIVE. This saves you
time, and you do not need the programming know-how described in this manual.
Manual – IPOSplus® 19
System Description
3
IPOSplus® – features
20 Manual – IPOSplus®
System Description
3
IPOSplus® – features
Manual – IPOSplus® 21
System Description
3
Controlling IPOSplus® units
22 Manual – IPOSplus®
System Description
Technology options / application modules
3
473361163
Winding
473365515
Manual – IPOSplus® 23
System Description
3 Technology options / application modules
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. All the important machine data is easily accessible. There are almost no sources
for errors, since only those parameters required for the application have to be entered.
All relevant data, for example, terminal states or position values, can be observed using
a diagnostics tool during the ongoing operating process.
The functionality of each these modules is described in individual manuals.
24 Manual – IPOSplus®
System Description
Technical data
3
3.5.2 MOVITRAC® B
Encoder resolution: MOVITRAC® B 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: 8 kByte
Command processing time: Task 1: 1 Assembler command/ms
Task 2: 2 Assembler commands/ms
Interrupts: -
Variables: 1024, of which 128 (0 ... 127) can be stored in non-volatile memory
System variable area IPOS variables H453 to H560
Touch probe inputs: -
Sampling interval of analog inputs: 1 ms
Sampling interval of binary inputs: 5 ms
Binary inputs/outputs: MOVITRAC® B 6 inputs/3 outputs
FIO21B option 7 Inputs
Analog inputs/outputs: MOVITRAC® B 1 input (0 ... 10 V)
FIO11B option 1 input (± 10 V)
1 output (0 ... 20 mA, 4 ... 20 mA)
Manual – IPOSplus® 25
System Description
3 Technical data
3.5.3 MQx
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: Task 1: 1 Assembler command/ms
Task 2: 2 Assembler commands/ms
Interrupts: -
Variables: 512, of which 128 (0 ... 127) can be stored in non-volatile memory
System variable area IPOS variables H453 to H511
Touch probe inputs: -
Sampling interval of analog inputs: -
Sampling interval of binary inputs: 4 ms/input frequency at the counter inputs: max. 4 KHz
Binary inputs/outputs: MQ.21./MQ.22.: 4 inputs and 2 outputs
MQ.32.: 6 Inputs
Analog inputs/outputs: -
26 Manual – IPOSplus®
System Description
Reference documents
3
Manual – IPOSplus® 27
kVA n IPOS Variables
4 f
Introduction
i
Hz
P Hz
4 IPOS Variables
4.1 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. In the user program, you must check that the final result of a cal-
culation lies within the number range.
The number range can be represented as follows in a number circle:
2147483648 2147483647
0x8000 0000 0x7FFF FFFF
-2147483648 2147483647
473666955
Example:
H0
H 0 = 4, H1 = 7, H 3 = =0
H1
H 0 = 2147 483 647, H1 = 1, H 3 = H 0 + H1 = −2147 483 648
Each variable has an index that can be used to read and write variables using, for ex-
ample, the Movilink command (_MoviLink/ MOVLNK). The index is calculated as follows:
Index = VarNo. + 11000
Example: H371 has the index 11371.
28 Manual – IPOSplus®
IPOS Variables kVA n
Overview of the system variables
f 4
i
Hz
P Hz
The following table describes the function of the system variables and their names in the
Compiler and Assembler.
Variables in the range specified that are not assigned are reserved for internal functions
and cannot be used for user variables.
No. Name Description
Compiler /
Assembler
128 This variable can be used in a user-specific IPOS program. The variable is used by the application modules to
store the program identification.
360 Variable range for This variable range is assigned additional system variables if the technology options internal synchronous
... internal synchro- operation or electronic cam are used. In all other cases, these can be used by the user as required.
452 nous operation or
electronic cam
453 ModuloCtrl / Control word for the modulo function (see also modulo function and IPOS parameter).
MODULOCTRL Bit 0 TargetReset_Off
Bit 0 = 0: The current positioning task is deleted (ModTagPos is set to ModActPos) if the positioning operation
is interrupted (for example, if the enable is revoked or if the controller inhibit or stop bit is set).
Bit 0 = 1: The target position is held even if the enable has been revoked or if the controller inhibit or the stop
bit has been set. If the drive is enabled again, it continues with the positioning process.
Bit 1 TargetGAZ_Select
Bit 1 = 0: Standard setting, 360° output corresponds to 216 incr.
Bit 1 = 1: Setting for increasing the resolution: 360° corresponds to the product from modulo numerator P961
x modulo encoder resolution P963. Positioning cannot be performed over several revolutions.
454 ModTagPos / Modulo target position
MOD.TAGPOS If a changed value is written to the modulo target position for an enabled inverter, positioning begins in output
units. The position setpoint (for H453.1 = 0) is set in 16 bit resolution in the unit H454 MODTAGPOS = k x
360° + 0 ... 360°= k x 216 + 0 ... (216 -1) (k = number of complete revolutions).
Once a new value has been written to the variable, only the target position within a revolution is visible in vari-
able H454. We recommend that you also write the new value to a temporary variable for improved diagnos-
tics.
Once position 454 has been written, the firmware calculates an incremental target H492. This causes H473 bit
19 "In position" to remain set for up to 1 ms.
455 ModActPos / Modulo actual position
MOD.ACTPOS The current modulo actual position moves (in 16 bit resolution when H453.1 = 0) between 0 and 216 incre-
ments (0° and 360°).
456 ModCount / Increments within a modulo revolution before scaling to the output.
MOD COUNT
Display value of the internal temporary result when the incremental encoder value H509/H510/H511 (IPOS
encoder value) is converted to the modulo actual position H455.
For H456 = (IPOS encoder value) MOD (P961 x P963)
H455 = H456/(P961 x P963) x 216 (prerequisite: H453, bit 1 = 0)
See section "Modulo positioning". If 0 is written to H456, H455 is set automatically to 0.
Manual – IPOSplus® 29
kVA n IPOS Variables
4 f
Overview of the system variables
i
Hz
P Hz
474 Scope474 / These two variables can be used together with the oscilloscope SCOPE function integrated in MOVITOOLS®
SCOPE 474 MotionStudio to record measured values.
475 Scope475 / Example: Measurement of the actual position value of a modulo axis. In the IPOS program, the command
H474 = H455 is called up cyclically and in SCOPE, channel 1 is set to IPOS variable H474 Low and channel 2
SCOPE 475
is set to IPOS variable H474 High.
476 DRS_Ctrl / Signal level of the binary outputs of the synchronous operation board DRS11, READ and SET.
DRS CTRL. Bit terminal level
0 X40.9 AUSG0
1 X40.10 AUSG1
2..14 Reserved
15 Set hardware fault DRS (fault 48)
16..31 Reserved
477 DRS_Status / Signal level of the binary inputs and status signals of the synchronous operation board type DRS11,
DRS STATUS READ.
Bit terminal level / status signals
0 X40.5 INP4 free input 1
1 X40.6 INP5 Free input 2
2 /DRS prewarning
3 /DRS lag error
4 DRS slave in position
5 Master standstill
6..31 Reserved
478 AnaOutpIPOS2 / Analog outputs of the terminal expansion board type DIO11, only SET.
ANA.OUT IP2 The value of variable H478 is output on an analog output when the corresponding terminal is programmed to
"IPOS OUTPUT 2".
Option DIO11 is required for MOVIDRIVE® A and B; for MCH and MCS / MCV / MCV 40A, an output can be
programmed as a binary output or analog output.
Variable value physical outputOutput terminal assignment
- 10000..0..10000 AOV1/AOC1/AO01 P640 analog output AO1 = IPOS OUTPUT 2
- 10000..0..10000 AOV2/AOC2/AO01 P643 analog output AO2 = IPOS OUTPUT 2
30 Manual – IPOSplus®
IPOS Variables kVA n
Overview of the system variables
f 4
i
Hz
P Hz
Manual – IPOSplus® 31
kVA n IPOS Variables
4 f
Overview of the system variables
i
Hz
P Hz
32 Manual – IPOSplus®
IPOS Variables kVA n
Overview of the system variables
f 4
i
Hz
P Hz
Manual – IPOSplus® 33
kVA n IPOS Variables
4 f
Overview of the system variables
i
Hz
P Hz
34 Manual – IPOSplus®
IPOS Variables kVA n
Overview of the system variables
f 4
i
Hz
P Hz
Manual – IPOSplus® 35
kVA n IPOS Variables
4 f
Overview of the system variables
i
Hz
P Hz
36 Manual – IPOSplus®
IPOS Variables kVA n
Overview of the system variables
f 4
i
Hz
P Hz
Manual – IPOSplus® 37
kVA n IPOS Variables
4 f
Overview of the system variables
i
Hz
P Hz
551 PID_ActNorm / PID controller: Filtered and scaled actual value, diagnostics value
PID.ACTNOR
552 PID_ActOffset / PID controller: Integer, permanent offset of actual value, H552 and P278 are identical
PID.ACTOFF -32000 (-32000) <= Offset <= 32000 (32000); default: 0
553 PID_ActMin / PID controller: Minimum value for actual value after smoothing, scaling and offset, H553 and P280 are iden-
PID.ACTMIN tical.
-32000 (-32000) <= xe,min <= 32000 (32000); Default: 0
554 PID_ActMax / PID controller: Maximum value for actual value after smoothing, scaling and offset, H554 and P281 are iden-
PID.ACTMAX tical.
-32000 (-32000) <= xe,max <= 32000 (32000); default: 10000 (10,0)
555 PID_LimitMin / PID controller: Minimum output value, H555 and P282 are identical
PID.LMTMIN -32000 (-32000) <= xcontroller,min <= 32000 (32000); default: -1000 (-1,0)
556 PID_Limit_Max / PID controller: Maximum output value, H556 und P283 are identical
PID.LMTMAX -32000 (-32000) <= xcontroller,max <= 32000 (32000); default: 10000 (1,0)
38 Manual – IPOSplus®
IPOS Variables kVA n
Overview of the system variables
f 4
i
Hz
P Hz
Manual – IPOSplus® 39
kVA n Task Management and Interrupts
5 f
Introduction
i
Hz
P Hz
40 Manual – IPOSplus®
Task Management and Interrupts kVA n
f 5
Task management for MOVIDRIVE® A and B i
Hz
P Hz
473926155
474186507
IPOSplus® processes a task cyclically. A task starts with the first command again once
the last command has been completed. If you only want to execute an initialization rou-
tine in task 1 once, you can exclude this program section using an endless loop.
main()
{
// Program code only initialization
while(1)
{
// cyclical program code
}
}
Manual – IPOSplus® 41
kVA n Task Management and Interrupts
5 f
i Task management for MOVIDRIVE® A and B
Hz
P Hz
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® B) rupt interrupt
(only
MOVIDRIVE®
B)
_SetTask2(ST
2_START,
Start
Task2Name); Not available Not available
MOVIDRIVE® A
or TASK2
Lightning icon START Mxx With the
or P931 in _SetTask(ST2 defined inter-
keypad _SetTask(ST3_S rupt event
_START,
TART, With the
Start Task2Name);
Task3Name); or defined inter-
MOVIDRIVE® B or TASK
TASK TASK3, rupt event
TASK2,
START Mxx
START Mxx
STOP icon or
_SetTask2(ST
Stop 2_STOP,
Not available Not available
MOVIDRIVE® A Task2Name);
or TASK2
STOP icon or STOP Mxx
P931 in key- STOP icon or As task 1
pad STOP icon or
_SetTask(ST2
_SetTask(ST3_S
_STOP, As task 1 or as
Stop TOP,
Task2Name); assigned task
MOVIDRIVE® B Task3Name); or
or TASK 2 or 3
TASK TASK3,
TASK2, STOP
STOP Mxx
Mxx
With other
Interrupt Via "Task1" Cannot be task 1 interrupt
Not available Not available
MOVIDRIVE® A interrupt interrupted with higher pri-
ority
With other With variable
Interrupt Via "Task1" With variable With variable task 1 interrupt interrupt in the
MOVIDRIVE® B interrupt interrupt interrupt with higher pri- same task with
ority higher priority
Debug with
breakpoint and Yes No1) No1) Yes No1)
single step
Command pro-
1 Assembler 2 Assembler Assembler
cessing time Not available Not available
command/ms commands/ms command/ms
MOVIDRIVE® A
min. 1 com-
1 ... 10 2 ... 11 Assem- mand per ms;
As task to
Assembler bler com- additional com-
Command pro- which the
commands/ mands/ms, mands are pro-
cessing time As task 1 interrupt is
ms, factory factory set- cessed
MOVIDRIVE® B assigned (task
setting: 1 com- ting: 2 com- depending on
2 or 3)
mand/ms mands/ms the processor
utilization
1) Copy commands to task 1 for debugging.
42 Manual – IPOSplus®
Task Management and Interrupts kVA n
f 5
Tasks for MOVIDRIVE® A i
Hz
P Hz
Manual – IPOSplus® 43
kVA n Task Management and Interrupts
5 f
i Tasks for MOVIDRIVE® B
Hz
P Hz
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
0 1 9 11
1 2 8 10
2 3 7 9
3 4 6 8
4 5 5 7
5 6 4 6
6 7 3 5
7 8 2 4
8 9 1 3
9 10 0 2
5.4.2 Task 3
Task 3 is available from the B series units. Task 3 processes at least 1 command/ms.
Depending on the unit configuration and on the setting of P938/P939, task 3 will perform
additional commands. 20 ... 40 commands/ms is the typical number of commands for
task 3. The absolute resource requirements for command processing is ca. 20 ... 40%
lower in task 3 compared with task 1 or task 2. Application components, for which the
guaranteed run time of the individual program lines is not important, are processed
faster in task 3.
44 Manual – IPOSplus®
Task Management and Interrupts kVA n
Interrupts
f 5
i
Hz
P Hz
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-
cation:
• Interrupt-oriented programs:When a user program is interrupt-oriented and the
task 1 interrupts should be processed quickly, task 1 must be assigned a high
calculation priority using additional commands in P938.
• Runtime-optimized programs:If, for example, process data is to be converted in
IPOS, this must be done as quickly as possible. Task 3 can be used to process
convert routines as quickly as possible. In this case, task 1 and task 2 should be
assigned as few additional commands/ms as possible. This ensures the fastest total
application performance if tasks 1 and 2 run with the minimum speed.
5.5 Interrupts
An interrupt - triggered by an event - interrupts the processing of the task it is assigned
to. The entire interrupt routine is run through once, as long as it is not interrupted by an
interrupt with a higher priority of the same task.
An interrupt that is activated by _SetInterrupt() or SETINT can be triggered by a timer0
overflow, a system/unit fault or touch probe DI02 and interrupts task 1.
In MOVIDRIVE® B, up to 4 additional variable interrupts can be activated using
_SetVarInterrupt() or VARINT. They interrupt task 2 or task 3 as required.
The response time for task 1 interrupts (unit fault, DI02 touch probe or T0_overflow) is
dependent on the number of activated interrupts (1 interrupt <= 1ms, 2 interrupts <=
2ms, 3 interrupts <= 3ms). The response time for variable interrupts is dependent on the
number of activated interrupts <= 1ms.
If an interrupt is triggered during a wait command, the waiting time of the command con-
tinues to run in the background. Once the program has jumped back to the task, it only
has to wait the remaining time before continuing.
Manual – IPOSplus® 45
kVA n Task Management and Interrupts
5 f
i Interrupts for MOVIDRIVE® A and B
Hz
P Hz
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.
46 Manual – IPOSplus®
Task Management and Interrupts kVA n
f 5
Interrupts for MOVIDRIVE® A and B i
Hz
P Hz
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. Depending
on the fault response set, the system either continues processing with the current values
in task 1, or IPOS is restarted using the values from the EEPROM.
Sample fnTouchInterrupt()
{
H0++;
}
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
_SetInterrupt( SI_TOUCHP1,fnTouchInterrupt); //Act. interrupt routine
TouchProbe( TP_EN1 );
while (1) {H1 = H1 +1;}
}
H0 is increased by 1 once.
If the touch probe command is also called in the while loop or in the fnTouchInterrupt,
the interrupt would respond to all changes in edge signal on DI02.
Typical applications for the touch probe are: Relative positioning for de-stacking equip-
ment or register loop control for processes with a continuous material flow.
Manual – IPOSplus® 47
kVA n Task Management and Interrupts
5 f
i Interrupts for MOVIDRIVE® A and B
Hz
P Hz
INFORMATION
Since the timer0 counts backwards, the interrupt condition would be fulfilled perma-
nently if T0_Reload = 0 and the value of the timer has not been changed in the inter-
rupt routine.
Sample fnTimerInterrupt()
{
H0 = H0 +1;
T0_Reload = 10000; //Reload timer 0 automatically with 10 s
_SetInterrupt( SI_TIMER0,fnTimerInterrupt); // Activate interrupt
}
main()
{
while (1) {H1 = H1 +1;}
}
H0 is increased by 1 every 10 s.
48 Manual – IPOSplus®
Task Management and Interrupts kVA n
f 5
Variable interrupts with MOVIDRIVE® B i
Hz
P Hz
Manual – IPOSplus® 49
kVA n Task Management and Interrupts
5 f
i Variable interrupts with MOVIDRIVE® B
Hz
P Hz
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
• Changing the data structure and then calling the command again (necessary if, for
example, the CompVar value used for the comparison changes) or
• calling the command with a different data structure but with the same value in
variable H+1 (IntNum).
In this way, for example, the request bit can be set for test purposes during initial startup
up regardless of the actual interrupt condition and a variable interrupt can be triggered
(as long as the corresponding variable interrupt has been activated beforehand).
A variable interrupt can be used to configure time-controlled program processing, for ex-
ample, the cyclical calculation of acceleration from a speed.
In addition, when a high-priority variable interrupt is being processing, you can delete a
pending, lower-priority interrupt by deleting the corresponding request bit.
Sample The transport axis of a filling machine should head for a metering unit using DO01 when
it moves past the position 5° on the machine. The output should be deactivated 200 ms
later irrespective of the speed and axis position.
50 Manual – IPOSplus®
Task Management and Interrupts kVA n
f 5
Variable interrupts with MOVIDRIVE® B i
Hz
P Hz
fnTask3()
{ //Task 3 is only needed to activate VarInt.
H1 = H1;
//dummy command
}
fnOPENvalve()
{ //Switch on metering unit
Timer_2 = 0;
//Reset timer 2 to 0
hCLOSEvalve.Mode = 2;
//Activate stop-IRQ
_SetVarInterrupt( hCLOSEvalve,fnCLOSEvalve );
_BitSet( StdOutpIPOS, 1 );
//Set DO01
}
fnCLOSEvalve()
{ //Switch off metering unit
_BitClear( StdOutpIPOS, 1 );
//Delete DO01
hCLOSEvalve.Mode = 0;
//Deactivate stop-IRQ
_SetVarInterrupt( hCLOSEvalve,fnCLOSEvalve );
}
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{ //Initialization part
hOPENvalve.Control = 2; //Interrupt task3
hOPENvalve.IntNum =0;
//continuous no.
hOPENvalve.SrcVar = numof ( ModActPos ); //Modulo motor encoder
hOPENvalve.CompVar = 910;
hCLOSEvalve.Control = 2;
//Interrupt task3
hCLOSEvalve.IntNum = 1; //continuous no.
hCLOSEvalve.pSrcVar = numof ( Timer_2 ) ; //Timer 2
hCLOSEvalve.CompVar = 200; //deactivate after 200 ms
hCLOSEvalve.Mode = 0; //Deactivate timer-IR first
hCLOSEvalve.Priority = 7;
Manual – IPOSplus® 51
kVA n Task Management and Interrupts
5 f
i Variable interrupts with MOVIDRIVE® B
Hz
P Hz
474256139
52 Manual – IPOSplus®
Position Detection and Positioning kVA n
Encoder evaluation
f 6
i
Hz
P Hz
Manual – IPOSplus® 53
kVA n Position Detection and Positioning
6 f
Motor encoder (X15)
i
Hz
P Hz
The position values are always available for IPOSplus® control in the variables H509 to
H511. Even if positioning was performed without IPOSplus®, impulse encoders con-
nected to X14 and X15 can be recorded and further processed in the IPOSplus® pro-
gram. The system variables H570 ... H573 can be used to activate zero pulse counters
for motor encoder X15 and external encoder X14 in order to record the number of zero
pulses. A motor encoder must be used for positioning with the IPOSplus® commands
(GO...). The motor encoder supplies MOVIDRIVE® with a high-quality speed signal.
54 Manual – IPOSplus®
Position Detection and Positioning kVA n
Encoder combinations
f 6
i
Hz
P Hz
Manual – IPOSplus® 55
kVA n Position Detection and Positioning
6 f
Encoder combinations
i
Hz
P Hz
56 Manual – IPOSplus®
Position Detection and Positioning kVA n
External encoder (X14)
f 6
i
Hz
P Hz
Once the control voltage has been switched on, if an AS1H or AV1H is used the absolute
value of this encoder is used as the actual position value of the external encoder H510.
For all other encoder types, H510 = 0 increments. The external encoder can be refer-
enced as the motor encoder (see the chapter "Reference Travel").
Manual – IPOSplus® 57
kVA n Position Detection and Positioning
6 f
External encoder (X14)
i
Hz
P Hz
EXT H510
P944
476710667
58 Manual – IPOSplus®
Position Detection and Positioning kVA n
External encoder (X14)
f 6
i
Hz
P Hz
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:
• Variable H510 shows the actual position of the position control ACTPOS. EXT
• Variable H506 shows the touch probe position 1 TP. POS1EXT
• Variable H504 shows the touch probe position 2 TP. POS2EXT
The variables are always evaluated with parameter P944.
Manual – IPOSplus® 59
kVA n Position Detection and Positioning
6 f
SSI absolute encoder (DIP)
i
Hz
P Hz
INFORMATION
MOVITOOLS® MotionStudio guides you through the startup procedure for the abso-
lute encoder option. Various dialog boxes prompt you to make the necessary entries
and take the required actions.
• Start MOVITOOLS® MotionStudio and mark the unit.
• Open the context menu and select the command [Startup]/[DIP startup].
• Follow the instructions of the startup wizard.
Once startup with MOVITOOLS® MotionStudio has been completed, you only have to
specify the "Actual position source" parameter.
After the DIP startup, the motor encoder and the DIP encoder are referenced during the
reference travel irrespective of the setting of parameter "Actual position source" P941.
If the DIP encoder has been set manually, the reference travel only references the motor
encoder, also irrespective of the setting of P941
Alternatively, you can perform startup for the DIP11 option for the absolute encoder
step-by-step as described below.
60 Manual – IPOSplus®
Position Detection and Positioning kVA n
SSI absolute encoder (DIP)
f 6
i
Hz
P Hz
6.5.4 3. Set counting direction P951 for the SSI absolute encoder
Move the drive in the positive direction (defined according to application) at low speed.
If the absolute encoder position (H509 ACTPOS. ABS) counts upwards, you do not have
to change parameter P951 "Counting direction". If the absolute encoder position counts
downwards, P951 must be inverted.
The quotient Q results from the H511 difference divided by the H509 difference.
Q = (H511 old - H511 new)/(H509 old - H509 new)
Set ENCODER SCALING ( P955) to the value closest to the calculated quotient Q, pre-
ferably to the lower of the closest values.
If the quotient is greater than 80, positioning using the absolute encoder can only be per-
formed with reduced dynamic properties.
INFORMATION
During project planning, ensure that the encoder ratio does not exceed 1:10.
Manual – IPOSplus® 61
kVA n Position Detection and Positioning
6 f
SSI absolute encoder (DIP)
i
Hz
P Hz
ABS P954
DIP H509
P955 P953
476717707
To find out how to determine encoder factors, refer to the parameter descriptions for
P942/P943.
INFORMATION
The circuit gain for position control of IPOSplus®, parameter P910 "Gain X controller"
was preset during startup of the speed control loop. This presetting means positioning
control is performed with the motor encoder. The difference in encoder resolution or
the time characteristics of the absolute encoder (e.g. laser distance measuring instru-
ment) may require a lower value setting.
62 Manual – IPOSplus®
Position Detection and Positioning kVA n
Referencing
f 6
i
Hz
P Hz
Set a maximum of half the value of the calculated preset value. If P955 is ≥ 32, only enter
a quarter of the calculated preset value. Start an IPOSplus® program with a positioning
operation between two valid points at moderate speed. Reduce or increase parameter
P910 "Gain X controller" step-by-step until the best movement and positioning charac-
teristics have been set. If P955 is set to a high value, it may be necessary that values in
P910 are < 1.
The position value provided by the absolute encoder is available in variable H509 (ACT-
POS.ABS). The position value can be processed with the internal IPOSplus® control
even without direct positioning.
6.6 Referencing
For applications using absolute positioning commands, you must define the reference
point (machine zero). Depending on the encoder type, this setting must either be made
at initial startup (absolute encoder) or each time the machine is switched on again (all
other encoders).
MOVIDRIVE® supports 9 types of reference travel that can be set via P903 Reference
travel type, P904 Reference travel to zero pulse and the arguments of the IPOSplus®
command _Go0 ( ... ); or GO0 ... and that result from the reasonable combination
of the following characteristics:
• Encoder is set without reference travel (no reference travel)
• Search direction is set (= direction of movement at start of reference travel)
• Referencing is set to the hardware limit switches
• Referencing is set to zero impulse (only possible in external encoders when the
resolution < 5000 inc./revolution)
• Referencing is set to reference cam
If referencing is set to the hardware limit switches and/or the reference cam, these must
be set as binary inputs.
Parameter P941 Source actual position is used to define which encoder is used for ref-
erence travel.
Once the drive is enabled, reference travel is started using one of the following methods:
• Via a positive edge on binary input P600 ... P606 or P610 ... P617 that is set to the
function REF.-FAHRT START
• via the IPOSplus® command _Go0 ( ... ); or GO0 ...
The display changes to "c" - REFERENCE MODE.
Stop ramp P136 is always used for acceleration during the reference travel. Reference
travel types with reference cam or limit switch, accelerate to P901 reference speed 1
and then search for the condition for the end of the reference travel with P902 reference
speed 2. Reference type 0, uses P902 Reference speed 2 right away.
Manual – IPOSplus® 63
kVA n Position Detection and Positioning
6 f
Referencing
i
Hz
P Hz
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:
• The drive stops and switches internally from speed to position control.
• Bit 20 "IPOS Referenced" in H473 StatusWord is set and a binary input, with the
parameter "IPOS REFERENCE", is set.
• Reference offset P900 is transmitted to the actual position value. If the modulo
function is deactivated (P960 = OFF), this is the variable of the encoder H509 - H511
selected in P941. If the modulo function is activated, it is the variable H455
ModActPos.
As of this point, the following formula applies for the machine zero:
Machine zero = reference point + reference offset
The status "referenced" is reset when the inverter is switched off or if error messages
relating to the position measuring system occur (exception: for Hiperface® encoders,
see the note below).
For advanced users, MOVIDRIVE® offers the option of setting an absolute encoder for
which a new encoder offset is calculated and described at the reference point when the
drive is not enabled and when it is in the safe stop status, for example. It is also possible
to evaluate distance coded encoder systems using complex IPOSplus® programming. If
you require support in performing either of these operations, contact SEW service per-
sonnel.
INFORMATION
For Hiperface® and SSI absolute encoders, the status "referenced" is always set and
is only reset during reference travel.
INFORMATION
The drive reacts differently when the controller inhibit is set during reference travel, de-
pending on how reference travel was started.
• If reference travel was started via a positive edge at binary input REF.TRAVEL
START or via the non-wait IPOS command _Go0( ._NW_.. ); or
GO0...,NW,..., the reference travel is not continued if the controller inhibit is
reset. To start travel, a positive edge must be set at the input REF. TRAVEL
START.
• If reference travel was started via the wait IPOS command _Go0( ._W_.. ); or
GO0...,W,..., the error message F39 reference travel is generated.
64 Manual – IPOSplus®
Position Detection and Positioning kVA n
Referencing
f 6
i
Hz
P Hz
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.
• If the reference point is determined using the zero pulse and reference cam, and the
zero pulse is located exactly at the end of the reference cam, the switching transition
of the reference cam may be detected before or after the zero pulse (switching
hysteresis). The result may be a reference position which varies by a motor
revolution from one time to the next. The situation can be remedied by shifting the
reference cam (by about half a motor revolution).
• Unidirectional drives can only be referenced using a reference cam. Also note that
there is no defined distance between the reference cam and zero pulse of the
encoder for non-integer ratios. This means that in this case only the end of the
reference cam can be selected as the reference point.
• The length of the reference cam and the reference speeds must be selected so the
drive can reliably decelerate to the slower reference speed (reference speed 2) on
the reference cam. The end of the reference cam or the closest zero pulse of the
encoder system can be used as reference point.
• The zero pulse can only be used as a reference point when the encoder has a zero
pulse, the zero track is connected to the inverter and the PPR count < 5000 inc./
revolution.
INFORMATION
In case of reference travel of a drive system with absolute encoder (Hiperface® or
DIP), the position offset will be recalculated and overwritten by the reference travel
P905 Hiperface® offset X14 / P947 Hiperface® offset X15 or DIP offset P953 Position
offset, depending on the source set for the actual position.
INFORMATION
If you change P350/P351 reverse direction of rotation, you have to change these pa-
rameters prior to the reference offset or perform the reference offset again after
changing the parameters, because this change affects the actual position of the axis.
Manual – IPOSplus® 65
kVA n Position Detection and Positioning
6 f
Referencing
i
Hz
P Hz
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
• Starting point of the drive
– [1] Between the reference cam and the right hardware limit switch
– [2] On the reference cam
– [3] Between the reference cam and the left hardware limit switch
• LHWLS = CCW hardware limit switch
• RHWLS = CW hardware limit switch
• CAM = Reference cam
• RefCAM = Reference position cam: Movement to this position takes place when the
argument of the GO0 reference travel command contains CAM.
• RefZP = Reference position zero pulse: Movement to this position takes place when
the argument of the GO0 reference travel command contains ZP.
• RefOffCAM = Reference offset for reference travel with reference position cam CAM
• RefOffZP = Reference Offset for reference travel with zero pulse ZP
• MZP = Machine zero
66 Manual – IPOSplus®
Position Detection and Positioning kVA n
Referencing
f 6
i
Hz
P Hz
[3]
nRef1 [2]
[2]
[1]
1
nRef2
RefOffCAM
f
RefOffZP
Z
MZP
Z RefZP X
LHWLS RHWLS
WLS
476740875
Manual – IPOSplus® 67
kVA n Position Detection and Positioning
6 f
Referencing
i
Hz
P Hz
If reference travel is started with the IPOSplus® 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.
nRef2
RefOffCAM
f
RefOffZP
Z
MZP
Z RefZP RefCAM
C
476742795
nRef2
RefOffCAM
f
RefOffZP
e
RefCAM
C RefZP MZP
ZP
476744331
68 Manual – IPOSplus®
Position Detection and Positioning kVA n
Referencing
f 6
i
Hz
P Hz
[2] [1]
nRef1 [3]
nRef2
RefOffZP
R Z
MZP
Z Ref
RefZP
LHWLS RHWL
RHWLS
476758667
Manual – IPOSplus® 69
kVA n Position Detection and Positioning
6 f
Referencing
i
Hz
P Hz
If the reference travel is started via the IPOSplus® command Go0, you have to set the
argument "ZP".
[3] [2]
nRef1 [1]
nRef2
RefOffZP
e P
RefZP MZP
Z
LHWLS RHWL
RHWLS
476760203
[3]
nRef1 [ ]
[2]
[1]
nRef2
RefOffZP
Z
MZP
Z X
LHWLS RHWLS
WLS
476761739
70 Manual – IPOSplus®
Position Detection and Positioning kVA n
Referencing
f 6
i
Hz
P Hz
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.
If reference travel is started with the IPOSplus® 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.
The reference cam must start just before or in line with the CW hardware limit switch and
must project into the limit switch. This ensures that no contact is made with the hardware
limit switch during reference travel.
[3] [2]
nRef1
nRef2
RefOffCAM
f
RefOffZP
Z
MZP
Z RefZP RefCAM
fCAM
C
476763275
Manual – IPOSplus® 71
kVA n Position Detection and Positioning
6 f
Referencing
i
Hz
P Hz
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.
[2
[2] [1]
nRef1
nRef2
RefOffCAM
f
RefOffZP
e
RefCAM
C RefZP MZP
Z
476764811
[3]
nRef1 [ ]
[2]
[1]
nRef2
RefOffZP
Z
MZP
Z X
LHWLS RHWLS
WLS
476761739
In contrast to type 5, type 8 reference travel can also be performed when the system
status is not set to "A".
72 Manual – IPOSplus®
Position Detection and Positioning kVA n
Modulo function
f 6
i
Hz
P Hz
INFORMATION
Depending on the system, the gear unit and, if necessary, any additional gears must
be simulated via the number of teeth. Ask the manufacturer of your gear unit for the
exact number of teeth. Do not accept the ratio from the nameplate. Furthermore, the
maximum target position that can be represented is determined when the gear unit is
selected. This value must not be exceeded. This must be taken into account in the
project planning phase (see the Project Planning section).
Manual – IPOSplus® 73
kVA n Position Detection and Positioning
6 f
Modulo function
i
Hz
P Hz
476886155
476887691
The mechanism of the application is simulated during startup. You have to specify the
exact number of teeth of the gear unit and the additional gear if required. This informa-
tion is represented in the following SHELL parameters:
• Modulo numerator and denominator P961/P962
• Modulo encoder resolution P963
The user can use the following IPOSplus® system variables to specify target positions in
output units for the MOVIDRIVE® system software:
• Modulo target position H454 to describe the target position
• Actual modulo position of the output H455 for reading the actual position
74 Manual – IPOSplus®
Position Detection and Positioning kVA n
Modulo function
f 6
i
Hz
P Hz
The actual position H455 is calculated according to the following block diagram:
ABS
H456 16
MOT H511 2
P961 x P963
476895243
INFORMATION
If the drive is to be positioned to the target position in the modulo range, the drive start
positioning when the target position is written to variable H454 MOD.TAGPOS. GO
commands refer to the IPOSplus® encoder and cannot be used for modulo positioning.
INFORMATION
The following examples use the modulo value 360°. It is also possible to scale to a
different physical value other than a modulo value.
Manual – IPOSplus® 75
kVA n Position Detection and Positioning
6 f
Modulo function
i
Hz
P Hz
The diagram below shows the relationship between the current position of the IPOSplus®
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° (= 0 increments) to 360° (= 216 increments).
H455 ModActPos
477219595
A new target position is specified by writing the IPOSplus® variable H454 MODTAGPOS
in 32-bit format.
The system software differentiates between 2 forms of representation, which can be set
in H453, bit 1:
• 360° = 16 bit (referred to below as "216/360°" ) standard setting: In this case, the
higher value bit range can be used for specifying whole number 360° rotations.
• 360° = 32 bit (referred to below as "232/360°" ) standard setting: This notation should
be avoided due to the restriction on the maximum range of representation. If used,
the product of modulo numerator and modulo encoder resolution corresponds to one
360° revolution.
76 Manual – IPOSplus®
Position Detection and Positioning kVA n
Modulo function
f 6
i
Hz
P Hz
Referencing Reference travel is started in the same way as for referencing without the modulo
function. When the modulo function is activated, the H455 MOD.ACTPOS variable is
referenced.
If a reference offset is specified in P900, it is interpreted as being in the output unit
scaling (216 = 360°).
Once reference travel is complete, the current target position H454 MOD.ACTPOS is
set to the actual value MOD.ACTPOS (see section "Referencing").
ACTPOS.MOT H511 is not referenced.
Positioning The travel strategy for positioning is selected via the SHELL parameter 960 Modulo
function. The modes can be changed using an IPOSplus® program with the MOVILINK
command (see section "User interface"). The examples refer to the selected resolution
(216/360°).
A motor encoder has been entered as the IPOSplus® encoder (P941 Source actual po-
sition = MOTOR ENC. (X15)).
"Short distance" Modulo mode "Short distance" (P960 = SHORT) – standard setting
Starting from the current actual position H455 MOD.ACTPOS, the system calculates the
shortest route to the required target position H454 MOD.TAGPOS. The direction of ro-
tation is selected on the basis of the shortest route.
Target position that can be represented:
H454 MOD.TAGPOS = k × 360° + 0 ... 360° = k × 216 + 0 ... (216 - 1)
477225739
Manual – IPOSplus® 77
kVA n Position Detection and Positioning
6 f
Modulo function
i
Hz
P Hz
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. To move this axis 1 revolution CCW, H454 must be set to 0x
FFFF0000.
477230091
78 Manual – IPOSplus®
Position Detection and Positioning kVA n
Modulo function
f 6
i
Hz
P Hz
477247627
INFORMATION
To use the modulo function, the peripheral condition of the product of modulo encoder
resolution and modulo numerator < 231 must be fulfilled.
Manual – IPOSplus® 79
kVA n Position Detection and Positioning
6 f
Modulo function
i
Hz
P Hz
SEW employees can read off the number of teeth in the gear unit from the SEW Tech-
nical Manual (DriveNet) or from the electronic nameplate (only for Hiperface®).
80 Manual – IPOSplus®
Position Detection and Positioning kVA n
Modulo function
f 6
i
Hz
P Hz
477251979
MN
= iG × i AG
MD
MN Z2 + Z 4 + Z6
=
MD Z1 + Z3 + Z5
MN 227106 113553
= =
MD 2176 1088
MN = Modulo numerator
MD = Modulo denominator
iG = i gear unit
iAG = i additional gear
The numerator and denominator were reduced in the above example (happens auto-
matically with the Wingear program).
This results in the following input values for the SHELL parameters:
• Modulo numerator = 113553
• Modulo denominator = 1088
• Modulo encoder resolution = 4096
Manual – IPOSplus® 81
kVA n Position Detection and Positioning
6 f
Modulo function
i
Hz
P Hz
477253515
MN
= iG × i AG
MD
MN Z2 + Z4 + Z6 Z AG 2
= ×
MD Z1 + Z3 + Z5 Z AG 1
MN 1021977
=
MD 1360
82 Manual – IPOSplus®
Position Detection and Positioning kVA n
Modulo function
f 6
i
Hz
P Hz
Manual – IPOSplus® 83
kVA n Position Detection and Positioning
6 f
Cam controllers
i
Hz
P Hz
• 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?
• The drive waits at the positioning ramp; the actual position is displayed when the
axis stops. To continue positioning, the target position must be given a new value
(for example, change the increment value by 1 bit). Instead of using the
_AxisStop( AS_PSTOP ) command, use _AxisStop( AS_RSTOP ). In this case,
the target position would be stored when the H453.0 bits (ModuloCtrl variable and
TargetReset_Off bit) were activated.
INFORMATION
If the output bit of a cam is copied to a binary terminal output, the output is set 1 ms
later, as with all bits that are copied to outputs in IPOSplus®.
84 Manual – IPOSplus®
Position Detection and Positioning kVA n
Cam controllers
f 6
i
Hz
P Hz
Manual – IPOSplus® 85
kVA n Position Detection and Positioning
6 f
Cam controllers
i
Hz
P Hz
Data structure of
the standard cam
Variable Symbolic name of the Brief description
controller element in the SEW
standard structure
H+0 GSCAM.SourceVar Number of the reference variable for the cam calculation, typical
reference variables are:
• H511 (Actual position, motor encoder)
• H510 (Actual position, SSI encoder)
• H509 (Actual position, external encoder)
• H455 (Actual position, motor encoder in modulo format)
e.g. H+0 = 511 for reference size H511, bit 31 of the variable must
be 0!
H+1 GSCAM.DbPreCtrl Delay time compensation in 0.1 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 inter-
val.
H+2 GSCAM.DestVar Number of variables in which the output will be set or reset
H+3 GSCAM.BitPosition Position of the bit in variable H+2; if the cam output is assigned to a
unit output (e.g. H481), this binary output is to be reserved with
P620 – P639 as an IPOSplus® output.
H+4 GSCAM.BitValue Polarity of the output, 0 = bit set, if the reference variable H+0 has
been set within the position window H+6 to H+13 1 = bit set, if refer-
ence variable H+0 outside the position window H+6 to H+13
H+5 GSCAM.NumOfCam Number of the position windows defined in H+6 to H+13; the left
limit value must always be smaller than the right one. If a modulo
axis requires a position window that exceeds the 360° - 0° limit,
then this range will have to be divided into two position windows.
This process lets the operator set three related ranges for this out-
put.
H+6 GSCAM.PosL1 CCW limit value of the first position window.
H+7 GSCAM.PosR1 CW limit value of the first position window
H+8 GSCAM.PosL2 CCW limit value of the second position window
H+9 GSCAM.PosR2 CW limit value of the second position window
H+10 GSCAM.PosL3 CCW limit value of the third position window
H+11 GSCAM.PosR3 CW limit value of the third position window
H+12 GSCAM.PosL4 CCW limit value of the fourth position window
H+13 GSCAM.PosR4 CW limit value of the fourth position window
86 Manual – IPOSplus®
Position Detection and Positioning kVA n
Cam controllers
f 6
i
Hz
P Hz
t
1
H481.1
0
t
1
H481.2
0
t
477561867
Manual – IPOSplus® 87
kVA n Position Detection and Positioning
6 f
Cam controllers
i
Hz
P Hz
88 Manual – IPOSplus®
Position Detection and Positioning kVA n
Cam controllers
f 6
i
Hz
P Hz
Example solved in (The SET command is not necessary and serves demonstrative purposes only)
the Assembler
477809419
Manual – IPOSplus® 89
kVA n Position Detection and Positioning
6 f
Cam controllers
i
Hz
P Hz
• 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.
• All outputs can be stored contiguously from any bit of a variable.
• It is possible to set outputs, i.e. to fix their setting to 1 or 0 in the program.
• The reference value can be set, typical reference sizes are:
– H511 - Current actual position, motor encoder
– H510 - Current actual position, external encoder
– H509 - Current actual position, SSI absolute encoder (DIP11A option)
– H455 - Current actual position, motor encoder in modulo format
– H376 - Current actual position, master value (only for the technology functions
electronic cam or internal synchronous operation)
• You can stop the expanded cam function by calling up GETSYS with bit 31 = 0. This
step stops processing in the firmware and the function no longer requires any
processor capacity. If, however, the CamState is assigned 0x8000 0000, the cam
function will also be stopped but runs in the background without setting any outputs.
Data structure of The expanded cam function is configured with the help of two data structures, i.e. the
the expanded cam CamControl structure and the CamOutput structure.
control
• The CamControl structure controls the global behavior of the expanded cam
function.
• The CamOutput structure is used to define an output (output of the cam disk) and
may be required up to eight times.
90 Manual – IPOSplus®
Position Detection and Positioning kVA n
Cam controllers
f 6
i
Hz
P Hz
SEW standard
structure
Variable Name Description
GSCAM_EXT
H+0 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.
• 0x8000 0001 = function active, but all cam outputs will be turned off.
• 0x8000 0002 = function active, if drive is referenced (H473, Bit20
=1)
• 0x8000 0003 = function active even without referenced drive
H+1 CamReserved1 Reserved
H+2 CamOutShiftLeft Shifts the internal data buffer of the outputs by n digits to the left prior to
writing to the target variable H+6.
NOTICE: The shifting process will delete the information of the upper
outputs. This means that if the shift factor is 3, the upper 3 outputs with
4 ms cycle time are no longer available, and the 4 outputs with 1 ms
cycle time are assigned to bits 3 - 6 and the output with 4 ms cycle time
is assigned to bit 7.
H+3 CamForceOn Mask to force mandatory outputs. The mask takes effect on the internal
data buffer prior to shifting with H+2 (NOT on the target variable defined
with H+6)
H+4 CamForceOff Mask to force deletion of outputs. The mask takes effect on the internal
data buffer prior to shifting with H+2 (NOT on the target variable defined
with H+6)
CamForceOff dominates CamForceOn
H+5 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)
• 1 = encoder X14 (external encoder, H510)
• 2 = encoder H509 (absolute encoder DIP11A)
• 3 = virtual encoder
• all following values are reserved!
Bit 31= 1:
CamSource includes a pointer to one IPOSplus® variable +231
H+6 CamDestination Pointer to target variable.
The bits not used in the target variables are available for other functions
(if you shift the outputs by four to the left with Shift Left, it frees up bits
0-3, bits 4-7 are available for the cam functions and bits 8-31 are avail-
able for any assignment.
If the cam outputs are assigned to unit outputs (e.g. H481), you will
have to reserve these binary outputs with P620 - P639 as IPOS out-
puts. The bits not used in this word are available for other outputs.
H+7 CamOutputs Number of outputs (max. 8)
H+8 CamData 1 Pointer to first CamOutput structure (first output)
... ...
H+15 CamData 8 Pointer to last CamOutput structure (eighth output)
Manual – IPOSplus® 91
kVA n Position Detection and Positioning
6 f
Cam controllers
i
Hz
P Hz
Structure
CAM_EXT_OUT
Variable Name Description
H+0 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.
H+1 CamAreas Number of position windows for this channel (1 ... 4); the CCW limit
value must always be lower than the CW limit value. If a modulo axis
requires a position window that exceeds the 360° - 0° limit, then this
area will have to be divided into two position windows. This process lets
the operator set three related ranges for this output.
H+2 LeftLimit1 CCW limit, window 1
H+3 RightLimit1 CW limit, window 1
... ... ...
H+8 LeftLimit4 CCW limit, window 4
H+9 RightLimit4 CW limit, window 4
Function chart of
the expanded cam
CAM CONTROL
control
CamState == 3 CamForceOff Bit 2n
CamSource >=1
DRIVE REF CamForceOn Bit 2n
CAM_EXT_OUT 8 CamOutputs 8
CAM_EXT_OUT ... CamOutputs ...
CAM_EXT_OUT 2 CamOutputs 2
CAM_EXT_OUT 1 CamOutputs 1
DEAD TIME
LIMITS 1 ... 4 INT CAM 1 & >=1 & INT OUT 1
CamOut
ShiftLeft
Hxxx
477814283
92 Manual – IPOSplus®
Position Detection and Positioning kVA n
Cam controllers
f 6
i
Hz
P Hz
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° range of the stations.
(Comment: an active modulo function will resolve a full load rotation of 360° with 65536
increments see modulo function)
360°
65536 Inc 360°
355° 5°
64626 Inc 910 Inc
180°
0°
185° 175°
33678 Inc 31858 Inc
1
180°
32768 Inc 0
477818635
Manual – IPOSplus® 93
kVA n Position Detection and Positioning
6 f
Cam controllers
i
Hz
P Hz
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;
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
/*-------------------------------------
Initialization
--------------------------------------*/
MyCamControl.CamControl=0x80000002; // exp. function active
MyCamControl.CamOutShiftLeft=1;
MyCamControl.CamForceOn=//Mandatory activation of mask
MyCamControl.CamForceOff=0; // Mask: Mandatory deactivation of outputs
MyCamControl.CamSource=numof(ModActPos) ¦ (1<<31);
// Actual position value in modulo format
MyCamControl.CamDestination=481; // Basic unit outputs
MyCamControl.CamOutputs=1; // Number of cam discs (max. 8)
MyCamControl.CamDataStr0=numof(CamData0);
// Start of the cam structure 1 (output bit 0)
CamData0.DeadTime=0;
CamData0.CamAreas=3; // 3 cam ranges due to modulo overflow in the win-
dow
°°CamData0.LeftLimit1= 64626; °°°// 355° at load = 360° x 64626/65536
°°CamData0.RightLimit1= 65536; °°°// 360° at load
°°CamData0.LeftLimit2= 0; // 0° at load
CamData0.RightLimit2= 910; // 5° at load
CamData0.LeftLimit3= 31858; // 175° at load
CamData0.RightLimit3= 33678; // 185° at load
CamData0.LeftLimit4= 0; // not used
CamData0.RightLimit4= 0; // not used
_Go0( GO0_U_W_ZP );
_GetSys( MyCamControl.CamControl ,GS_CAM );
/*-------------------------------------
Main program loop
--------------------------------------*/
while(1)
{
}
}
94 Manual – IPOSplus®
Position Detection and Positioning kVA n
Cam controllers
f 6
i
Hz
P Hz
Example solved in
the Assembler
477835787
Manual – IPOSplus® 95
kVA n Position Detection via Binary Inputs
7 f
Types of built-in encoders
i
Hz
P Hz
EI76 X X
EI72
EI71
ES16 X
NV26 (proximity sensor) X
• You may also use a different encoder, but observe the following information:
INFORMATION
If the resolution is too high, the encoder might not be evaluated correctly at nominal
speed.
• Select an encoder with a resolution that suits the pulse frequency of the inverter.
• Observe the technical data of the built-in encoders in "Drive Engineering, Practical
Implementation – Encoder systems" and the technical data of the binary inputs
(counter input).
96 Manual – IPOSplus®
Position Detection via Binary Inputs kVA n
f 7
Position detection with MOVIDRIVE® B i
Hz
P Hz
Simple positioning with MOVIDRIVE® B requires the inverter to be in one of the following
operating modes:
• VFC (without feedback)
• V/f characteristic curve
Manual – IPOSplus® 97
kVA n Position Detection via Binary Inputs
7 f
i Position detection with MOVITRAC® B
Hz
P Hz
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.
Proceed as follows to use a built-in encoder:
1. Connect the encoder to the digital inputs of the MOVIDRIVE® B via terminals X13:3
(DI02) and X13:4 (DI03).
2. Set the following parameters (indexes):
• P601 binary inputs DI02 to "IPOS input" (Index 8336 to "16")
• P602 binary inputs DI03 to "IPOS input" (Index 8337 to "16")
3. Set index 8845 to "1" to activate the simple positioning.
The position is determined in the IPOS variable H511 (ActPos_Mot) and is always "0"
when the line voltage is switched on.
A reference travel can only be performed by an IPOSplus® program.
INFORMATION
If you intend to use an application module for positioning, refer to the "MOVITRAC® B
Simple Positioning Application Module" manual.
98 Manual – IPOSplus®
Position Detection via Binary Inputs kVA n
Position detection with MQx
f 7
i
Hz
P Hz
INFORMATION
Only one MOVIMOT® can be connected to the MQx fieldbus interface for proximity
sensor evaluation. Only the Movcom command can be used to control the
MOVIMOT®.
480483467
Manual – IPOSplus® 99
kVA n Position Detection via Binary Inputs
7 f
Position detection with MQx
i
Hz
P Hz
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" to activate the counter func-
tion. This setting switches off the input filter automatically. As a result, the input signal
for the counter must be fault-free and bounce-free. The value of the counter is written to
variable H511.
INFORMATION
If both the inputs DI0 and DI1 are set to "MQX ENCODER IN", the proximity sensor
evaluation is activated automatically and the counter function is switched off.
Connecting the To connect the NV26 built-in encoders (proximity sensors), refer to the "Drive System
NV26 proximity for Decentralized Installation – PROFIBUS Interfaces, Field Distributors" manual.
sensor
Two simple 4-pole, shielded sensor cables with plug and M12 socket are required for
connection. The cable connects the NV26 proximity sensors to DI0 and DI1 of the bus
module.
We recommend you use metal M12 plug and sockets and connect the shielding at both
ends.
MOVIMOT® MQ..
NV26
480466315
If the MQx interface counts the motor position in H511 in the wrong direction, the M12
plugs at inputs DI0 and DI1 must be exchanged.
Connecting the To connect the EI76 and ES16 built-in encoders, refer to the "Drive System for
EI76, ES16 incre- Decentralized Installation – PROFIBUS Interfaces, Field Distributors" manual.
mental encoder
477958795
INFORMATION
The double word with the actual position value that is sent from the drive to the PLC
in the example is always the position from H509 ... H511 of the encoder selected in
P941 Source actual position.
Example Six process data items with user-specific description should be transferred
(P870-877 = IPOS PI-DATA or IPOS PO_DATA). At output word 2, 3, the PLC transfers
the position setpoint to the drive, at input word 3, the drive sends the drives sends the
actual position in modulo format 1/10° (0.0° ... 360.0).
Compiler
#include <const.h>
// Process data data structures
GSPODATA10 tPA; //Output data (PLC -> Drive)
SSPIDATA10 tPE; //Input data (Drive -> PLC)
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
/*-------------------------------------
Initialization
--------------------------------------*/
// Initialize fieldbus variables for Getsys and Setsys commands
tPA.BusType = GS_BT_FBUS;
//Process data operation via fieldbus interface see above
tPA.Len = tPE.Len = 6; //PD length 6 words
/*-------------------------------------
Main program loop
--------------------------------------*/
while(1)
{
// Import PO data
_GetSys( tPA, GS_PODATA );
// Copy double word 2,3 to modulo target position
ModTagPos = (tPA.PO3 & 0xFFFF) + (tPA.PO2 & 0xFFFF)<<16; //PO2,PO3
// .....
//Regenerate process input data and send to PLC
tPE.PI3 = 3600* ModActPos/ 65536; //Actual position in 1/10 degree
at word 3
_SetSys( SS_PIDATA, tPE ); //Send PD
} //End while (1)
} // Ende main=========================================================
Assembler
SET H320 = 3
SET H332 = 6
SET H321 = 6
M1 :GETSYS H320 = PO-DATA
SET H300 = H324
AND H300 & FFFF hex
SET H301 = H323
AND H301 & FFFF hex
ADD H300 + H301
SHL H300 << 16
SET H354 = H300
SET H300 = 3600
MUL H300 * H355
DIV H300 / 65536
SET H335 = H300
SETSYS PI-DATA = H332
JMP UNCONDITIONED , M1
The DRS11 synchronous operation card allows for multiple axes to be operated at a
synchronous angle in relation to one another or with an adjustable proportional relation-
ship (electronic gear). The system differentiates between master and slave drives. The
master drive, used for positioning one or more slave drives, can also be an incremental
encoder. The slave drive(s) follow(s) the specified master positions.
The basis for synchronous operation is the continual comparison between master and
slave positions. The system determines the difference of the route information between
master and slave and stores this value in the form of incremental encoder signals in an
internal difference counter that cannot be accessed by the user. Binary signals, such as
"DRS SLAVE IN POS", "DRS LAG ERROR", "DRS PREWARNING" and "MASTER
STANDSTILL" are set depending on the basis of this difference. This counter is evalu-
ated depending on the operating mode. In synchronous operation, the internal differ-
ence counter is used to correct any angular offset between the slave and master to 0.
DRS is controlled using the variables H473, H476, H477 and H484 (see section "Over-
view of system variables"). The following section describes how the DRS can be ad-
dressed from the IPOSplus® program.
For more detailed information, refer to the "DRS11 Synchronous Operation Card" man-
ual.
1 INØ..5
2
3
4
5
6
X40
DCOM
7
8 V024
9 OUTØ..1
10
11 DGND
- 1
X44
LED 2
H476: DRS_CTRL. DC 24 V V 3
Sync / OFF +
Bit 31 ... 15 14 13 12 11 10 ... 0
Sync
OFF
5
9
X41
6
1
5
9
X42
6
1
5
9
X43
6
1
478829067
Requirement DRS11 can be switched to the free running mode using IPOSplus® via a cable connected
from terminal X40:9 (OUTP0) to X40:1 (free mode)
Command Set OUTP0 and thus DRS input "Free-running": in free-running mode, the red LED on
sequence in the DRS card is lit.
Assembler
BSET H476.0 = 1
Switch back to the synchronous operation function: The red LED does not light up in
synchronous operation mode.
BCLR H476.0 = 0
Write to BCLR H476.0.
Control example • The drive should be switched to Free running using input DI10. Inputs DI10 ... DI17
can be either physical terminals on DIO11A and DIP11A or virtual terminals in
fieldbus control word 2.
– DI10 = 1 Free running activated
– DI10 = 0 Free running mode deactivated; drive runs in synchronous operation
• The current angular offset is deleted via input DI11 (DRS Set zero point).
Sample program
with IPOSplus® /*==================================================================
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
/*----- Define control bits in IPOS control word ---------------*/
#define _DRS_Set zero point 22 // Bit 22
*===================================================================
Subprograms
==================================================================*/
Free running_On()
{
/* Free running is activated over the external jumper between X40:9 and X40:0
by setting the output X40:9. */
_BitSet( DRS_Ctrl, A_DRS_OUTP0 );
}
/*================================================================*/
Free running_Off()
{
/* Free running is deactivated over the external jumper between X40:9 and X40:0
by deleting the output X40:9. */
_BitSet( DRS_Ctrl, A_DRS_OUTP0 );
}
/*================================================================*/
DRS_Zero point()
{
_BitSet( ControlWord, _DRS_SetZeroPoint );
// Set zero point via control word
_Wait( 15 ); // Response time in ms
_BitClear( ControlWord, _DRS_Set zero point ); // Delete bit
}
/*==================================================================
Main function (IPOS initial function)
==================================================================*/
main()
{
if( E_Free running ) // E_FreeRunning input (here DI10)
Free running_On(); // Switches between
else // Free running and synchronous operation
°°Free running_Off();
1 INØ..5
2
3
4
5
6
X40
7 DCOM
8 V024
9 OUTØ..1
10
11 DGND
- 1
X44
2
DC 24 V V 3
+
Sync
OFF
5
9
X41
6
1
5
9
X42
6
1
5
9
X43
6
1
478833419
Output X40:10 is set using the BSET H476.1 command. A signal is sent to X40:2 via a
jumper from X40:10 to X40:2, and the "Offset" function is activated.
Requirement A position offset can be applied using IPOSplus® 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.
Assembler
BSET H476.1 = 1
Switch back to output terminal: The slave drive moves back to the previous position in
relation to the master.
BCLR H476.1 = 0
Write to BCLR H476.0.
In the following sample program, the system can switch between the operating modes
Synchronous operation and Positioning via input terminal DI12.
In this context, note the following condition:
INFORMATION
The system can only change from synchronous operation to positioning in the
operating modes CFC or SERVO when the drive is in operation.
For the VFC operating modes, MOVIDRIVE® must be in the status Controller inhibit.
The following sample program looks at a switchover between the operating modes CFC
& IPOS and CFC & SYNC with SETSYS.
The following settings apply (terminal function via the IPOSplus® program determines
the parameter settings for all used inputs at the IPOS input):
• DI10 = 0 no free-running
• DI10 = 1 Free running, if operating mode CFC & SYNC is set
• DI11 = 0 no function
• DI11 = 1 Set DRS zero point (pulse)
• DI12 = 1 Positioning, operating mode CFC & IPOS
• DI12 = 0 Synchronous operation, operating mode CFC & SYNC
/*====================================================================
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
// DI 12 = 1 Positioning /
// DI 12 = 0 Synchronous operation
/*----- Define outputs -------------------------------------*/
#define A_DRS_OUTP0 0 // Output DRS X40:9
/*----- Define control bits in IPOS control word ---------------*/
#define _Free running 1 // Bit 1
#define _DRS_Set zero point 22 // Bit 22
/*----- Define variables to switch between
/*----- Positioning and synchronous operation ---*/
#define operating mode H300
#define target position H0
#define CFC_and_IPOS 13 // Operating mode CFC & IPOS
#define CFC_and_SYNC 14 // Operating mode CFC & synchronous operation
/*==================================================================
Subprograms
==================================================================*/
Free running_On()
{
/* Free running is activated over the external jumper between X40:9 and X40:0
by setting the output X40:9. */
_BitSet( DRS_Ctrl, A_DRS_OUTP0 );
}
/*================================================================*/
Free running_Off()
{
/* Free running is deactivated over the external jumper between X40:9 and X40:0
by deleting the output X40:9. */
_BitSet( DRS_Ctrl, A_DRS_OUTP0 );
}
/*================================================================*/
DRS_Zero point()
{
_BitSet( ControlWord, _DRS_SetZeroPoint );
// Set zero point via control word
_Wait( 15 ); // Response time in ms
_BitClear( ControlWord, _DRS_Set zero point ); // Delete bit
}
/*=================================================================*/
Activate_synchronous operation()
{
Operating mode = CFC_and_SYNC;
_SetSys( SS_OPMODE,operating mode ); // Switch operating mode
DRS_zero point(); Delete quadrantal error
}
/*=================================================================*/
Activate_IPOS()
{
Operating mode = CFC_and_IPOS;
_SetSys( SS_OPMODE,operating mode );
}
/*===================================================================
Main function (IPOS initial function)
===================================================================*/
main()
{
if( E_Free running )
°°Free running_On();
else
°°Free running_Off();
if( E_Set zero point )
°°DRS_Zero point();
if( E_Switch_Pos_Sync )
{
Activate_IPOS();
_GoAbs( GO_NOWAIT,target position );
}
else if( !E_Free running )
Activate_synchronous operation();
}
9.4.1 Requirements
Synchronous operation has been designed for MOVIDRIVE® and places the following
requirements on the drive system:
• Encoder feedback
• DRS option cards not supported
• Operating mode: not V/f
• IPOSplus® 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)".
• Synchronous operation is controlled using IPOSplus® variables within an IPOSplus®
program. All states of synchronous operation can be viewed and set in the variable
range for synchronous operation from H360 to H450.
• ISYNC startup is supported by a graphical user interface.
• Slave is not subject to slip (only with MOVIDRIVE® A).
For more detailed information, refer to the "Internal Synchronous Operation (ISYNC)"
manual.
Slave
cycle
Master length
478837771
9.5.1 Requirements
The electronic cam option places the following requirements on the drive system:
• Encoder feedback
• Operating mode: "CFC" or "Servo" ... & IPOS
• IPOSplus® 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").
• Synchronous operation is controlled using IPOSplus® variables within an IPOSplus®
program. All states of the electronic cam can be viewed and set in the variable range
for synchronous operation from H370 to H450.
For more detailed information, refer to the Addendum to the "Electronic Cam" system
manual.
INFORMATION
If the movement plan contains a constant incline, phase-synchronous operation oc-
curs as a special case in the electronic cam.
769774603
10.2 Functionality
In general, MOVITRAC® B IPOSplus® 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® B
• The size of the IPOS program memory is 8kB, which is only 50% of the MOVIDRIVE®
B IPOSplus® program memory of 16 kB.
• Task 3 must not be used. The program code programmed in task 3 is not executed.
No feedback is given on this.
• Unsupported functions cause error 10 IPOS ILLOP.
The IPOS Compiler is not aware of these differences, i.e. the complete MOVIDRIVE®
B functionality is provided.
480461579
The MQx digital inputs can be read using the H483 InputLevel variable. DI4 and DI5 are
only available with MQx32. To be able to use the inputs as IPOSplus® inputs, you must
set them to IPOSplus® Input in parameter group 62.
H483
... 5 4 3 2 1 0
(DI5) (DI4) DI3 DI2 DI1 DI0
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
the IPOSplus® program.
An internal error number is sent to the diagnostic variable H469 (DIAG11) for detailed
error analysis. Every error that can occur is assigned its own error number. 999 means
that the function or an argument of the function is not supported by the MQx module.
The following error numbers can occur when using the MOVLNK and MOVCOM com-
mands.
DIAG11 Command Cause of error
500 MOVLNK MOVLNK command was called after cyclical communication was
started. MOVLINK is locked by the _MovCommOn command.
501 MOVLNK Number of variable H, from where the read data is stored or from
where the data to be written is obtained, does not lie in the valid
range (H0 ... H450).
502 MOVLNK Bus type is invalid. Only 2 = RS-485#2 permitted.
503 MOVLNK An invalid PDU type was entered in format. Only acyclical frames
(128 ... 134) are permitted.
504 MOVCOM _MovCommDef command was called after cyclical communication
was started. _MovCommDef is locked by MovComOn.
505 MOVCOM _MovCommDef command was called for the 9th time. Only 8 com-
munication relations are permitted.
506 MOVCOM Bus type is invalid. Only 2 = RS-485#2 permitted.
507 MOVCOM An invalid station address has been entered. Addresses 253 and
254 are not permitted (0 -252, 255).
508 MOVCOM An invalid PDU type was entered in format. Only cyclical frames are
permitted (0-6).
509 MOVCOM Number of variable H, from where the read data is stored or from
where the data to be written is obtained, does not lie in the valid
range (H0 ... H450).
511 MOVCOM Station does not support the PDU type entered in format.
The speeds of the travel movements required on the basis of the reference travel type
are set using P901 Reference speed 1 (page 124) and P902 Reference speed 2
(page 124).
Display range: Number of increments between leaving the reference cam and reaching
the zero pulse of the encoder set in P941.
The value is displayed after the reference travel. Ideally, it should be half the encoder
resolution (after quadruple evaluation). Relocate the cam if necessary.
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® or
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.
INFORMATION
P302 Maximum speed 1 / P312 Maximum speed 2 limits P913/P914; set P302 Maxi-
mum speed 1 / P312 Maximum speed 2 to a value (ca. 10%) greater than P913/P914
to prevent lag errors
INFORMATION
Parameter P915 is only in effect with the LINEAR and JERK LIMITED ramp types. The
function has no effect for the ramp types "SINE" and "SQUARED".
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":
• SPEED INTERPOLATION
• POSITION INTERPOLATION 12 BIT
• POSITION INTERPOLATION 16 BIT
POSITION INTERPOLATION The position specifications sent cyclically by the external controller are
16 BIT interpolated. Position resolution: 1 revolution corresponds to 65536
increments (16 bit).
• Position specification using process data:
– Set P888 Synchronization time SBus to 5 ms or 10 ms
– Set P100 Setpoint source to "SBus" or "Fieldbus"
– Set one process output data word to "position HIGH" and
another one to "position LOW".
Important: Position resolution via PI data assignment is 4096
increments per revolution (= 12 bit).
IPOSplus® variable H508 provides the motor position, extended
to 16 bits.
The IPOSplus® variable ActPos_Mot (H511) has a position reso-
lution of 4096 increments per revolution (= 12 bit)
INFORMATION
Note the following for the POSITION "INTERPOLATION 16 BIT" ramp type:
• IPOS variable H508 is also used when S14 is set to ON.
IPOS variable H508 only provides meaningful values when
– DIP switch S14 = "ON" or
– P916 Ramp type = "Position interpolation 16 bit"
INFORMATION
If P948 is switched off and on again, the "IPOS referenced" bit is set to "0" once you
have restarted the MOVIDRIVE®.
Reference travel is necessary to rest the "IPOS referenced" bit to "1".
13 Compiler – Editor
13.1 Technical features
• Integrated IPOSplus® positioning and sequence control. IPOSplus® 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
• Clear, modular and structured programming
• Various loop techniques
• Compiler control using preprocessor commands
• Standard structures
• User-defined structures
• Access to all system variables
• Standard functions
• Debugger for troubleshooting
• Extensive options for making comments
• Integrated in the Windows interface
• Integrated in the MOVITOOLS® MotionStudio software package
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
MOVITOOLS® MotionStudio documentation (manual or online help).
2. Scan your network (unit scan). Press the [Start network scan] button [1] in the tool-
bar.
[1]
1132720523
Starting Proceed as follows to start the IPOSplus® Compiler via MOVITOOLS® MotionStudio:
IPOSplus®
1. Mark the device you want to start the IPOSplus® Compiler for.
Compiler
2. Right-click to open the context menu.
3. Start the IPOSplus® Compiler via the following menu item:
[Programming] / [IPOS Compiler] /
2123686283
[1]
[2]
[3]
[4]
[5]
482065675
482580363
The first line contains the name of the project. Give your project a unique name that you
will recognize again in the future.
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" box. The project file is then stored in the subfolder.
The fourth line specifies the directory in which the Compiler is to search for the files.
These files are added to the source text files using an #include statement. The directory
created during the installation is entered here as a default, for example: c:\pro-
gramme\sew\movitools\projects\include.
Lines 5 and 6 specify the directories in which the MDX file (file with the IPOSplus® pro-
gram) and the list file (file with additional program information) are to be created. These
files are only created if you have checked the appropriate boxes under [Extras]/
[Settings]/[Compiler].
Once you have confirmed your entries by clicking [OK], the Compiler performs the fol-
lowing steps:
• It creates the folder Total in the specified directory (only if you selected the option
"Create project subfolder").
• It creates a project file with the name Total.icp in the Total folder.
• It closes the dialog box.
The project now appears as a hierarchical tree in the project window of the program win-
dow:
482803339
The next step is to create a new source text file and add it to the project. To do so,
choose [File]/[New]/[Source file...].
Confirm this dialog box with [Yes]. A new source file is added to the project. You are now
asked to enter a name for the new source file. Enter the name summe.ipc.
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. The source file now has the following content:
/*=============================================
IPOS source file
===============================================*/
#include <constb.h>
#include <iob.h>
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
/*-------------------------------------
Initialization
--------------------------------------*/
/*-------------------------------------
Main program loop
--------------------------------------*/
while(1)
{
}
The #include <constb.h> command for MOVIDRIVE® B inserts the header file,
which defines the arguments for all the system functions.
The #include <iob.h> command for MOVIDRIVE® B inserts a file containing the
definitions of the digital inputs and outputs. These constants and definitions can be ac-
cessed directly during programming.
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]. Close
the program by choosing [File]/[Exit].
Editing the Start the Compiler again. This time, the project and the summe.ipc file are loaded au-
IPOSplus® program tomatically as they were open when you exited the program.
To get to know all further functions of the IPOSplus® Compiler, you will now write a pro-
gram that adds together all the numbers from 1 to 100.
Rather than using the formula (n+1)×(n/2) for this, you should program a loop that adds
up the total by iteration.
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.
Syntax highlighting is used so that words with different meanings are shown in different
colors to give you a better overview. For example, all names that the Compiler recog-
nizes (key words) are shown in yellow. The system functions provided by the unit are
highlighted in blue.
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-
defined structures. When you select a system function, you have to enter the arguments
of this function in the group box to the right of the window. Use [Add] to insert the rele-
vant command to the position where you have placed the cursor in the source text.
To insert the _Wait function, you must first select the _Wait function in the list of system
functions. The right-hand side of the window displays the arguments relating to the cor-
responding function. For our example, enter the value 5000 (stands for 5000 ms).
If you require additional information on a C construction or a system function, simply se-
lect the term in question in one of the two lists and press the <F1 key> or the [Help] but-
ton.
You can activate the help function from the source text by placing the cursor on the key
word _Wait and pressing the <F1> key.
INFORMATION
The Compiler is case sensitive, which means that there could be 2 different variables
for MYVAR and myvar.
Compiling the pro- To generate a program in a form that the inverter can understand, the project must be
gram compiled. To do so, press the icon or choose [Project]/[Compile].
Message window displayed after compilation
483686539
The message window displayed above appears after the project has been compiled. If
the program does not contain any errors, it is assigned the status OK. The size of the
program is also important. It is specified as the length of the code words used in Assem-
bler code. This absolute number is also converted to a percentage that specifies how
much memory space is used in IPOSplus®.
The compilation process was successful for our program. The program is 29 IPOS
words in size; that is, it takes up 0.4 percent of the entire IPOSplus® memory capacity.
Close the window by choosing [OK].
Error messages As syntax errors can occur during programming, an error reporting system has been in-
during compilation tegrated in the IPOSplus® 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.
Observe the following example..
Change the FOR loop as follows:
while(1)
{
for (H1 = 0; H1 <= 100)
{
°°// Calculate sum
H2 = H2 + H1;
// Wait 5 s
_Wait( 5000 );
}
}
In this example, the third argument of the FOR loop is missing. When you compile the
system using the icon, the following message appears:
Error message during compilation
483692427
The status ERROR is output as an error has occurred. The line, error classification and
the error code are also displayed. Furthermore, the program line in the source file con-
taining the error is highlighted with a red bar.
Click the [OK] button and then rectify the error. The compilation process must be re-
peated again once you have rectified the error.
Rectify the error by correcting the FOR loop as follows:
while(1)
{
for (H1 = 0; H1 <= 100;H1++)
{
°°// Calculate sum
H2 = H2 + H1;
// Wait 5 s
_Wait( 5000 );
}
}
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.
The first program line in the "Main" function is marked with a light blue bar once the pro-
gram has been downloaded successfully. You can now start the program.
Starting and stop- You can start the program by clicking the icon. The program now runs in
ping the program MOVIDRIVE® and the START status is displayed in the toolbar.
Status START
483713291
At the same time, the light blue bar in the program is deleted.
You can see that the program is being processed. In this small test program, the variable
H2 is incremented in steps of 5 s.
To see this, open the variable window by choosing [Display]/[All Variables]. You can now
observe the variable H2.
Now we want to stop the program. This is done by pressing the icon . After this, the
first program line in the "Main" function is marked with a light blue bar.
483719691
In the Editor settings, you can select the colors for the background and the text. In the
same way, settings can be made for the syntax highlighting colors, for displaying the
syntax of instructions and keywords in color.
In addition, the following settings can be made:
• Color syntax display: Activate and deactivate the syntax highlighting for instructions
and key words.
• Automatic indent: The cursor is indented automatically in line with the first character
of the previous line when you change to a new line by pressing the Enter key.
• Persistent blocks: Selected blocks remain marked until a new selection is made. If
this option is deactivated, the text block selection mark disappears when the cursor
is moved. Pressing a key causes the selected block to be replaced.
• Tab size: Number of characters by which the cursor is indented when the Tab key is
pressed.
• Font : Select the font by clicking the [Change...] button.
• Show debug tooltip: If the [Show debug tooltip] option is activated, the content of
variables is displayed directly in the Editor window when the cursor is placed on the
required variable.
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.
• Generate List File (*.LST): A list file is generated and saved during the compiling
process. It contains information on resource utilization and the program sequence.
• Save automatically before compiling: If this checkbox is selected, the source code is
saved automatically before the start of each compiling process.
• Do not test recursive function calls: If this checkbox is not selected, the Compiler
reports an error when it detects a recursive function call. If you want to permit
recursive function calls, you can deselect this checkbox. The Compiler only issues a
warning message.
• Download only possible in the status "No enable": If this checkbox is selected, an
IPOSplus® program can only be downloaded to the inverter when it has the status "No
enable".
INFORMATION
Uploaded programs created by the Compiler can be opened but not processed with
the Assembler.
Directory settings:
483837963
483839499
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".
484333835
Click the [Find Next] button to search for the next occurrence of the word in question.
Click [Cancel] to close the window again.
The same functionality is also available for the [Replace...] function in the [Search] menu
item in the menu bar.
[Replace] window:
484363787
The [Find Next] button can be used to search for the corresponding word, which can
then be replaced with another word using the [Replace] function. Click the [Replace All]
button to replace all strings matching the search term. Click [Cancel] to close this win-
dow.
[1]
[2]
[3]
[4]
[5]
[6]
484369163
Once you have confirmed your entries by pressing the [OK] button, the newly-created
project appears in the tree structure in the project window.
The root node is the project name. The nodes Source file(s) and Documents are
listed below the root node. The source modules (*.IPC files) are listed below the source
file(s).
All the source modules contained therein are compiled to form an IPOSplus® program.
Under the Documents node, you can attach any files required for documentation (for
example, Word documents) (right mouse click: "Add document to the project"). All files
in this node are excluded from the compilation process.
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.
Defining the program structure
484387339
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
The IPOSplus® Compiler is case sensitive, which means that there could be 2 different
variables for MYVAR and myvar.
"ß" is not permitted.
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. The following dialog box appears.
484398091
The file type is preset to *.ipc. Files with the ending *.ipc indicate source files. Header
files with the ending *.h can also be selected and assigned to the project.
When a file is selected, it appears under the source file(s) root node and is assigned to
the project.
Documentation (documentation for the individual drive if it is not stored in the com-
plete documentation)
Documentation (documentation for the individual drive if it is not stored in the com-
plete documentation)
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. Documentation
and source texts can be located quickly, making it easy to keep an overview. This facil-
itates easy maintenance of the software and the overall system.
The folders and subfolders can be created in the project management.
INFORMATION
Downloading the project data does not automatically download the compiled
IPOSplus® program.
484532491
You can enter the name of the project folder in a dialog box. Select a target directory via
the [Browse] button.
If a project file with the same name already exists in the directory, the system asks
whether it should overwrite this file.
If there is no project data in the inverter, the process is canceled.
484538891
484635147
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 Key Description
Execute to cur- <F4> Program is only processed up to the current cursor position.
sor
Single step <F7> The program line highlighted by the cursor is processed. If a function is
called, the program branches into this function.
Skip <F8> If the program lines highlighted by the cursor contain a function call,
the system does not branch to the function and the program line is
skipped.
Click the icon in the tool bar, function key F5 or the [Stop] menu command from the
[Run] menu in the menu bar can be used to stop and reset the program at any time dur-
ing debugging.
Click the icon in the tool bar, function key F9 or the [Start] menu command from the
[Run] menu in the menu bar can be used to start the program from the current cursor
position at any time during debugging.
While the program is running, you can interrupt it by pressing the Alt+F5 key combina-
tion or choosing [Run]/[Break]. The execution bar is now positioned at the command that
is to be executed next.
The program can also be interrupted by pressing the F4 key or choosing [Goto Cursor].
The program is stopped in the command line in which the cursor is positioned.
485381387
All variables can be observed in the variable window using the scroll bar.
Another way to observe variables is to set up a watch window. Only selected variables
are displayed in the watch window. The fewer variables displayed at the same time, the
faster an individual value can be updated.
INFORMATION
The IPOS variables contained in the data backup of the device can also be displayed
in offline mode.
The non-volatile variables are displayed with their permanently stored value. The vol-
atile changes by the program code are not stored in the backup.
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. The selected variables
are displayed in a list to the right of the window. To remove a variable from the watch
window, you must highlight it in the list and press [Remove].
Displaying the selected variable:
485597579
The window looks the same as the complete variable window, but it only contains the
selected variables.
Variables can have symbolic identifiers assigned to them because standard variable
names (e.g. H1, H2, etc.) are hard to follow in big programs. These identifiers are also
displayed at this point.
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.
Changing the variable format:
485601931
Individual variables can also occur several times in the watch window. In this way, a vari-
able can be displayed in various formats at the same time.
485608587
This program information refers to the program stored in the inverter. The size of the pro-
gram, creation date and name of the source file are displayed in this window. Click the
[Open File] button to display the source code for the program in the inverter in an Editor
window. This assumes that the name of the source file has not been changed and can
be located in the path that was used to transfer the program to the inverter.
485614475
You can use the insert tool to add C-constructions, system functions or predefined struc-
tures to the source text.
If you mark a C-construction or a standard structure, the text that will be inserted in the
source text appears in the lower section of the window. If you want to insert a system
function, you must also enter arguments of the function in the right-hand side of the win-
dow. Click the [Add] button to insert the selected function in the text where the cursor
was positioned when you called the insert tool.
An initialization section is added to the defined structure variable if you click [Initializing
Sequence]. To do so, the program must have been compiled at least once.
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 '*/'. A one line comment starts with '//' and does not need an end mark. A single line
comment can also be entered directly after a command line in the source text.
Comments
486824075
File → compare with inverter Compares source file with the program in the inverter
Program → compare with inverter Compares project with the program in the inverter
14 Compiler – Programming
The source text of a program written with the IPOSplus® 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: Source code program struc-
ture
********************************************/ Program header with pre-processor state-
*/=========================================== ments and, if necessary, definition of the
IPOS Source File variable
===========================================*/
#include <const.h>
#include <io.h>
/*===========================================
Main Function (IPOS Entry Function)
===========================================*/ The main function contains the initializa-
main() tion part and the endless loop for task 1
{
/*-------------------------------------
Initialization
--------------------------------------*/
// activate task 2 Initialization part
_SetTask2(T2_START, Monitor); // testing
/*-------------------------------------
Main Loop
--------------------------------------*/
Endless loop for task 1
while(1)
{
}
}
/*===========================================
Task2
===========================================*/ Task 2, endless loop is not required
Monitor()
{
}
/*===========================================
User function
===========================================*/
Reference_travel() Functions (subprograms) created by the
user, called up from task 1 and task2
{
}
Automatic_mode()
{
}
Manual_mode()
{
}
14.1 Preprocessor
The IPOSplus® 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. The preprocessor increases flexibility and productivity during programming in
the following areas:
• Integration of text from other files (header files) which contain prepared and/or user-
defined constants or source text functions.
• Definition of symbolic identifiers to improve the legibility of the source text.
• Definition of directives for conditional compiling to improve portability and simplify
test phases.
Each line starting with a # is treated as a preprocessor directive, unless the # is part of
a comment. Any blanks before or after the # character are ignored.
Preprocessor directives are generally written at the start of the source text. They can,
however, be located anywhere in the program. Depending on the function of the direc-
tives, they either apply as of the source text line in which they are located or for the entire
program regardless of their location.
#ifndef _CONST_H
#define _CONST_H
.
.
.
#define Scope474 H474
#define Scope475 H475
#define DRS_Ctrl H476
#define DRS_Status H477
#define AnaOutIPOS2 H478
#define AnaOutpIPOS H479
#define OptOutpIPOS H480
#define StdOutpIPOS H481
#define OutputLevel H482
#define InputLevel H483
#define ControlWord H484
#endif
The actual structure of the header file starts with '#ifndef _CONST_H' after a general re-
mark section. This "#ifndef" instruction is at least always accompanied by an '#endif'.
You can find this '#endif' instruction in the last program line of the header file. The task
of this '#ifndef' and '#endif' construction is to prevent the file being linked more than
once.
The statements within this construction are only performed if a macro identifier, here
‘_CONST_H’, has not yet been defined (ifnot defined). A '#define _CONST_H' is posi-
tioned in the next line of the program to define this macro identifier. Therefore, if the
header file is processed during compilation by the '#include <const.h>' command, the
'#ifndef _CONST_H' query is initially answered in the affirmative because the
"_CONST_H" macro identifier has not yet been encountered. It is then identified imme-
diately with '#define _CONST_H'. Then, if the 'const.h' header file is linked elsewhere in
the program, the '_CONST_H' macro identifier has already been identified and the '#if-
ndef _CONST_H' query is answered in the negative. As a result, processing immedi-
ately jumps to the "#endif" statement. This prevents the file from being incorporated un-
necessarily more than once, which would lead to an error message.
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" or "#ifndef" query is not fulfilled. This results in the following possibilities:
#ifdef identifier_1 #ifndef identifier_2 #ifdef identifier_3
Program text_1 Program text_3 Program text_5
#else #else #endif
Program text_2 Program text_4
#endif #endif
Note that these preprocessor statements can also be used to good effect in the main
program, not just in header files. As a result, for example, parts of a program can be con-
verted specifically for a machine without having to make major changes to the source
text.
14.3 #include
This directive makes it possible to incorporate source texts from other files (header files)
into the source text file. Header files are usually used to define constants or macros that
are used several times so they are available in different projects. The syntax is:
#include <FileName>
FileName is the complete name of the file that is to be incorporated. It is enclosed by
pointed brackets. It is sufficient to state the file name without path information if the file
to be incorporated is located in the current folder
The file BEISPIEL.IPC contains the main program. The file CONST.H is a header file.
#include <CONST.H> #define MAXIMUM_SPEED 3000
H10 = MAXIMUM_SPEED;
The preprocessor replaces the #include directive with the
content of the CONST.H file:
#define MAXIMUM_SPEED 3000
H10 = MAXIMUM_SPEED
The result after macro expansion is as follows:
H10 = 3000;
The #include directives can also be used in nested structures, i.e. an included file can
itself contain an #include directive to include another file. Ensure that files do not set up
an include loop (they include themselves). This leads to a preprocessor error. We rec-
ommend avoiding nesting #include directives to keep the structure clearer.
INFORMATION
The system searches through the paths in the following sequence if all three methods
are mixed:
1. Direct path assignment in the #include statement (method 3)
2. Path assignment relative to the source file (method 2)
3. Path assignment in the #include directive of the settings dialog box.
14.5 #define
The '#define' directive was previously used for identifying a Macro identifier. However,
the basic function of the '#define' directive is to define a macro. Macros are used to re-
place symbols in the source text by strings. This mechanism makes it possible to formu-
late constants, variables, etc. symbolically. The Compiler only supports macros without
parameters. The syntax is:
#define MacroIdentifier <SymbolSequence>
Each occurrence of a "MacroIdentifier" in the source text following this directive is re-
placed by "SymbolSequence" (which may be empty). The MacroIdentifier is defined if
the SymbolSequence is empty; it does not have any other function. The symbol se-
quence must not exceed 75 characters.
In this way, a symbolic notation is assigned to the system variables in the header file.
Therefore, for example, variable H474 can be addressed using the symbolic name
'Scope474' or variable H484 using 'ControlWord' once the const.h header file has been
incorporated.
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.
The following example illustrates this point:
#define setpoint H123
#define maximum 2000
setpoint = maximum; // in this line the macro def. "setpoint" and "maxi-
mum"
// are replaced, meaning: H123 = 2000;
After each macro expansion, the resulting text is examined again. This makes it possible
to use nested macros.
#define setpoint H10
#define variable1 setpoint
#define minimum 20+H11
variable1 = minimum; // in this line the macro definition "variable1" is
// replaced by "setpoint", then "setpoint" is replaced by
// "H10", meaning: H10=20+H11;
INFORMATION
Ensure that a variable identified with #define has not been assigned two system vari-
ables by mistake.
INFORMATION
The compilation process cannot detect whether a variable is defined with the same
name as a structure. The inverter generates the error 10 IPOS-ILLOP.
Example:
#define position H2VARINT position;
14.6 #undef
This directive makes it possible to deactivate a macro that was previously created using
'#define...':
Syntax: #undef MacroIdentifier
493925131
14.7 #declare
This directive allows IPOSplus® 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.
In this way, it is easier to integrate preconfigured modules into your own source text pro-
vided that these modules have relative variable numbers.
Syntax: #declare IdentifierNew IdentifierOld : Offset
The following example illustrates this function:
#define basevariable H100
The following variables are now available as symbolic variables: setpoint, actual value
and i. Furthermore, it also specifies that the IPOSplus® variables H100, H101 and H105
are assigned.
INFORMATION
A maximum of 600 #define and #declare directives can be used.
INFORMATION
The task of integrating modules is made easier by forming variable blocks using de-
clare directives. However, this remains quite difficult to handle because the user
needs to have an overview of which variables have been occupied and which are still
available. As a result, it is a good idea to use structures, SEW standard structures or
user-defined structures particularly when a fixed sequence of variables has to be pro-
vided (e.g. SETSYS, GETSYS, MOVLNK, and so on). All other variables should be
declared with the keywords long or initial long as described below since this leaves the
task of assigning variable numbers up to the Compiler.
These standard structures are used as follows. First, a variable is declared as the struc-
ture variable in the declaration part. Then the elements of the structure are addressed
as explained in the following example. The structure is addressed within the command
by using the name of the structure variable without additions.
// Declare
SSPOSSPEED rapid speed, slow speed;
// Initiate
rapid_speed.cw = 14000; // rapid speed cw 1400 rpm
rapid_speed.ccw = 12500; // rapid speed ccw 1250 rpm
slow_speed.cw = 3000; // slow speed cw 300 rpm
slow_speed.ccw = 4500; // slow speed ccw 450 rpm
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. A context menu opens: Choose the menu item [Insert Instruction].
You can also call up the insert tool by pressing the icon in the toolbar or by choosing
[Edit]/[Insert Instruction] from the menu bar. Select the predefined structure and change
the name of the variable in the editing window of the input help. If several structure vari-
ables are declared from the same structure type, separate them with a comma.
Once all structure variables have been declared they must be initialized depending on
the specific application. The insert tool can also be used for this process. Place the cur-
sor in the Editor window at the place where the initialization sequence should be added.
Compile the program and then call the insert tool. Press [Initializing Sequence]. An ini-
tialization block is created for each structure variable that has been declared.
Inserting an instruction:
493929483
This creates a structure with the name table. You can now use this structure as ex-
plained for the standard structures. The next step is to declare a variable as the structure
variable.
// Declare structuretable postable;
Now the variable PosTable has been declared as a structure variable of the structure
type table. The next step is to access the elements. The table must be initialized to do
so.
// Initiate
postable.pos1 = 100000;
postable.pos2 = 120000;
postable.pos3 = 50000;
postable.pos4 = 200000;
postable.pos5 = 10000;
The following is a general description of the procedure for setting up a user structure:
typedef struct
{
Type Identifier1;
Type Identifier2;
...
Type IdentifierN;
} Structure name;
StructureName VariableName;
VariableName.Identifier1 = ...;
VariableName.Identifier2 = ...;
VariableName.IdentifierN = ...;
The insert tool can also be used for user-defined structures. To do so, from the Pre-de-
fined Structures window of the insert help choose ’typedef struct (user defined)’. Now
you can change the name of the elements and the structure.
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. Once the entries have been compiled, an initialization sequence can be activated
using the insert tool. Before doing so, the cursor must be positioned in the Editor at the
place where the initialization sequence is to be inserted.
Structures:
493933835
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. The following
example shows how to use the key word.
The syntax of a declaration of one or more global variables is as follows:
long Identifier1 [, Identifier n] ;
Example:
long setpoint,actual_value;
During compilation, the symbolic variables setpoint and actual value are assigned an
IPOSplus® variable. The user always accesses the variable by using the symbolic name.
INFORMATION
The legibility of the program text is significantly enhanced if all constants are written
in capitals (e.g. SECOND, MAXIMUM, etc.) and variables are written in upper/lower
case (e.g. SpeedSetpoint, PositionCW, etc.).
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 ...
INFORMATION
Since the variable range H360 to H450 for the technology options "Synchronous" op-
eration and "Cam Disk" is assigned other system variables, we recommend that you
always assign the auxiliary and global variables with the #pragma directive in a differ-
ent range.
Example:
#pragma var 350 365
#pragma globals 130 160
#pragma initials 10 30
These lines cause the Compiler to use the IPOSplus® variables from H350 onwards as
auxiliary variables. The variables PosSpeedCW and PosSpeedCCW that are declared
with the 'long' key word are now stored in the IPOSplus® variables between H130 and
H160 because of the #pragma globals 130 160 command line. The variables StartPosi-
tion and EndPosition that are declared with the 'initial long' key word are now stored in
the IPOSplus® variables between H10 and H30 because of the #pragma initials 10 30
command line. Since they are therefore also in the variable range from H0 to H127,
these variables can also be stored in the non-volatile memory.
INFORMATION
The variable numbers are used without the preceding letter H when they are used
within the #pragma directives.
#ifndef _IO_H
#define _IO_H
#endif
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; // execute command block, if terminal DI00 has level 0
}
The if statement queries terminal DI00, the /CONTROLLER INHIBIT terminal. If the ar-
gument of the if statement is zero, then the statements in the else part are processed
(assuming there is an else part). In this case, IPOSplus® variable H1 is set to zero or one
depending on the input level of terminal DI00. Note that it is impossible to query when
the terminal is set to 1 (DI00 == 1) because the macro supplies a binary evaluation. In
practical terms, it is possible to query for zero (DI00 == 0) or not equal to zero (DI00 != 0).
This program extract can be made clearer using the commands which have already
been explained. This is done by introducing additional symbolic identifiers.
#define controller_inhibit H1
#define HI 1
#define LO 0
if( DI00 )
{
controller_inhibit = 1; // execute command block, if terminal DI00 has NOT
//level 0
}
else
{
controller_inhibit = 0; // execute command block, if terminal DI00 has
//level 0
}
499400587
INFORMATION
Note that the io.h header file must be linked using the #include io.h command line be-
fore it can be used.
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.
An identifier can be up to 32 characters in length.
The following identifiers are valid: The following names are not identifiers:
TerminalX13_4 TerminalX13.4
Setpoint1 Setpoint 1
_Control_word 1st setpoint
1_Input
My function
ThisIdentifierNameIsMuchTooLong
INFORMATION
The IPOSplus® Compiler is case-sensitive.
14.15 Constants
The IPOSplus® Compiler supports various types of constants which are differentiated in
the source text by their specific notation. Representation in different formats can im-
prove the legibility of the source text depending on how they are used.
The formats decimal, hexadecimal or binary are possible forms of representation.
Hexadecimal constants start with the '0x' string, binary constants with the '0b' string.
Here are a few examples:
Decimal constants Hexadecimal constants Binary constants
123 0x23 =35 dec 0b000100 = 4 dec
-50 0xabc = 2748 dec 0b10 = 2 dec
030 0xFFFFFFFF = -1 dec 0b11111111 = 255 dec
To identify variables symbolically, the #define or #declare directives can be used to de-
fine a symbolic name.
14.16.1 Example
#define TESTVAR1 H73 //H73 has the symbolic name "TESTVAR1"
H73 is then assigned the value 134 in the program from one of 3 assignments:
TESTVAR1 = 134;
TESTVAR1 = 0x86;
TESTVAR1 = 0b10000110;
Examples:
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. This is usually the case because the vari-
ables are accessed continually by symbols. Furthermore, global variable declaration un-
derlines the modularity and makes it easier to reuse modules. Standard or user-defined
structures can be used as a recourse if variable groups are required, e.g. for system
functions.
For a description of the system variables H473 to H511, refer to the section "Overview
of the System Variables". A list of system variables and their symbolic identifiers is given
in the appendix.
H2 = 5;
H3 = 6;
H5 = 7;
H6 = 3;
H1 = *H2 + *H3;
Variable H1 is assigned the value 10 because the value 7 is accessed indirectly via *H2
(see H5) and the value 3 is accessed indirectly via *H3 (see H6).
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.
H1 = numof(H7);
H2 = numof (setpoint);
H3 = numof (setpoint2);
These program lines supply the IPOSplus® variables with the following values:
H1 = 7
H2 = 200
H3 = 201
INFORMATION
The following program lines are not permitted:
H1 = numof(*H1);
H1 = numof(H1 + H4);
H1 = numof(H3 + 6);
H1 = numof(Setpoint);
H1 = numof(Var1:1);
15 Compiler – Operators
Operators are used to link identifiers to one another and to statements in order to per-
form certain operations. The IPOSplus® 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. The
order of priority determines the order in which the operators are executed within a state-
ment. The following table lists all the operators supported by the IPOSplus® Compiler by
order of priority.
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; all others assign from left to right.
The operator for multiplication (*) is ranked before the operator for addition (+), so mul-
tiplication is performed before addition in the following statement:
H1 = 3 * 7 + 2 * 4;
INFORMATION
The sequence can be forced by brackets to ensure the sequence of operations is as
you require it. Nested brackets are permitted. Superfluous brackets have no effect on
the program function.
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
15.4.1 Example
H1 = H2 == 3 ? H3 : H4; // If H2 equals 3, H1 is assigned the value of
H3,
// otherwise it is assigned the value H4
Where possible, the ternary operator should not be used due to the illegibility of the
source code.
16 Compiler – Constructions
The IPOSplus® Compiler provides constructions that are also available in other high-
level languages.
The following constructions are available:
• if...else
• for
• 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.
16.1 if...else
16.1.1 Syntax
if ( expression )// Instructionelse// Instruction
The key words if and else control the program flow depending on whether the expres-
sion following the key word if returns the value TRUE (not equal to zero) or FALSE
(equal to zero). The else branch is optional. It is performed if the expression returns the
value FALSE. In a special case, a statement can also be a block in which several state-
ments can be specified. In this case, the statement block must be enclosed by curly
brackets ( {statement block} ).
Without else branch With else branch With block as if branch With block as else branch
if ( H1 == 3 ) if ( H1 == 3 ) if ( H1 > 3 ) if ( H1 > 3 )
H2 = 10; H2 = 10; { H2 = 9;
else H2 = 10; else
H2 = 8; H3 = 11; {
} H2 = 10;
H3 = 11;
}
The expression may also be composed of several conditions which are logically inter-
linked. Consequently, logical AND ( && ) and logical OR ( ¦¦ ) are available as logic op-
erations.
INFORMATION
Potential problem: A ; (semicolon) at the end of an if statement always makes the con-
dition true.
Example
if ( ( H1 >= 3 ) && ( H1 <= 12 ) )
H2 = 10;
Variable H2 is set to the value 10 if H1 is greater than or equal to 3 and is also less than
or equal to 12. In other words: H2 is set to the value 10 if the value of H1 is between 3
and 12.
The internal brackets are not necessary, but they increase the legibility of the program.
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 ; Expression2 ; Expression3 )
// Statement
The for statement can be used to construct program loops that should be exited after a
specified number of repetitions. The meanings of the three expressions are as follows:
Expression1 is executed once at the start of the for loop. This is where the run variables
are initialized. Expression2 determines when the loop is broken off. The loop is broken
off if the expression returns the logical value FALSE (or equal to zero). Expression3 is
processed after the statement has been executed. As a rule, it is used for altering the
run variables. The statement forms the body of the loop which may consist of one state-
ment or a statement block.
Example
H1 = 20;
for ( H0 = 0; H0 < 10; ++H0 )
H1 = H1 + 2;
H0 is set to zero at the start. Then a check is performed to see whether H0 has reached
the value 10. If this is not the case, then the statement is processed. In this example,
therefore, H1 is increased by 2. The run variable H0 is then increased by one. Next, the
check whether H0 has reached the value 10 is repeated, etc.
At the end of the loop, the value of H0 is 10 and that of H1 is 40 because the loop is
performed 10 times (loop counter H0 runs from 0 to 9 and then is canceled).
Example of a
statement block
H1 = 20;
H2 = 0;
for ( H0 = 0; H0 < 10; ++H0 )
{
H1 = H1 + 2;
++H2;
}
Whereas variable H1 is increased by 2 each time the loop runs through, variable H2 is
only increased by 1 (++H2 means pre-increment).
If a continue statement is processed within the statement block, this means the program
jumps to the end of the statement block and then processes expression3, which triggers
a check to determine whether the condition in the for statement is performed for a new
loop cycle.
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. This means when the loop is finished, the value of vari-
able H1 is 40 and that of H2 is 6.
If a break statement is processed in the statement block, this means the program exits
the for loop at that point. The loop is no longer continued.
Example
H1 = 20;
H2 = 0;
for ( H0 = 0; H0 < 10; ++H0 )
{
H1 = H1 + 2;
if ( H1 > 32 )
break;
++H2;
}
The if query with the break statement means that the loop is exited as soon as H1 is
greater than 32. This means that when the loop is exited, the value of variable H1 is 34
and that of H2 is 6.
16.3 while
16.3.1 Syntax
: while ( expression )
// Statement
The while statement is a conditional loop which performs the statement for as long as
the value of the expression is TRUE (not equal to zero). The statement is never per-
formed if the expression never has the value TRUE. The expression is always pro-
cessed before the statement.
The statement can also be a statement block in which several statements can be spec-
ified.
The expression can also be made up of several logically interlinked conditions.
Example
H2 = 0;
H1 = 10;
while ( H1 > 5 )
{
H2 = H2 + 1;
--H1;
}
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. The continue statement
results in a jump to the end of the statement block followed by repeating the check of
the expression to see whether the loop will be processed again.
Example
H1 = 0;
while ( H1 < 20 )
{
++H1;
if ( H1 > 10 )
continue;
H2 = H2 + 2;
}
Example
H1 = 0;
while(1)
{
++H1;
if ( H1 == 20 )
break;
if ( H1 > 10 )
continue;
H2 = H2 + 2;
}
This example has the same effect as the one shown previously. The "endless" loop is
left using the break statement if H1 equals 20.
This is an endless loop, which can be created using the following construction:
while(1)
// Statement
16.4 do...while
16.4.1 Syntax
do
// Loop statement
while ( Expression );
The do statement is a conditional loop in which the break condition is checked at the end
of the loop. As a result, this loop with the do statement always performs at least one it-
eration (at least one run-through).
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.
The expression can also be made up of several logically interlinked conditions.
In contrast to the while loop, the statement is always performed at least once in the do
while loop.
INFORMATION
Potential problem: The while (...); line always ends with a semicolon.
Example
H2 = 0;
H1 = 10;
do
{
H2 = H2 +1;
H1 = H1 -1;
} while ( H1 > 5 );
The statements within the block are carried out as long as H1 is greater than 5. H2 gets
the value 4 when the loop breaks off.
If the expression always remains TRUE, the result is an endless loop:
do
H2 = H2 +3;
while ( 1 );
In this case, the expression has the value 1, which means that the loop is never broken.
This loop can be broken off using the break statement.
H2 = 0;
do
{
H2 = H2 +3;
if ( H2 > 20 )
break;
} while ( 1 );
In this example, the do loop is broken off using the break statement if the value of the
IPOSplus® variable H2 is greater than 20.
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;
do
{
H2 = H2 +3;
if ( H2 > 20 )
break;
if ( H2 > 10 )
continue;
++H0;
} while ( 1 );
In this example, the incrementation of the IPOSplus® variable H0 stops as soon as the
value of the IPOSplus® variable H2 is greater than 10.
16.5 switch...case...default
16.5.1 Syntax
switch ( Expression )
{
case Wert 1:// statement 1
break;
case Wert 2:// statement 2
break;
.
.
default:// Statement n
}
The switch statement makes it possible to create multiple program branches depending
on the value of an expression.
If Expression has the value 1, Statement 1 is performed, if Expression has the value 2,
Statement 2 is performed, etc. If none of the values following 'case' corresponds with
'Expression,' the default statement – if programmed – is executed (Statement n).
INFORMATION
Statements 1, 2,..., n are normally sequences of statements which end with a break
statement. If the sequence of statements does not end with a break statement, all sub-
sequent case branches are performed until a break statement is encountered. The
value is then no longer compared with the expression.
Statements 1, 2,..., n can also be function calls. For example, a jump distributor can be
set up.
Value 1, Value 2, Value n must be constants or constant expressions. No variables are
permitted here.
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;
}
This program extract increments IPOSplus® variable H2 if the value of IPOSplus® vari-
able H1 is 1. If its value is 2, then the IPOSplus® variable H3 is incremented. IPOSplus®
variable H1 is incremented given any other value of IPOSplus® variable H4.
The following variant is also possible:
switch ( H1 )
{
case 1:
case 2: ++H3;
break;
default: ++H4;
break;
}
This program extract increments IPOSplus® variable H3 if the value of IPOSplus® vari-
able H1 is 1 or 2. IPOSplus® variable H1 is incremented given any other value of
IPOSplus® variable H4.
16.6 return
The key word return ends the processing of a function and returns to the command
following the function call. The return statement makes it possible to end functions
prematurely, for example, to increase the clarity of a C program. However, using this
statement too often can have the opposite effect. The following applies: a function
should contain as few exit points as possible.
The following example shows two coding possibilities for achieving the same result. The
example on the left uses the return statement to exit the function prematurely,
whereas the example on the right does not use return.
Function () Function ()
{ {
// Leave function when H1 is 5 // Skip statement when H1 = 5
if ( H1 == 5 ) if (H1 != 5)
return; {
H2=3; H2=3;
} }
}
17 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
}
The function prototypes in the program header do not have to be defined, in contrast to
ANSI-C.
Once the function has been performed, the line following the function call is processed.
A function can be exited prematurely using the return statement. In this case, program
processing is continued with the line following the function call.
Using the return statement can increase the clarity of a program structure. However,
using this statement too often can have the opposite effect. The following applies: a
function should contain as few exit points as possible.
SampleFunction()
{
// Leave function when H1 is 5
if ( H1 == 5 )
return;
H2=3;
}
INFORMATION
A user-defined function cannot be called from several tasks.
17.3.1 _AxisStop
Syntax _AxisStop( typ )
Description The drive axis is stopped when the IPOSplus® control word is written. A restart must be
carried out by the enable function via the IPOSplus® control word. The argument can be
used to specify the type of axis stop, or the deactivation of the lock can be specified via
the IPOSplus® control word.
Argument type
AS_RSTOP Braking with the P136 rapid stop ramp, followed by the status "No enable". The last target
position (H492) to have been transmitted is retained. Inhibit via control word (command
ASTOP (IPOS ENABLE) is required before the subsequent travel command). The brake is
applied if the brake function is activated. The message "In position" is set.
AS_HCTRL Braking with the ramp of the basic unit P131/P133 followed by position control. The last tar-
get position to have been transmitted is retained. Inhibit via control word (the ASTOP (IPOS
ENABLE) command is required before the subsequent travel command). The brake is not
applied if the brake function is activated.
AS_PSTOP Positioning stop with positioning ramp P911/P912 and calculated "STOP" target position
(only possible in the positioning mode), followed by position control. The last target position
(H492) to have been transmitted is overwritten by the stop position. No inhibit via control
word (no ASTOP (IPOS ENABLE) command required before the subsequent travel com-
mand). The brake is not applied if the brake function is activated.
Note: Since the actual position is used as the setpoint position at standstill, the command
cannot be processed cyclically. This is the case in axes with process forces or hoists
because otherwise the axis drifts slowly out of position.
Note: "AS_PSTOP" is not completed in the event of a fault. The program stops.
AS_ENABLE The inhibit is revoked using the IPOSplus® control word.
INFORMATION
Since the actual position is used as the setpoint position at standstill, the argument
AS_PSTOP cannot be processed cyclically. This is the case in axes with process
forces or hoists because otherwise the axis drifts slowly out of position.
Example main()
{
_GoAbs( GO_NOWAIT,3000 ); // Start movement job
_AxisStop( AS_PSTOP ); // Cancel movement
// Statements during standstill
_AxisStop( AS_ENABLE ); // Revoke inhibit
_GoAbs( GO_NOWAIT,3000 ); // Send new movement job
}
17.3.2 _BitClear
Syntax _BitClear( H, bit )
Example main()
{
_BitClear( H100, 3 ); // deletes bit 3 in H100
}
17.3.3 _BitMove
Syntax _BitMove( H2 , bit2, H1, bit1 )
Description Copies the bit with the number bit1 in IPOSplus® variable H1 to the bit with the number
bit2 in IPOSplus® variable h2. All bits of H1 and all other bits of H2 remain unchanged.
The bit positions of a variable are numbered 0 to 31. The least significant bit has the
number 0.
Example main()
{
_BitMove( H1, 3,H2, 4 ); // copies H1.3 = H2.4
_BitMove( H1, 1,H1, 0 ); // copies H1.1 = H1.0
}
17.3.4 _BitMoveNeg
Syntax _BitMoveNeg( H2 , bit2, H1, bit1 )
Description Copies the bit with the number bit1 in IPOSplus® variable H1 to the bit with the number
bit2 in IPOSplus® variable H2. The bit is negated during this process. All bits of H1 and
all other bits of H2 remain unchanged. The bit positions of a variable are numbered 0 to
31. The least significant bit has the number 0.
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 )
Description Within the IPOSplus® variable h, _BitSet sets the bit with the number bit to one.
Example main()
{
_BitSet( H100, 3 ); // sets bit 3 in H100
}
17.3.6 _Copy
Syntax _Copy( H2 , H1, no.)
Description Copies the number (no.) of consecutive variables as a variable block. H1 specifies the
name of the first source variable, H2 the name of the first target variable. A maximum of
10 variables can be copied.
Example main()
{
_Copy( H1,H5, 3 ); // copy H1 = H5, H2 = H6, H3 = H7
}
17.3.7 _FaultReaction
Syntax _FaultReaction( fnr, r )
Description This command can be used to program the system response to a unit fault. As such, the
command must be carried out before the fault occurs. The argument specifies the fault
and the corresponding response if this fault occurs.
All fault responses in the fault list in the operating instructions or the system manual that
have a dot in column P can be programmed as fault responses.
Key points fnr Constant expression for the number of the fault (see list of faults in the operating
instructions)
r 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; unit continues to run.
FR_SWOFF_F: Output stage inhibit and unit inhibit. Reset required.
FR_ESTOP_F: Stop via emergency stop ramp with unit inhibit. Reset required.
FR_RSTOP_F: Stop via rapid stop ramp with unit inhibit. Reset required.
FR_SWOFF_W: Output stage inhibit without unit inhibit. Reset re-enables the unit.
FR_ESTOP_W: Stop via emergency stop ramp without unit inhibit. Reset re-enables the unit.
FR_RSTOP_W: Stop via rapid stop ramp without unit inhibit. Reset re-enables the unit.
Example main()
{
_FaultReaction( 26,FR_SWOFF_F ); // Emergency stop / Malfunction with
ext. fault
}
17.3.8 _GetSys
Syntax _GetSys( H, sys )
Description Loads the value of an internal system value in one or more IPOSplus® variables.
_GetSys(gLAActSpeed,GS_ACTSPEEDEXT);
SPEEDMONITOR
Numerator value of the speed monitoring
The GETSYS command can be used as a prewarning for speed monitoring. Speed monitoring is triggered
when the current is at the current limit for the number of seconds specified in P501. For example, if P501 =
200 ms, the GETSYS command can be used to query the numerator value. The travel speed is reduced
after 50 ms. In this way, return travel can be made at rapid speed and, when under load, the speed can be
reduced automatically by the inverter.
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 Voltage value for optional analog output 2
GSCAM SourceVar Number of the variable on which the command is exe-
cuted
DbPreCtrl Delay time feedforward in 0.1 ms
DestVar Number of the variable which is to receive the result
BitPosition Bit position in the result variable
BitValue Polarity in the result variable
NumOfCam Number of cam blocks (max. 4)
PosL1 CCW limit value of cam block 1
PosR1 CW limit value of cam block 1
PosL2 CCW limit value of cam block 2
PosR2 CW limit value of cam block 2
PosL3 CCW limit value of cam block 3
PosR3 CW limit value of cam block 3
PosL4 CCW limit value of cam block 4
PosR4 CW limit value of cam block 4
GSCAM_EXT CamControl Bit 31 must always be set.
0x8000 0000 = function inactive, no new cam outputs will
be generated, set outputs will be retained and deleted
after a reset or voltage off/on only.
0x8000 0001 = function active internally, but all cam out-
puts will be turned off
0x8000 0002 = function active if drive is referenced
(H473, Bit20 =1)
0x8000 0003 = function active even without referenced
drive
CamReserved1 Reserved
CamOutShiftLeft Shifts the internal data buffer of the outputs by n digits to
the left before writing to the target variable CamDestina-
tion.
Note: The shifting process will delete the information of
the upper outputs. This means that if the shift factor is 3,
the upper 3 outputs with 4 ms cycle time are no longer
available, and the 4 outputs with 1 ms cycle time are
assigned to bits 3-6 and the output with 4 ms cycle time is
assigned to bit 7.
CamForceOn Mask to set mandatory outputs; the mask affects the inter-
nal data buffer prior to shifting with CamOutShiftLeft (NOT
the target variable defined with CamDestination)
CamForceOff Mask to delete mandatory outputs; the mask affects the
internal data buffer prior to shifting with CamOutShiftLeft
(NOT the target variable defined with CamDestination)
CamForceOff dominates CamForceOn
Unit-specific characteristics:
Element Unit-specific characteristics
MOVIDRIVE® B MOVITRAC® B
BusType (H+0) GS_BT_S0 (RS485 at XT) only
GS_BT_S1 (RS485 at X13) GS_BT_S1 (RS485 at FSC/FIO11B)
GS_BT_FBUS=3 (fieldbus option) GS_BT_SBUS1 (SBus at FSC/FIO21B)
GS_BT_SBUS1 (SBus at X12)
GS_BT_SBUS2 (via DFC11B)
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. Reference travel is set with P903 and can only be changed there.
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
INFORMATION
ZP and CAM have no effect if reference travel type P903 is set to 0, 5 or 8. If reference
travel type P903 is set to type 3 or 4, CAM cannot be set.
Example main()
{
_Go0( GO0_C_W_ZP ); // reference waiting for zero pulse
}
17.3.10 _GoAbs
INFORMATION
If the modulo function is used for positioning, the commands GOA and GOR cannot
be used. The target position is written directly to H454.
Key points type Expression for the type of movement command. type can adopt one of the follow-
ing values:
GO_NOWAIT: No wait, resumes processing of the program in the next statement line immediately after
sending the movement command (recommendation)
GO_WAIT: Waits in this statement line until travel is completed
pos Contains the absolute target position; the following can stand for pos:
Constant expression for target position
Name of a variable containing the target position
Pointer to a variable containing the distance (indirect addressing).
17.3.11 _GoRel
INFORMATION
If the modulo function is used for positioning, the commands GOA and GOR cannot
be used. The target position is written directly to H454.
Key points type Expression for the type of movement command. type can adopt one of the follow-
ing values:
GO_NOWAIT: No wait, resumes processing of the program in the next statement line immediately after
sending the movement command (recommendation)
GO_WAIT: Waits in this statement line until travel is completed
pos Contains the relative distance; the following can stand for pos:
Constant expression for distance
Name of a variable containing the distance
Pointer to a variable containing the distance (indirect addressing),
17.3.12 _InputCall
Syntax _InputCall ( level, mask, function name )
Description The function is used for calling up a user-defined function depending on the level pres-
ent at the input terminals. The name of the function, the required polarity of the input
level and the relevant terminals are specified as arguments. The event function is called
up when all input terminals marked with a one in mask have a "1" level (level = IC_HIGH)
or "0" level (level = IC_LOW).
Key points level Constant expression which specifies the signal level for which terminals are to
be tested. This expression can adopt one of the following values:
IC_HIGH: HIGH level ("1" level)
IC_LOW: LOW level ("0" level)
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
function name Name of the event function. (Important: In contrast to a function call,
only the name of the function without () is specified here)
TerminalIsOne ()
{
// Statements of the event function
}
main()
{
while(1)
{
// Main program loop task 1
_InputCall( IC_HIGH,DI02,TerminalIsOne );
// if terminal DI02 == HIGH ("1"), call the function
}
}
17.3.13 _Memorize
INFORMATION
If you use the command in a fast task, you have to set a _Wait command of at least 1
ms after the _Memorize command.
Description Enables IPOSplus® programs and/or variables to be saved or loaded in or from the non-
volatile memory (EEPROM) on the unit. The action is specified via the argument.
Key points action Constant expression for action. action can adopt one of the following values:
MEM_NOP: No data is saved
MEM_STALL: Saves program and variables
MEM_LDALL: Loads program and variables
MEM_STPRG: Saves program only
MEM_LDPRG: Loads program only
MEM_STDATA: Saves variables only
MEM_LDDATA: Loads variables only
INFORMATION
When using the _Memorize() command with MOVIDRIVE® A and MC07B, note that
variables stored in the non-volatile memory (H0 – 127) and all parameters are not writ-
ten cyclically. This is because the number of storage operations with the storage me-
dium EEPROM is restricted to 105 storage operations.
This restriction does not apply to MOVIDRIVE® B.
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. In all cases, higher-level safety precautions must be able to intervene
to counteract any possible programming errors.
When the command is called, MOVLNK reads and writes process data, variables or pa-
rameters from one unit to another once, or reads or writes variables or parameters within
a unit once.
The parameters are read/written using index addressing. For the corresponding index
number, refer to the system manual and the parameter list. You can also display the
index numbers in MOVITOOLS® MotionStudio by placing the mouse on the edit box or
display field of the respective parameter (tooltip).
An SBus or RS-485 interface can be used for communication between 2 units.
MOVILINK can be used in a unit, for example, to save the variable of a quantity counter
protected against power outage without using the MEM command to save the entire
power-outage proof range. Process data cannot be exchanged within one unit using the
MOVILINK command.
Using the index access via MOVILINK, user-defined inverter values that cannot be ac-
cessed with GETSYS/SETSYS can also be written/read from IPOSplus®. In this way, for
example, the inverter can set the parameters itself in the initialization section.
Before the command is called, initialize the variables that the command uses (command
structure). The beginning of this command structure is transferred to the command as
an argument. The data structure contains the data to be written or read.
Set the parameters for communication in the sender (master) and receiver (slave). The
MOVILINK command is only called in the sender (master).
The following standard SEW structures are available for the _MoviLink statement:
Instruction type Standard Elements Brief description
structure
_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) 0...99: Single address
100...199: Group address
253: Address of the inverter
254: Point-to-point connection
255: Broadcast
If an SBus group address (e.g. 43) is addressed, the offset 100 must be
added. In this case 143.
Format (H+2) Specification of the process (PD) and parameter (PARAM) channels for
data transfer:
//MoviLink Cyclic Frame Types //Acyclic
ML_FT_PAR1 = 0: PARAM+1PD ML_CFT_PAR1 = 128
ML_FT_1 = 1: 1PD ML_CFT_1 = 129
ML_FT_PAR2 = 2: PARAM+2PD ML_CFT_PAR2 = 130
ML_FT_2 = 3: 2PD ML_CFT_2 = 131
ML_FT_PAR3 = 4: PARAM+3PD ML_CFT_PAR3 = 132
ML_FT_3 = 5: 3PD ML_CFT_3 = 133
ML_FT_PAR = 6: Parameter (without ML_CFT_PAR = 134
PD)
Service (H+3) Communication service for parameters
ML_S_RD = 1: Read service
ML_S_WR = 2: Write to non-volatile memory
ML_S_WRV = 3: Writing without saving
Index (H+4) Index number of the parameter to be modified or read (see parameter
index directory)
The subindex must be entered in the index element on bits 23-16 (least
significant byte of the high word).
Calculation: H+4 or
MOVILNK.Index = Index + (SubIndex << 16);
DPointer (H+5) Number of the variable from which the read data is stored or from which
the data to be written is obtained (structure MLDATA)
Result (H+6) Contains the error code after the service has been performed or contains
zero if there was no error (see "Parameterization Return Codes" in the
"Communication and Fieldbus Unit Profile" manual with "parameter list").
INFORMATION
The element DPointer in the MOVLNK structure must be initialized with the first vari-
able number of the data structure that contains the communication data.
If this data is contained in a structure with the name bus data (declaration line ML-
DATA bus data), the initialization line within the MOVLNK structure must read as fol-
lows for the DPointer element:
***.DPointer = numof(Bus data);
MOVLNK is a wait command. The next command is only processed when the MOV-
LNK command has been executed.
If two or more MOVLNK commands are called cyclically, these must be processed in
one task. This process is mainly carried out for MOVIDRIVE® B in task 2 or task 3.
MOVLNK ml;
MLDATA mld;
main()
{
while(1)
{
// Initialize structure ml
ml.BusType = ML_BT_S1; // RS-485 #2
ml.Address = 1;
ml.Format = ML_FT_PAR2; // 2 PD with parameter
ml.Service = ML_S_RD; // Read
ml.Index = 8300+(0<<16); // Index of the inverter status (8300.0)
ml.DPointer = numof(mld); // Target structure
Other examples For further examples regarding the _MoviLink command, refer to the following sec-
tions:
• Reading an internal unit parameter (page 253)
• Writing a variable via SBus (page 254)
• Reading a parameter via SBus (page 255)
INFORMATION
With RS485 networks, there must only be one master.
In SBus (CAN) networks, there may be several active masters, see also
_SBusCommDef command. (page 230)
INFORMATION
It is important when using the MOVLNK command that the permanently saved vari-
ables (H0...127) and all parameters are not written cyclically with communication ser-
vice = 2 (non-volatile) because the number of save processes for the used memory
medium is limited.
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... at the sender). Acyclical communication deactivates the timeout
monitoring of MOVIMOT®.
Once cyclical communication has been started with the _MovCommOn command,
only the _MoviLink command to address 253 (internal) is possible. When using the
_MoviLink command, other units can no longer be accessed.
17.3.15 _MovCommDef
The _MovCommDef command can only be used with MQx modules.
Syntax _MovCommDef(H)
Description The MovComm commands enable cyclical data exchange between MQx and usually up
to 4 MOVIMOT® units via the RS-485 interface with the MOVILINK profile.
_MovCommDef is used to set up a communication connection with MOVIMOT® by set-
ting parameters such as the unit address, for example. _MovCommOn is used to start
cyclical communication. Thereafter, the cyclical communication runs in the background,
irrespective of the current command processing in the IPOSplus® program. A copy of the
exchanged process data is available in the IPOSplus® variables and can be read and
written there. Cyclical communication stops when the IPOSplus® program is stopped.
Up to 8 communication links are permitted. Note that the number of communication links
has a very powerful influence on the bus cycle time of the RS-485 and therefore also on
the response time of the MOVIMOT® unit. Approximately 20 ms bus cycle time must be
taken into account per communication link or station. The prerequisite for achieving the
20 ms bus cycle time per station is fault-free cabling of the RS-485. If a timeout occurs
during cyclical communication, this is displayed in fault 91 Gateway Sysfault. When a
feedback signal is received from MOVIMOT®, the error message is revoked automati-
cally.
Enter all information required to execute a command into a data structure in the variable
area with a user program. The start of this variable structure is the argument for the com-
mand. The variable is defined by the MOVCOM variable name; and has the following
structure.
BusType (H+0) Bus type (interface)
ML_BT_S1 = 2 (RS485 to MOVIMOT®)
Address (H+1) Individual address or group address for the MOVIMOT®to be addressed
0 ... 99 single addressing
100 ... 199 group addressing
255 broadcast
Format (H+2) Entry of process data for data transfer
3 = 2 process data words cyclically (for MOVIMOT®) = ML_FT_2
5 = 3 process data words cyclically (for MOVIMOT®) = ML_FT_3
Pd Pointer (H+3) Number of the variable H" in which the process data is stored or from which
the data to be written is obtained.
(The data structure for H" is described in detail below.)
Para Pointer (H+4) Number of the variable H' in which the parameter data is stored or from
which the data to be written is obtained.
MOVIMOT® does not support this function.
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.
H"+1 PO1 data of process data exchange
H"+2 PI1 data of process data exchange
H"+3 PO2 data of process data exchange
H"+4 PI2 data of process data exchange
H"+5 PO3 data of process data exchange
H"+6 PI3 data of process data exchange
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 ≠ 253 (internal) can be used.
Example /*=============================================
IPOS Source File
===============================================*/
#include <const.h>
#include <io.h>
/*=============================================
Main Function (IPOS Entry Function)
===============================================*/
main()
{
// Initialization ===========================
// fill control structure for communication link to MOVIMOT
mc1.BusType = ML_BT_S1; // communication via RS-485 to MOVIMOT
mc1.Address = 1; // MOVIMOT address 1
mc1.Format = ML_FT_3; // PDU type: 3 process data words cyclic
mc1.PdPointer = numof(mcpd1); // pointer to process data block
mc1.ParaPointer = numof(mcpara1); // pointer to parameter data block
_MovCommDef( mc1 );
_MovCommOn( );
while( )
{
}
}
17.3.17 _Nop
Syntax _Nop()
Description No operation is performed. This command can be used, for example, to achieve wait
times on the basis of the command cycle time.
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. The cyclical
data transmission must be started via function SBusCommOn () or SBusCommState
(action) (see the following pages). The type of the data object is specified in objecttype.
Key points objecttype Expression that can adopt one of the following values:
SCD_REC: Receive
SCD_TRCYCL: Cyclical send
SCD_TRACYCL: Acyclical send
SCD_REC Initializes a data object that receives the data. A maximum of 32 variables can be set up.
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" from which point the received data is stored
INFORMATION
Prior to transmitting acyclical telegrams, the SBus must also be activated with
_SBusCommOn or _SBusCommState.
MOVIDRIVE® B: The IPOSplus® program waits at this command until the message
has been sent, but for a maximum of 10 ms. Users can only monitor whether the tele-
gram has been sent correctly by evaluating the state (H+3) or the expected response.
The following standard SEW structures are available for the _SBusCommDef state-
ment:
Instruction type Standard Elements Brief description
structure
_SBusCommDef SCREC ObjectNo (H+0) Object number CAN Identifier (e.g. 1024)
Format (H+1) Data format
DPointer (H+2) Number of the variable H" from which point the
received data is stored
There must be 2 variables (H" and H"+1)
reserved for the reception of up to 8 bytes of
data.
SCTRCYCL ObjectNo (H+0) Object number (e.g. without CANopen profile as
of 1024
CycleTime Cycle time [ms]
(H+1)
Offset (H+2) Offset time [ms]
Format (H+3) Number of data bytes and data format
DPointer (H+4) Number of the variable H" where the data to be
sent begins
Result (H+5) Status of the transmission command:
≥0 Free bus capacity in % (calculated value of
this unit)
-1 Incorrect cycle time
-2 Too many objects set up
-3 Bus overload
-5 Wrong object number
-6 Wrong length
SCTRACYCL ObjectNo (H+0) Object number (e.g. without CANopen profile as
of 1024
Format (H+1) Number of data bytes and data format
DPointer (H+2) Number of the variable H" where the data to be
sent begins
Result (H+3) Status of the transmission command:
0 = Ready
1 = Transmitting
2 = Transmission successful
10 = Transmission error
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 ... 10) via SBus1 or SBus2:
Bit 24 = 0: SBus1 (.ObjectNo = CAN_ID + SCD_SBUS1)
Bit 24 = 1: SBus2 (.ObjectNo = CAN_ID + SCD_SBUS2); only MDX B with DFC11B
Unit-specific characteristics:
Element Unit-specific characteristics
MOVIDRIVE® B MOVITRAC® B
CycleTime (H+1) Valid cycle times1): Valid cycle times:
- 1, 2 ... 9 ms, number of objects 15 1 ... 255 ms, granularity 1 ms, number of
- 10, 20, ... 65530 ms objects 16
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.
In particular during further data exchange between the slaves, you must ensure that
the total calculated bus utilization does not exceed 70%.
The bus utilization is calculated in bits per second using the formula:
Number of telegrams × bits/telegram × 1/cycle time
For example, 2 messages with 100 bits in 1 ms cycle = 200000 bits/s = 200 kBaud
This results in the following bus load percentage in reference to the selected baud rate.
For example, 200 kBaud / 500 kBaud = 40% < 70%
For points 1 and 2, note that the unit firmware reserves its own object numbers automat-
ically:
• The object number entered in parameters P885/P895 for SBus synchronization.
• The following object numbers are used for communication via the MOVILINK profile
depending on the SBus address in parameter P881/P891 and the SBus group
address in parameter P882/P892:
– 8 × SBus address + 3 for process output data
– 8 × SBus address + 4 for process input data
– 8 × SBus address + 5 for synchronous process output data
– 8 × SBus address + 3 + 512 for parameter request service
– 8 × SBus address + 4 + 512 for parameter response service
– 8 × SBus group address + 6 for group process data
– 8 × SBus group address + 6 + 512 for group parameter request
For communication via the CANopen profile, the object numbers (identifiers) defined in
DS301 by CANopen will be used.
17.3.19 _SBusCommOn
Syntax _SBusCommOn()
INFORMATION
This command only activates SBus 1, not SBus 2
17.3.20 _SBusCommState
Syntax _SBusCommState ( action )
Description 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 SBussCommDef function.
Regardless of the value for "action", with MOVITRAC® B, the _SBusCommState com-
mand ( action ) always has the same effect as _SBusCommOn (page 234).
SCTRCYCL Obj1;
main()
{
Obj1.ObjectNo = 1090;
Obj1.CycleTime = 10;
Obj1.Offset = 0;
Obj1.Format = INTEL ¦ ANZ_BYTES // Set high und low byte
Obj1.DPointer = numof(DATA);
DATUM = 0;
while(1)
{
// Main program task 1
}
}
17.3.21 _SetInterrupt
Syntax _SetInterrupt( event , function name)
Description The function is used for specifying a user-defined function as an interrupt routine. The
name of the function is given as an argument. An interrupt may be triggered by various
events. The required event is given as an argument.
Key points event Constant expression that can adopt one of the following values:
SI_DISABLE: Interrupt is inhibited
SI_ERROR: Triggers an interrupt in case of a system error
SI_TIMER0: Triggers an interrupt when Timer0 is exceeded
SI_TOUCHP1: Initiates an interrupt in case of an edge change on a touch probe terminal if touch probe
was activated
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)
Description Sets the value of an internal system value with the value of an IPOSplus® variable.
The following standard SEW structures are available for the _SetSys statement:
Instruction type Standard structure Elements Brief description
_SetSys SSPOSRAMP Up Acceleration positioning ramp (ms)
Down Deceleration positioning ramp (ms)
SSPOSSPEED CW Positioning speed CW (0.1 rpm)
CCW Positioning speed CCW (0.1 rpm)
SSPIDATA31) Len Number of the process input data to be transmitted
PI1 Process input data 1
PI2 Process input data 2
PI3 Process input data 3
SSPIDATA101) Len Number of the process input data to be transmitted
PI1 Process input data 1
PI2 Process input data 2
PI3 Process input data 3
PI4 Process input data 4
PI5 Process input data 5
PI6 Process input data 6
PI7 Process input data 7
PI8 Process input data 8
PI9 Process input data 9
PI10 Process input data 10
1) Applies if parameter P101 is set to "RS485", "Fieldbus" or "SBus".
Example main()
{
// Set the speed control operating mode
H0 = 11;
_SetSys( SS_OPMODE,H0 );
}
17.3.23 _SetTask
Syntax _SetTask ( control word, function name )
Description This function is used to determine a user-defined function as a task and to start or stop
this task. The name of the function and the control word are given as arguments.
Argument control word Constant expression that can adopt one of the following values:
MOVIDRIVE® B MOVIDRIVE® A
ST2_STOP: Stop task 2 T2_START: Start task 2
ST2_START: Start task 2 T2_STOP: Stop task 2
ST3_STOP: Stop task 3
ST3_START: Start task 3
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. The name of the function and the control word are given as arguments. The
control word and start address are both set to 0 when the power is switched on, i.e.
Task2 is deactivated.
In MOVIDRIVE® B, the command has been replaced by _SetTask. However, due to
downward compatibility, it is still available with MOVIDRIVE® B.
Key points control word Constant expression that can adopt one of the following values:
T2_STOP: Stop task 2
T2_START: Start task 2
function name Name of the Task2 function. (Important: In contrast to a function call,
only the name of the function without () is specified here.)
MeineTask2 ()
{
// Statements of task 2
}
main()
{
// Inform system of task 2 and start
_SetTask2( T2_START,MyTask2 );
while(1)
{
// Main program
}
}
17.3.25 _SetVarInterrupt
Syntax _SetVarInterrupt ( h1 , function name )
Example See "Task Management and Interrupts / Variable Interrupts with MOVIDRIVE® B".
17.3.26 _SystemCall
Syntax _SystemCall( event, function name)
Description The function is used to call a user-defined function when a system-controlled even oc-
curs. The name of the function and the required event are given as arguments.
Key points event Constant expression that specifies when the function name is called. This
expression can adopt one of the following values:
SC_UC: Unconditional
SC_N0: When the speed is zero
SC_N: When the speed is not zero
SC_NOTPOS: If not in position
SC_TP1: If there is an edge change at touch probe terminal DI02
SC_NTP1: If there is no edge change at touch probe terminal DI02
SC_TP2: If there is an edge change at touch probe terminal DI03
SC_NTP2: If there is no edge change at touch probe terminal DI03
function name Name of the event function. (Important: In contrast to a function call,
only the name of the function without () is specified here.)
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. Touch probe inputs are the input terminals DI02
and DI03.
It takes 100 µs to store the touch probe positions, regardless of ongoing program pro-
cessing. The terminal level must have been altered for at least 200 µs to be detected
reliably. The argument can be used to select the edge change that causes a touch
probe.
If an edge change occurs on the enabled input, the current actual positions are saved in
specified IPOSplus® system variables. To take another measurement, the touch probe
must be enabled again.
The touch probe positions are stored in the following variables:
Encoder Encoder position Position of touch Position of touch
probe 1 (DI02) probe 2 (DI03)
Motor encoder X15 H511 ActPos_Mot H507 TpPos1_Mot H505 TpPos2_Mot
External encoder X14 H510 ActPos_Ext H506 TpPos1_Ext H504 TpPos2_Ext
Absolute encoder X62 H509 ActPos_Abs H503 TpPos1_Abs H502 TpPos2_Abs
Virtual encoder (only for H376 H501 TpPos1_VE H500 TpPos2_VE
MOVIDRIVE® B)
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.
17.3.29 _WaitInput
Syntax _WaitInput ( level, mask )
Description The function waits until a specific level is present at specific input terminals. The re-
quired polarity of the input level and the relevant terminals are given as arguments. The
function waits until all input terminals marked with a one in mask have a "1" level or a
"0" level.
Key points level Constant expression that specifies which signal level the terminals should be
tested for. It can adopt one of the following values:
1: HIGH level ("1" level)
0: LOW level ("0" level)
mask Constant binary expression which specifies the terminals to be tested. The bits
in the expression have the following meaning
Bit 0: DI00, mask = 0b1
Bit 1: DI01, mask = 0b10
Bit 2: DI02, mask = 0b100
Bit 3: DI03, mask = 0b1000
Bit 4: DI04, mask = 0b10000
Bit 5: DI05, mask = 0b100000
Bit 6: DI10, mask = 0b1000000
Bit 7: DI11, mask = 0b10000000
Bit 8: DI12, mask = 0b100000000
Bit 9: DI13, mask = 0b1000000000
Bit 10: DI14, mask = 0b10000000000
Bit 11: DI15, mask = 0b100000000000
Bit 12: DI16, mask = 0b1000000000000
Bit 13: DI17, mask = 0b10000000000000
Bit 14-31: Reserved
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
main()
{
_WaitInput( 1,0b100 );
// as long as terminal DI02 == HIGH ("1"), wait
}
17.3.30 _WaitSystem
Syntax _WaitSystem( event )
Description The function waits for as long as a system-related event is present. The required event
is given as an argument.
Key points event Constant expression that specifies when the function waits. This expression
can adopt one of the following values:
SC_UC: Unconditional
SC_N0: When the speed is zero
SC_N: When the speed is not zero
SC_NOTPOS: If not in position
SC_TP1: If there is an edge change at touch probe terminal DI02
SC_NTP1: If there is no edge change at touch probe terminal DI02
SC_TP2: If there is an edge change at touch probe terminal DI03
SC_NTP2: If there is no edge change at touch probe terminal DI03
Example main()
{
_WaitSystem( SC_N0 ); // as long as speed == zero, wait
}
17.3.31 _WdOff
Syntax _WdOff()
Example main()
{
WdOFF();
}
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. The counter value has to last at least as long as one main program cycle.
main()
{
while(1)
{
/*
Perform statements in the loop
The total run time of the statements in the loop
must not be longer than 1000 ms to prevent
the watchdog from running down.
*/
18 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. The bit-by-bit OR operation Hx ¦ K sets those bits in variable x to one which are also
set to one in constant K.
In both cases, the legibility of the program can be improved if the bit position or the con-
stant is defined symbolically. Bit setting functions are mainly used for setting binary unit
outputs. Therefore, in the following example, variable H481 (StdOutpIPOS) will be used
as the target variable of the operation. Variable H480 (OptOutpIPOS) would be used ac-
cordingly to address the outputs of the option. In the example, the output terminal DO02
of the basic unit is to be set.
Using _BitSet() Using the OR operation
#include <const.h> #include <const.h>
#include <io.h> // MOVIDRIVE A #include <io.h> // MOVIDRIVE A
#include <iob.h> // MOVIDRIVE B #include <iob.h> // MOVIDRIVE B
main() main()
{ {
_BitSet( StdOutpIPOS, 2 ); StdOutpIPOS ¦= DO02;
} }
The source text can be simplified even further if symbolic designators are used for the
corresponding statements as well as the variables and constants:
Using _BitSet():
#include <const.h>
#include <io.h> // MOVIDRIVE A
#include <iob.h> // MOVIDRIVE B
#define SetDO02 _BitSet( StdOutpIPOS, 2);
main()
{
Set DO02
}
If several outputs are to be set at the same time, then you can either call the _BitSet()
function several times in succession or use the bit-by-bit OR logic operation for this. In
the second case, one statement will suffice. This reduces the amount of code and thus
also has a positive effect on the program run time.
The following example uses the OR operation to set DO01 and DO02 at the same time.
If several outputs are to be reset at the same time, then you can either call the
_BitClear() function several times in succession or use the bit-by-bit AND logic opera-
tion. In the second case, one statement will suffice. This reduces the amount of code
and thus also has a positive effect on the program run time.
The following example uses the AND operation to clear DO01 and DO02 at the same
time.
Using the AND operation:
#include <const.h>
#include <io.h> // MOVIDRIVE A
#include <iob.h> // MOVIDRIVE B
main()
{
StdOutpIPOS &= ~DO01 & ~DO02;
}
main()
{
while(1)
{
// Read DI02
lInputLevel = (InputLevel & 0x00000004);
if(lDI02RisingEdge)
lDO02State = (!lDO02State)
else
_BitClear( StdOutpIPOS, 2 );
}
}
main()
{
while(1)
{
// Read DI02
lInputLevel = (InputLevel & 0x00000004);
if(lDI02FallingEdge)
lDO02State = (!lDO02State)
else
_BitClear( StdOutpIPOS, 2 );
}
}
INFORMATION
For When querying an edge, make sure to always use an auxiliary variable lInput-
Level that stores the state of the input terminal instead of using the input terminal it-
self to create the edge.
// Read DI02
lInputLevel = (InputLevel & 0x00000004);
If the input terminal was used instead of the lInputLevel auxiliary variable, the edge at
the input terminal could change at the point when the IPOSplus® program is between the
two program lines required for edge creation. This would mean that the edge change
would not be detected at the input terminal.
Also note that the edge of an input terminal can only be queried in the task in which the
edge was created. If this is not the case, if the individual tasks are not synchronous, the
edge may not be detected or it may be interpreted incorrectly.
If the edge of an input terminal is required in several tasks, the edge must be created
separately in each task.
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)
===============================================*/
main()
{
/*-------------------------------------
Initialization
--------------------------------------*/
/*-------------------------------------
Main program loop
--------------------------------------*/
while(1)
{
// Reading binary inputs
_GetSys( BinInputsNew,GS_INPUTS );
// Querying an edge
if( (BinInputsNew & 0x4) && !(BinInputsOld & 0x4) ) // rising edge DI02
{
// program statement is located here
}
SSPOSSPEED tSpeed;
long lActSpeed, lActSpeedAbsolute;
/*===================================
Task 2
===================================*/
Task2()
{
_GetSys( lActSpeed,GS_ACTSPEED );
main()
{
// Initialization =================
// Positioning speed 500 rpm
tSpeed.CW = tSpeed.CCW = 5000;
_SetSys( SS_POSSPEED,tSpeed );
// Activate Task 2
_SetTask2( T2_START,Task2 );
/*=========================================
IPOS Source file
=========================================*/
#include <constb.h>
#include <iob.h>
// Definition of Variables
long lRefType;
/*=========================================
Main program
=========================================*/
main()
{
// Initialization of MoviLink for bus transfer
tRefType.BusType = ML_BT_S1;
tRefType.Address = 253 // own inverter
tRefType.Format = ML_FT_PAR; // only parameters
tRefType.Service = ML_S_RD; // read
tRefType.Index = 8626; // P903 RefType
tRefType.DPointer = numof(tData); // data buffer
/*=========================================
Variable H200 of inverter connected via
SBus is written depending on DI17 in task 1:
DI17 = 0 -> -1000
DI17 = 1 -> 1000
=========================================*/
/*=========================================
IPOS Source file
=========================================*/
#include <constb.h>
#include <iob.h>
/*=========================================
Main program
=========================================*/
main()
{
// Initialization of MoviLink for bus transfer
tBus.BusType = ML_BT_SBUS1; // bus type SBus1
tBus.Address = 10; // SBus address 10
tBus.Service = ML_S_WRV; // write volatile
tBus.Index = 11200; // variable H200
tBus.DPointer = numof(tBusData); // data buffer
/*=========================================
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
4 = PARAM + 3PD
5 = 3PD
6 = PARAM + 6PD
7 = 6PD
8 = PARAM + 10PD
9 = 10PD
=========================================*/
/*=========================================
IPOS Source file
=========================================*/
#include <constb.h>
#include <iob.h>
// Definition of variables
long lPDData;
/*=========================================
Main program
=========================================*/
main()
{
// Initialization of MoviLink for bus transfer
tPD.BusType = ML_BT_SBUS; // bus type SBus
tPD.Address = 10; // SBus address 10
tPD.Format = ML_FT_PAR; // only parameters
tPD.Service = ML_S_RD; // read
tPD.Index = 8451; // P090 PD data config
tPD.DPointer = numof(tData); // data buffer
18.7.1 Receiver
The receiver obtains the data from the SBus and stores it in the variables H305 and
H306.
/*=========================================
Get data object 1025 from SBus and store
the data in variable H305 and H306.
SHELL settings:
P813 SBus Address -> 2
P816 SBus Baudrate -> 500 kBaud
=========================================*/
/*=========================================
IPOS Source file
=========================================*/
#include <constb.h>
#include <iob.h>
// Definition of variables
#define Data_Var1x H305
#define Data_Var2x H306
/*=========================================
Main program
=========================================*/
main()
{
// Initialization of SCOM transfer object
tBusRec.ObjectNo = 1060; // object number
tBusRec.Format = 8; // 8 byte
tBusRec.Dpointer = numof(Data_Var1x); // data buffer
// Start SCOM
_SBusCommDef( SCD_REC,tBusRec );
_SBusCommState( SCS_START1 ); // Start cyclic communication MOVIDRIVE B
// _SBusCommOn( ); // Start cyclic communication MOVIDRIVE A
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.
/*=========================================
Variables H208 and H209 are sent cyclic
every 10 ms to another inverter via SBus.
The values of H208 and H209 can be altered
with input DI17.
DI17 = 0: H208 = 111111 / H209 = 222222
DI17 = 1: H208 = 222222 / H209 = 444444
SHELL settings:
P813 SBus Address -> 1
P816 SBus Baudrate -> 500 kBaud
=========================================*/
/*=========================================
IPOS Source file
=========================================*/
#include <constb.h>
#include <iob.h>
// Definition of variables
#define Data_Var1 H208
#define Data_Var2 H209
/*=========================================
Main program
=========================================*/
main()
{
// Initialization of SCOM transfer object
tBusTr.ObjectNo = 1025; // object number
tBusTr.CycleTime = 10; // cycle time
tBusTr.Offset = 0; // offset
tBusTr.Format = 8; // 8 byte
tBusTr.DPointer = numof(Data_Var1); // data buffer
tBusTr.Result = 1111; // default value for control
// Initialize variables
Data_Var1 = 111111;
Data_Var2 = 222222;
// Start SCOM
_SBusCommDef( SCD_TRCYCL,tBusTr );
_SBusCommState( SCS_START1 ); // Start cyclic communication MOVIDRIVE B
// _SBusCommOn( ); // Start cyclic communication MOVIDRIVE A
DI10 = 1 PW TP_Max_Pos
TP
TP_Pos PTP
PD
SEW SEW
X13:3 / DIO2
506321163
/
*==============================================================================
Description:
A machine cycle is started via input DI10. The target position is the
current motor position (H511) plus TP_Max_Pos (H11). If the touch probe input
DI02
is not attenuated, the drive moves to this target position. If DI02 is attenu-
ated, a
new target position is calculated. The new target position is calculated from
the motor position
during the touch probe event TpPos1_Mot (H507) plus the remaining distance
TP_Pos (H12).
Settings in SHELL :
P601 Binary input DI02 IPOS input
P610 Binary input DI10 IPOS input
P700 Operating mode ... & IPOS
=============================================================================*/
#include <const.h>
#include <io.h>
#define CALCTARGET 0
#define BUSSY 1
#define STOP_AKTIV 2
#define State H10
#define TP_Max_Pos H11
#define TP_Pos H12
#define Speed H13
#define Ramp H14
#define h473_ipos_in_position (StatusWord & 0x00080000) //StatusWord & BIT19
long lPosition;
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;
// Initialization of the interrupt routine for touch probe input DI02
_SetInterrupt( SI_TOUCHP1,Touchprobe );
//Main program loop
while(1)
{
// Set speed and ramp
tPosSpeed.CW = tPosSpeed.CCW = Speed *10; // Speed
tPosRamp.Up = tPosRamp.Down = Ramp; // Ramp
_SetSys (SS_POSRAMP, tPosRamp);
_SetSys (SS_POSSPEED, tPosSpeed);
switch(State)
{
case CALCTARGET: if(DI10)
{
lPosition = ActPos_Mot + TP_Max_Pos;
_TouchProbe( TP_EN1_HI );
// Activate rising edge
State = BUSSY;
}
break;
case BUSSY: _GoAbs( GO_NOWAIT,lPosition );
// _Go command to position
if(h473_ipos_in_position && !DI10)
// Axis in position and DI10 = 0
State = CALCTARGET; // Calculate new target position
if (!h473_ipos_in_position && !DI10)
// Positioning cancelled by DI10 = 0
{
_AxisStop(AS_PSTOP);
State = STOP_AKTIV;
}
break;
case STOP_AKTIV: if(DI10) // DI10 = 1 --> Continue positioning
break;
State = BUSSY;
default: break;
}//switch(State)
}// while (1)
}// main
INFORMATION
Use "IPOS" to assign PO data and base the control word on the ControlWord H484,
otherwise there will be a problem in mode 2 if the bus fails.
The following status chart shows the transitions between the operating modes:
Chart of mode statuses:
01
Mode 0 Mode 1
00
01
00 01
00
11 10
10
11
10
Mode 3 Mode 2
11
506325259
/*===================================================
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
Mode 3: reserved
SHELL settings:
P100 Setpoint source: BIPOL./FIX.SETPT
P101 Control signal source: TERMINALS
P600 ... P604 Binary input DI01 ... DI05: NO FUNCTION
P610 / P611 Binary input DI10 / DI11: IPOS INPUT
P630 / P631 Binary output DO10 / DO11: IPOS OUTPUT
P700 Operating mode 1: ... & IPOS
P870 ... P872 Setpoint description PO1 ... PO3: IPOS PO-DATA
P873 ... P875 Actual value description PI1 ... PI3: IPOS PI-DATA
P876 PO data enable: ON
===================================================*/
/*===================================================
IPOS Source file
===================================================*/
#include <constb.h>
#include <iob.h>
#pragma globals 350 399
// Definition of structures
GSPODATA3 busdata; //structure for fieldbus process data
GSAINPUT analog; //structure for analog values
// Definition of variables
#define modeselect ((InputLevel > > 6) & 0x00000003)
#define setfixedsetpoint _SetSys( SS_N11,speed )
#define activatefixedsetpoint _BitSet( ControlWord, 4 )
#define deactivatefixedsetpoint _BitClear( ControlWord, 4 )
#define enable _BitClear( ControlWord, 1 )
#define rapidstop _BitSet( ControlWord, 1 )
// Declaration of variables
long mode, speed, offset;
/*===================================================
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;
// Activate task 2
_SetTask2( T2_START,buscontrol );
buscontrol()
{
_GetSys( busdata,GS_PODATA ); //get bus data
mode = modeselect; //read terminals for mode select
OptOutpIPOS = ((OutputLevel > > 3) & 0xFFFFFFFC) ¦ mode; //output mode
switch( mode )
{
case 0: mode_0();
break;
case 1: mode_1();
break;
case 2: mode_2();
break;
case 3: mode_3();
break;
}
}
/*===================================================
Functions
===================================================*/
mode_0()
{
if( busdata.PO1 == 6 )
enable;
else
rapidstop;
speed = busdata.PO2;
setfixedsetpoint;
activatefixedsetpoint;
}
mode_1()
{
if( busdata.PO1 == 6 )
enable;
else
rapidstop;
_GetSys( analog,GS_ANINPUTS );
offset = (analog.Input1 + 15) / 10;
speed = busdata.PO2 + offset;
setfixedsetpoint;
activatefixedsetpoint;
}
mode_2()
{
enable;
deactivatefixedsetpoint;
}
mode_3()
{
rapidstop;
}
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 ... +1500 rpm).
18.9.2 Mode 1
Control via fieldbus, setpoint = fieldbus setpoint + analog setpoint
Control is performed exclusively via the fieldbus. A reduced control word (0 = rapid stop,
6 = enable) is also to be used. The setpoint is the sum of the fieldbus setpoint
(bipolar –1500 rpm ... +1500 rpm) and the analog setpoint (–10 V ... +10 V = –1500 rpm
... +1500 rpm).
18.9.3 Mode 2
Control and setpoint via terminal or analog value.
The fieldbus is disabled.
18.9.4 Mode 3
Reserved
A rapid stop is performed until the mode is in use.
// Activate task2
_SetTask2(T2_START, fnTask2); //To debug task 2, add inverse slashes here and delete them below
/*-------------------------------------
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;
// "Referencing" mode
case HOMING:fnHoming();
break;
// "Positioning" mode
case POSITIONING: fnPositioning();
break;
//Programming error - invalid status
default: _AxisStop(AS_PSTOP);
lGlobalStateMachine = lOpMode = -1;
break;
} // End switch (lGlobalStateMachine)
} //End while (1)
} // End main
/*=============================================
= 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.
===============================================*/
fnJogging()
{
// Instructions for entering the main state "Jogging"
// Acknowledge mode
_BitSet(lPE_StatusWord,11);
_BitClear(lPE_StatusWord,12);
if (MY_JOG_PLUS&&(!MY_JOG_MINUS))
{
tPosVelocities.CW = tPosVelocities.CCW = tPA.PO2;
_SetSys( SS_POSSPEED, tPosVelocities );
TargetPos = ActPos_Mot + 409600;
}
if (MY_JOG_MINUS&&(!MY_JOG_PLUS))
{
tPosVelocities.CW = tPosVelocities.CCW = tPA.PO2;
_SetSys( SS_POSSPEED, tPosVelocities );
TargetPos = ActPos_Mot - 409600;
}
} while (lGlobalStateMachine==JOGGING);
/*=============================================
= 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;
// Acknowledge mode
_BitClear(lPE_StatusWord,11);
_BitSet(lPE_StatusWord,12);
switch (lSubStateHoming)
{
case HOMING_STOPPED: if (MY_START_HOMING)
{
_Go0(GO0_U_NW_CAM);
lSubStateHoming = HOMING_STARTED;
}
break;
case HOMING_STARTED: if (!MY_START_HOMING)
{
_Go0(GO0_RESET);
lSubStateHoming = HOMING_STOPPED;
}
if (MY_REFERENCED)
{
lSubStateHoming = HOMING_READY;
}
break;
case HOMING_READY: if (!MY_START_HOMING)
{
lSubStateHoming = HOMING_STOPPED;
}
break;
}
} while (lGlobalStateMachine==HOMING);
// Instructions for leaving the main state "Homing"
// Stopping the drive
if (lSubStateHoming==HOMING_STARTED)
{
_Go0(GO0_RESET);
lSubStateHoming = HOMING_STOPPED;
}
// Clear mode
_BitClear(lPE_StatusWord,11);
_BitClear(lPE_StatusWord,12);
/*=============================================
= 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);
switch (lSubStatePositioning)
{
case POSITIONING_STOPPED: if (MY_START_POSITIONING)
{
tPosVelocities.CW = tPosVelocities.CCW = tPA.PO2;
_SetSys( SS_POSSPEED, tPosVelocities );
TargetPos = (lScalingNumerator * tPA.PO3)
/ lScalingDenominator;
lSubStatePositioning = POSITIONING_STARTED;
}
break;
case POSITIONING_STARTED: if (MY_START_POSITIONING)
{
tPosVelocities.CW = tPosVelocities.CCW = tPA.PO2;
_SetSys( SS_POSSPEED, tPosVelocities );
TargetPos = (lScalingNumerator * tPA.PO3)
/ lScalingDenominator;
}
else
{
_AxisStop(AS_PSTOP);
lSubStatePositioning = POSITIONING_STOPPED;
}
break;
}
}while (lGlobalStateMachine==POSITIONING);
/*=============================================
= Function: fnTask2()
= For time-critical program sections that can run asynchronously
= from task one
=
===============================================*/
fnTask2()
{
// "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;
if (lOpMode==HOMING)
lGlobalStateMachine = HOMING;
if (lOpMode==DISABLE)
lGlobalStateMachine = DISABLE;
}
else
lGlobalStateMachine = DISABLE;
break;
//Programming error - invalid status
default: _AxisStop(AS_PSTOP);
lGlobalStateMachine = lOpMode = -1;
break;
}// End switch (lGlobalStateMachine)
20 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.).
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.
factor NUMERA-
Setting range: 0 ..... 1 ..... 231 - 1
TOR
Example The following three examples will demonstrate how the travel factors numerator/denom-
inator of a linear unit are set for position specification:
• Example A: Position specification in mm for the linear axis
• Example B: Position specification in increments
• Example C: Position specification in output revolutions
Mechanical structure of the linear unit
d = 100 mm x [mm]
M i=4
511398411
Example A: mm The defined distance to be calculated is one revolution of the driven gear.
• Travel distance factor NUMERATOR = Increments/motor revolution × gear ratio i =
4096 × 4 = 16384
• Travel distance factor DENOMINATOR = Output diameter × π = 314.15926
The travel distance factor DENOMINATOR is not a whole number, so the accuracy of
the conversion can be increased by using an expansion factor. The expansion factor
should be as high as possible, however, the result must not exceed the setting range
(expansion factor e.g. 100 000).
• Travel distance factor NUMERATOR = 16384 × 100000 = 1638400000
• Travel distance factor DENOMINATOR = 314.15926 × 100000 = 31415926
INFORMATION
Since π is not a finite number, the target position specification will always contain er-
rors.
Example C: Out- • Travel distance factor NUMERATOR = Increments/motor revolution × gear ratio i =
put revolutions 4096 × 4 = 16384
• Travel distance factor DENOMINATOR = 1
Practical informa- Practical information for determining the travel distance factor during startup.
tion
e.g. setting the user travel units in mm.
1. Set both the travel distance factors NUMERATOR and DENOMINATOR to the value
1 (→ user travel units = increments).
2. Optional number of user travel units (increments), e.g. 100 000 increments.
3. Measure the covered distance in point 2 of the plant e.g.:
• Starting position = 1000 mm
• Target position = 1453 mm
• Distance covered = 453 mm
4. Enter the travel distance factors in the program header of the Assembler:
• Travel distance factor NUMERATOR = 100 000
• Travel distance factor DENOMINATOR = 453
20.1.2 UNIT
All travel distance entries are displayed with a unit in the program window.
This unit can be entered in the program header for UNIT. It can be up to five characters
in length.
INFORMATION
This is a merely symbolic entry that does not affect the functionality of the drive
[1]
[2]
[3]
[4]
[5]
511471115
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
on [Set commands] and choose "SET H = K" from the window on the right.
In the lower section of the dialog box, enter the jump label of the command line, the tar-
get variable and the value (constant) to which the variable should be set. Click on [OK]
to close the insert tool and insert the command in the program.
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 Condition Constant Destination
SET 1 200 0
JMP 2 200 > 99 1
ADD 200 1
WAIT 500
JMP UNCONDI- 2
TIONED
511550475
As the next step, the compiled program must be loaded into the inverter. To do so,
choose [Program]/[Compile + download] or click on the icon in the toolbar.
The status bar shows whether the program has been downloaded successfully.
511552011
plus®
The IPOS program is now stored in the unit's non-volatile memory.
IPOSplus® programs can also be downloaded from one MOVIDRIVE® to another
MOVIDRIVE® using a DBG60B/DBG11B keypad. This is done using parameters P807
(Copy MDX -> DBG) and P806 (Copy DBG -> MDX).
A program can be started once it has been downloaded to the inverter. Choose [Run]/
[Start]. Alternatively, you can click on the icon in the toolbar. Once the program has
been started, a green arrow (program pointer) is displayed in the project window to high-
light the program line currently being processed. The display in the toolbar changes from
PSTOP to START.
To stop the programs in task 1, task 2 and task 3, choose [Run]/[Stop] from the menu
bar. Alternatively, you can click on the icon in the toolbar. Once the program has been
stopped (all tasks), the program pointer turns red and remains in the first command line
of task 1. The status display for the program sequence in the tool bar changes from
START to PSTOP.
21 Assembler – Editor
The Editor is displayed after the IPOSplus® Assembler has been started:
[1]
[2]
[3]
[4]
[5]
511872523
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.
There are three input fields under the toolbar:
• Numerator
• Denominator
• Unit
Position setpoints can be scaled using the numerator/denominator ratio, which means
that they can be specified in units defined by the user. Positions specified via variables
cannot be scaled using this ratio.
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.
• Numerator: 4096
• Denominator: 10
• Unit: mm
When you insert a positioning command, you can now enter the required position in mm,
as long as the value is a constant.
The operating states of the user programs task 1, task 2 and task 3 are:
• START (program is running)
• PSTOP (Program stopped);
• BREAK (program is only processed up to the marked line)
• STEP (program is processed line-by-line by pressing the F7 key).
511877899
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> key to remove selected command lines from the program.
In the same way, you can insert entire command blocks by highlighting the required sec-
tion with the mouse and choosing [Edit]/[Copy] and [Edit]/[Insert] or delete them by
choosing [Edit]/[Cut].
You can change an inserted command by double-clicking the command line in the proj-
ect window or by choosing [Edit]/[Edit command...] from the menu bar.
Save the compiled Assembler program by choosing [File]/[Save...].
511934475
INFORMATION
MDX files created using the Assembler only contain program code and no parame-
ters.
MDX files, created for storing parameters using SHELL, contain both parameters and
program code.
Therefore, you must be careful when overwriting existing MDX files.
511940235
As the next step, the compiled program must be loaded into the inverter. To do so,
choose [Program]/[Compile + download] or click on the icon in the toolbar.
The status bar shows whether the program has been downloaded successfully.
512034955
512040331
21.6 Debugger
The integrated debugger is a tool used to run through a program in single step mode.
Once the program has been downloaded to the inverter, you can choose from three
functions.
Program -> compare with unit Compares program in the editor with the
program in the inverter
Run -> Start Starts the IPOSplus® program
Run -> run to cursor Runs program to where the cursor is posi-
tioned
Run -> single step Runs single step
22 Assembler – Programming
22.1 Basics
The IPOSplus® Assembler is part of the MOVITOOLS® MotionStudio program package.
The Assembler program is entered over a number of screens.
22.1.3 Comments
Like command lines, you can insert comments anywhere in the user program.
Remarks can only be saved on the PC; they are not transferred when the program is
downloaded to the inverter.
INFORMATION
Do not exit subroutines by jumping to a main program or another subroutine. If a sub-
routine is to be exited conditionally, this must be done by jumping to the end (RET) of
the subroutine.
INFORMATION
Do not exit program loops with a jump command. Jump commands are allowed within
a program loop.
22.1.10 Variables
All variables (H0 - H1023) can be read and written. The variables have a value range
from -231 ... +231 - 1. If the variables H0 ... H127 are entered in the variable list or written
in the IPOSplus® program with the "MEM" command, they are stored in a non-volatile
memory as soon as they are entered. Variables H458 – H511 contain frequently used
unit values which are updated cyclically (every 1 ms). These variables are referred to
below as system variables and are explained in more detail in section "Overview of Sys-
tem Variables".
INFORMATION
Be careful when writing system variables! The effects are described in the section
"IPOSplus® with Options".
The write command for variables and indices distinguishes between non-volatile and
volatile storage. The variables H0 ... H127 can be written and stored using both func-
tions; H128 ... H511 can only be stored in the volatile memory.
Variables H0 ... H127 are always stored in the non-volatile memory via MOVITOOLS®
MotionStudio and the keypad. The SET statement of a value for a variable in an
IPOSplus® program is always stored in the volatile memory. To store the current status
in the non-volatile memory, the command MEM must be performed in the IPOSplus® pro-
gram.
INFORMATION
When using the MEM command note that the variables stored in the non-volatile mem-
ory (H0 – 127) and all parameters are not written cyclically. This is because the num-
ber of storage operations with the storage medium EEPROM is restricted to 105 stor-
age operations.
DI00
MOVITRAC® 07 only
has the terminals
DI05 DI01 ... DI05
Level
Example Jump to label 20 if the inputs DI03 and DI04 have a high signal (1), otherwise the next
command line is processed:
512410763
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
INPUT LVL B (MOVIDRIVE® B). In the process, the bits of the H483 system variable
are each assigned to one hardware input.
The assignment of the H483 system variables for MOVIDRIVE® A / H520 for
MOVIDRIVE® B to the binary input terminals in described in the section "IPOSplus® Vari-
ables / Overview of the system variables".
The binary inputs in the IPOSplus® program can be queried using the value of the vari-
ables H483/H520. This is useful for querying inputs to be used to transfer a binary-
coded, for example, for selecting a table position.
Table 3: Example of transmitting a binary-coded value via input terminals of MOVIDRIVE® A
Example: Reading inputs Unit's binary inputs
Terminal designation DI05 DI04 DI03 DI02 DI01 DI00
Significance 25 24 23 22 21 20
Terminal level 1 0 0 0 1 1
Evaluation 1 × 25 0 × 24 0 × 23 0 × 22 1 × 21 1 × 20
Variable value H4831) 32 + 0 + 0 + 0 + 2 + 1 = 35
1) If all DIO11A/DIP11A input terminals and control word 2 are set to level "0".
Binary terminals represented with the higher value bits of variables H483/H520 can also
be queried using a combination of the BMOV and JMP commands. This is the case
when two options are installed at the same time with terminal expansion.
Alternatively, one or more terminal levels of the binary outputs can be filtered using a
logical operation with the system variables H 482 (OUTPUT LVL) / H521 (OUTPUT LVL
B). The terminal level of output DO02 is queried using the following sample program:
M1 : SET H200 = 2
AND H200 & H482
JMP H200 == 2 ,M1
The result of the AND operation is written to the first variable, that is H200. Therefore,
the first argument must be a variable.
AND operation of H200 and H482
H200 = 2 00000000010 (= DO01)
H482 = 11011100110 (= current status of the binary outputs)
Result 00000000010 (= the jump is performed, as H200 = 2)
Setting the binary To set the outputs, the binary outputs (parameters 620/621 (MOVIDRIVE® A), 620
outputs ... 626 (MOVIDRIVE® B), 630 ... 637) must be set to "IPOS OUTPUT".
Digital outputs are set using the system variables:
• H 480 (OPT. OUT IP) for option DIO11 / DIP11 (DO10 ... DO17)
• H 481 (STD. OUT IP) for the basic unit (DO01 / DO02 (MOVIDRIVE® A) DO01 ...
DO05 (MOVIDRIVE® B); DB00 is set to "/Brake". The brake is controlled directly by
the firmware. As a result, the output cannot be written.)
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
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.
Table 5: Assigning system variable H480/H481 to binary output terminals
Binary outputs Binary outputs DIO11A/DIP11A option H480 Binary outputs of
basic unit
Terminal des. DO17 DO16 DO15 DO14 DO13 DO12 DO11 DO10 DO02 DO01 DB00
Bits of the system 7 6 5 4 3 2 1 0 2 1 0
variables
Significance 27 26 25 24 23 22 21 20 22 21 20
Example Output table position number 11 via DIO11 ("11" requires 3 outputs; that is, outputs
DO10, DO11 und DO13):
SET H480 = 11
All binary outputs are reset by setting the system variables H480 and H481 to "0".
This only makes sense if all outputs are set as IPOSplus® outputs. Outputs with other
parameter settings are written by the firmware and should not be modified.
SET H480 = 0 Reset the outputs of option DIO11 or DIP11
SET H481 = 0 Reset the outputs of the basic unit
The analog inputs are differential inputs. The inputs/outputs can be used optionally as
either voltage or current inputs/outputs.
Table 7: Assigning value ranges to variable values
Input/output Value range Variable value
Output - 10 ... 0 ... + 10 V - 10 000 ... 0 ... + 10 000
0 ... + 10 V 0 ... + 10 000
0 ... + 20 mA 0 ... + 10 000
4 ... + 20 mA 0 ... + 10 000
Input - 10 ... 0 ... + 10 V - 10 000 ... 0 ... + 10 000
0 ... + 10 V 0 ... + 10 000
0 ... + 20 mA 0 ... + 5 000
4 ... + 20 mA 1000 ... + 5 000
Assignment of value range / variable value for analog outputs is only valid if the scaling
factor of the parameter P110 is set to 1.
INFORMATION
Prerequisite for setting: The corresponding analog output (P640 and P643) must be
set to "IPOS OUTPUT".
The analog outputs are set using the H479 (ANA.OUT IP) and H478 (ANA.OUT IP2)
system variables.
Command SET H479 = K (K = any constant within the aforementioned value range)
SET H479 describes analog output 1
SET H478 describes analog output 2
23 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.
• The bit instances in the variables and constants have the numbers 0 ... 31. The least
significant bit has the number 0.
CPEQ H = H == H CPEQ
COMPARE EQUAL H = H == K (page 355)
ORL H = H ¦¦ H ORL
LOGICAL OR (page 358)
ADD The ADD command adds a variable to a constant and a variable (observing the signs).
Command structure Mxxx: Label (optional)
Mxxx ADD X1 + X2 X1: Variable (summand and sum)
X2: Variable or constant (summand)
ADD HXX + HYY Variable HXX is the sum of variables HXX and HYY.
ADD HXX + K Variable HXX is the sum of variables HXX and a constant K.
Example 1 SET H01 = 100ADD H01 + H01
After the ADD command, H01 = 200.
Example 2 SET H01 = 100ADD H01 + 1
After the ADD command, H01 = 101.
Example 3 SET H01 = 2000000000SET [0x77359400][0x77359400][0
H02 = 2000000000ADD H01 + xEE6B2800]
H02
The number range has been exceeded.
After addition, H01 has the value -294967296.
Note If the number range is exceeded during addition, the result is incorrect.
There is no error message.
SUB/SUBTRACT The SUB command subtracts a variable or constant from a variable (observing the
signs).
Command structure Mxxx: Label (optional)
Mxxx SUB X1 - X2 X1: Variable (minuend and difference)
X2: Variable or constant (subtrahend)
SUB HXX - HYY Variable HXX is the result of the subtraction of variables HXX and HYY.
SUB HXX - K Variable HXX is the result of the subtraction of variables HXX and a con-
stant K.
Example 1 SET H01 = -10SET H02 = +50SUB H01 - H02
After the SUB command, H01 = -60.
Example 2 SET H01 = +50SET H02 = - [0x00000032][0x80000030][0
2147483600SUB H01 - H02 x80000002]
The number range has been exceeded. After subtraction, H01 has the
value -2147483646.
Note If the number range is exceeded during subtraction, the result is incorrect.
There is no error message.
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.
MUL HXX * K Variable HXX is the result of the multiplication of variable HXX and a con-
stant K.
Example 1 SET H01 = -3MUL H01 * 50
After the MUL command, H01 = -150.
Example 2 SET H01 = +50000SET H02 = [0x0000C350][0x0000C350][0
+50000MUL H01 * H02 x9502F900]
The number range has been exceeded. After multiplication, H01 has the
value -1794967296.
Note If the number range is exceeded during multiplication, the result is incor-
rect. There is no error message.
DIV/DIVISION The DIV command divides a variable by a variable or a constant (observing the signs).
The result is the predecimal number of the quotient.
Command structure Mxxx: Label (optional)
Mxxx DIV X1/X2 X1: Variable (dividend and quotient)
X2: Variable or constant (divisor)
DIV HXX/HYY Variable HXX is the result of the division of variables HXX and HYY.
DIV HXX/K Variable HXX is the result of the division of variables HXX and a constant
K.
Example SET H01 = -13SET H02 = +3DIV H01/H02
After the DIV command, H01 = -4.
Note Division by zero leads to an undefined result. There is no error message.
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)
X2: Variable or constant (divisor)
MOD HXX mod HYY Variable HXX is the integer remainder after division of variables HXX and
HYY.
MOD HXX mod K Variable HXX is the integer remainder after division of variable HXX and a
constant K.
Example 1 SET H01 = -17SET H02 = - SET H01 = -17SET H02 =
5MOD H01 mod H02 +5MOD H01 mod H02
After the MOD command, H01 = -2.
Example 2 SET H01 = +17SET H02 = SET H01 = +17SET H02 = -
+5MOD H01 mod H02 5MOD H01 mod H02
After the MOD command, H01 = +2.
XOR 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.
XOR HXX XOR K Variable HXX is the bit-by-bit XOR operation of variable HXX and a con-
stant K.
Example SET H01 = 65535XOR H01 XOR [0x00000FFF][0x0000FF0F]
F0F0 hex
After the XOR command, H01 = 0xFF0F.
SHL/SHIFT LEFT The SHL command moves the content of a variable to the left by the number of bits
specified in a variable or constant. Zeros are moved along from the right.
Command structure Mxxx: Label (optional)
Mxxx SHL X1 << X2 X1: Variable (result and output value)
X2: Variable or constant (number of shift operations)
SHL HXX << HYY In variable HXX the bits are shifted HYY places to the left.
SHL HXX << K In variable HXX the bits are shifted by K places to the left.
Example 1 SET H01 = 31SET H02 = 1SHL [0b0000000000011111][0b000
H01 << H02 0000000111110]
After the SHL command, H01 = 62.
Example 2 A certain binary significance is assigned to the output terminals of the
basic unit and the DIO11A option. To use outputs DO10 ... DO13 for table
positioning in a useful manner (4 entries = 0 ... 15 positions), shift the sig-
nificance of the outputs so that the terminal with the lowest value DO10
receives the significance 20.
SET H01 = 15SET H02 = 6SHL [0b0000000000001111][0b000
H01 << H02 0001111000000]
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 >> X2 X1: Variable (result and output value)
X2: Variable or constant (number of shift operations)
SHR HXX >> HYY In variable HXX the bits are shifted HYY places to the right.
SHR HXX >> K In variable HXX the bits are shifted K places to the right.
Example 1 SET H01 = 62SET H02 = 1SHR [0b0000000000111110][0b000
H01 > > H02 0000000011111]
After the SHR command, H01 = 31.
Example 2 A certain binary significance is assigned to the input terminals of the basic
unit and the DIO11A option. To use inputs DI10 ... DI13 for table position-
ing in a useful manner (4 entries = 0 ... 15 positions), shift the significance
of the inputs so that the terminal with the lowest value DI10 receives the
significance 20.
SET H01 = 960SET H02 = [0b0000001111000000][0b000
6SHR H01 > > H02 0000000001111]
ASHR/ARITHME- The ASHR command shifts the content of a variable to the right by the number of bits
TIC SHIFT RIGHT specified in a variable or constant. Either zeros or ones are shifted along from the left,
depending on the sign of the original value. This ensures that a negative sign is kept dur-
ing shift operations.
For positive numbers, the command supplies the predecimal number of the division X1/
X2. For negative numbers, the command supplies the predecimal number of the division
X1/X2 - 1.
Command structure Mxxx: Label (optional)
Mxxx ASHR X1 >> X2 X1: Variable (result and output value)
X2: Variable or constant (number of shift operations)
ASHR HXX >> HYY In variable HXX the bits are shifted HYY places to the right.
ASHR HXX >> K In variable HXX the bits are shifted K places to the right.
Example 1 SET H01 = 7ASHR H01 > > 2 [0b0000000000000111][0b000
0000000000001]
After the SHR command, H01 = 1.
Example 2 SET H01 = -7ASHR H01 > > 2 [0b1111111111111001][0b111
1111111111110]
After the ASHR command, H01 = -2.
BCLR/BIT CLEAR The BCLEAR command sets a bit within a variable to 0. 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 cleared in the system variable H481 STD.OUT IP, it resets a bi-
nary output directly. You must set the output to IPOS OUTPUT in parameters P62x in
SHELL beforehand.
Command structure Mxxx: Label (optional)
Mxxx BCLEAR HX1.X2 = 1 X1: Target variable
X2: Bit position in a target variable
BCLEAR HXX.YY = 0 In variable HXX, bit YY is set to 0.
Example SHELL: P621 = IPOS OUTPUT
BCLEAR H481.2 = 0
After the BCLEAR command has been performed, the 3rd bit is cleared in
variable H481 and output DO02.
Note If the output is reserved for a different function (for example, P621 =
MOTOR STANDSTILL), the bit is cleared in H481, but not the binary out-
put.
BMOV/BIT MOVE The BMOV command copies a bit from one variable in a bit in another variable. The bit
places of a variable have the numbers 0 ... 31. The least significant bit has the number 0.
Command structure Mxxx: Label (optional)
Mxxx BMOV HX1.X2 = X1: Target variable
HX3.X4 X2: Bit position in a target variable
X3: Source variable
X4: Bit position in a source variable
BMOV HXX.YY = HZZ.AA In variable HXX, the bit YY is set to the value of bit AA of the variable HZZ.
Example 1 BMOV H2.4 = H7.5
The command copies bit 5 of variable H7 into bit 4 of variable H2.
Example 2 SET H200 = 0BMOV H200.0 = H473.20JMP H200 == 1 M01
The program jumps to the label M01 when the drive is referenced (H473
STAT. WORD).
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.
Command structure Mxxx: Label (optional)
Mxxx BMOVN HX1.X2 = X1: Target variable
HX3.X4 X2: Bit position in a target variable
X3: Source variable
X4: Bit position in a source variable
BMOVN HXX.YY = HZZ.AA In variable HXX, the bit YY is set to the negated value of bit AA of the vari-
able HZZ.
Example 1 BMOVN H2.4 = H7.5
The command copies the negated bit 5 of variable H7 into bit 4 of variable
H2.
Example 1 SET H200 = 0BMOV H200.0 = H473.20JMP H200 == 1 M01
The program jumps to the label M01 when reference travel has not yet
been performed for the drive (H473 STAT. WORD).
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) 0...99: Single address
100...199: Group address
253: Address of the inverter
254: Point-to-point connection
255: Broadcast
If an SBus group address (e.g. 43) is addressed, the offset 100
must be added. In this case 143.
Format (H+2) Specification of the process (PD) and parameter (PARAM) chan-
nels for data transfer:
//MoviLink Cyclic Frame Types //Acyclic
ML_FT_PAR1 = 0: PARAM+1PD ML_CFT_PAR1 = 128
ML_FT_1 = 1: 1PD ML_CFT_1 = 129
ML_FT_PAR2 = 2: PARAM+2PD ML_CFT_PAR2 = 130
ML_FT_2 = 3: 2PD ML_CFT_2 = 131
ML_FT_PAR3 = 4: PARAM+3PD ML_CFT_PAR3 = 132
ML_FT_3 = 5: 3PD ML_CFT_3 = 133
ML_FT_PAR = 6: Parameter (without ML_CFT_PAR = 134
PD)
Service (H+3) Communication service for parameters
ML_S_RD = 1: Read service
ML_S_WR = 2: Write to non-volatile memory
ML_S_WRV = 3: Writing without saving
Index (H+4) Index number of the parameter to be modified or read (see param-
eter index directory)
The subindex must be entered in the index element on bits 23-16
(least significant byte of the high word).
Calculation: H+4 or
MOVILNK.Index = Index + (SubIndex << 16);
DPointer (H+5) Number of the variable from which the read data is stored or from
which the data to be written is obtained (structure MLDATA)
Result (H+6) Contains the error code after the service has been performed or
contains zero if there was no error (see "Parameterization Return
Codes" in the "Communication and Fieldbus Unit Profile" manual
with "parameter list").
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) Process input data 1
PI2 (H"+6) Process input data 2
PI3 (H"+7) Process input data 3
Structure
Command structure Mxxx: Label (optional)
Mxxx MOVLNK X1 X1: Starting variable of the command structure
MOVLNK HXX The MOVLNK command is performed using the command structure data
starting in variable HXX.
Parameter set- Description, see Parameter settings for the sender (master) (page 225)
tings for the sender
(master)
Parameter set- Description, see Parameter settings for the receiver (page 226)
tings for the
receiver
514449547
Example 2 Axis-to-axis communication: Reading variables from another inverter via SBus
The value of variable H005 on the receiver axis is read and written to variable H010 in
the sender. To do this, it is necessary to have 2 inverters connected via the SBus and
for the terminating resistors to be activated (using DIP switch S12).
514453899
H0 Bus-Type 5 = SBus
H1 Address 2 = SBus address of receiver (slave)
H2 Frametype 134 = only Para
H3 Service 1 = Read
H4 Index 11005 = Index of H5
H5 D-Pointer 9 = Data pointer value at H9
514510219
H0 Bus-Type 2 = RS-485
H1 Address 1 = RS-485 address of the receiver (MOVIMOT®)
H2 Frametype 133 = 3PD
H3 Service 3 = Writing without saving
H4 Index 0 = not relevant for PD
H5 D-Pointer 12 = Data pointer value at H12
H12 6 = PO1 Control word
H13 50 = PO2 speed in percent
H14 50 = PO3 ramp in percent
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... at the sender). Acyclical communication deactivates the timeout
monitoring of MOVIMOT®.
Once cyclical communication has been started with the _MovCommOn command,
only the _MoviLink command to address 253 (internal) is possible. When using the
_MoviLink command, other units can no longer be accessed.
23.5.2 MOVCOM
The command can be used with MQx only. The MovComm commands enable cyclical
data exchange between MQx and up to 8 MOVIMOT® units via the RS-485 interface
with the MOVILINK profile.
For a detailed description, refer to _MovCommDef (page 227).
The variable is defined by the MOVCOM variable name; in the Compiler and has the
following structure.
BusType (H+0) Bus type (interface)
ML_BT_S1 = 2 (RS485 to MOVIMOT®)
Address (H+1) Individual address or group address for the MOVIMOT®to be addressed
0 ... 99 single addressing
100 ... 199 group addressing
255 broadcast
Format (H+2) Entry of process data for data transfer
3 = 2 process data words cyclically (for MOVIMOT®) = ML_FT_2
5 = 3 process data words cyclically (for MOVIMOT®) = ML_FT_3
Pd Pointer (H+3) Number of the variable H" in which the process data is stored or from which
the data to be written is obtained.
(The data structure for H" is described in detail below.)
Para Pointer (H+4) Number of the variable H' in which the parameter data is stored or from
which the data to be written is obtained.
MOVIMOT® does not support this function.
Sample program
514515083
23.5.3 MOVON
The command cannot be used with MOVIDRIVE®.
The command starts the cyclical communication. Communication links set up using the
MovCommDef command are activated. As of this point, you can no longer use MovCom-
mDef or MOVILINK commands. Only the MOVILINK command to address 253 (internal)
can still be used.
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. In the latter two cases, the transfer must also be started with
SCOMON or SCOMSTATE.
Data exchange is only possible via the system bus and it transfers all the content of the
variables. Data exchange within the inverter is not possible. A standard CAN telegram
(11 bit identifier) is used instead of a SEW's own protocol (MOVILINK) so that the sys-
tem can also communication with non-SEW products (see the "MOVIDRIVE® Serial
Communication" manual).
In accordance with the consumer/producer principle, every unit can send objects to one
or more units and receive objects from one or more units simultaneously.
The bus run time for a message is ≤ 2 ms and depends on the baudrate setting. Com-
munication with MOVIMOT® or the MQ fieldbus interface is not possible.
Structure
Command structure Mxxx: Label (optional)
Mxxx SCOM X1, X2 X1: TRANSMIT CYCLIC: Cyclical send
RECEIVE: Receive
TRANSMIT ACYCLIC: Acyclical send
X2 Hxx = Start of object structure for communication
and user data
The design of the object structure is dependent on the first argument X1.
[3]
SCOM RECEIVE, H0
+ SCOMON
H0 = 1102
SCOM
514545547
Unit [1] sends the object with the no. 1100 cyclically or acyclically.
Unit [2] receives the data. Unit [3] ignores data but is waiting for data with object number
1102.
INFORMATION
Observe the following rules when selecting the object number:
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 once for sending
or once for receiving.
See also _SbusCommDef (page 227)
TRANSMIT This argument initializes a data object whose user data is sent cyclically according to
CYCLIC: the SCOMON command. Variable H of the SCOM TRANSMIT CYCLIC H command de-
fines the start of the communication and user data.
Cyclical data exchange runs in the background once it has been started, regardless of
the current command processing in the IPOSplus® program. If the program is stopped,
the data transfer stops automatically. A change of the data object will only become ac-
tive following an IPOSplus® program restart (F5 A/P-STOP / F9 P-Start, or mains (24V
auxiliary operation) turned off and then on again)
Pro SCOM TRANSMIT... command can set up one data object at the most. Additional
SCOM TRANSMIT commands must be sent if additional data objects are to be set up.
Only one SCOMON command is required following several SCOM TRANSMIT com-
mands. After the first SCOMON command, no other SCOM TRANSMIT commands are
accepted.
The number of objects that can be set up depends on the cycle time (max. 5 objects at
1 – 9 ms, max. 10 objects at 10 – 65530 ms, i.e. 15 objects in total).
Object structure
H+0 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.
H+1 Cycle time in ms: Specifies the time interval after which the data is sent again.
Valid cycle times:
See _SbusCommDef (page 227)
Note:
The value 0 ms causes an error message to be issued in the return code.
The cycle time must always exceed the longest offset time.
H+2 Offset in ms distributes the bus load when several SCOM TRANSMIT... commands are used.
tcycle toffset
514549899
Valid offset times:
See _SbusCommDef (page 227)
H+3 Number of data bytes and data format
H+4 Number of variable H" at which the data to be sent are to start.
H+5 Result (Return Code) of SCOM command
≥0 Free bus capacity in % (calculated value of this unit)
-1 Incorrect cycle time
-2 Too many objects set up
-3 Bus overload
-5 Wrong object number
-6 Wrong length
Ensure that the entire calculated bus utilization does not exceed 70% for additional data
exchange between slaves.
The bus utilization is calculated in bits per second using the formula:
Number of telegrams × bits/telegram × 1/cycle time
For example, 2 messages with 100 bits in 1 ms cycle = 200000 bits/s = 200 kBaud
This results in the following bus load percentage in reference to the selected baud rate.
For example, 200 kBaud / 500 kBaud = 40% < 70%
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. To do
so, set the variable pointer (H+2) accordingly in the IPOSplus® program before calling
each command.
Object structure
H+0 Object number (CAN-Bus-ID): The object number is used for addressing the data object. An
object number can only be allocated once in a bus system. The object numbers of the sender
(TRANSMIT) and receiver (RECEIVE) must be the same for the data exchange. The object
numbers > 1024 ... 2048 should be used to avoid a data clash whenever MOVLNK com-
mands are also used via the SBus.
H+1 Number of data bytes and data format
H+2 Number of variable H" at which the data to be sent are to start.
H+3 Status of the transmission command
0 Ready
1 Sending
2 Sending successful
10 Send error
INFORMATION
Prior to transmitting acyclical telegrams, the SBus must also be activated with
SCOMON and SCOMSTATE.
The IPOSplus® program waits at this command until the message has been sent. If no
other station is connected the telegram cannot be sent. The wait status can only be
ended by a monitoring function, for example, from another task.
RECEIVE This argument initializes a data object that contains data received cyclically or acycli-
cally. The variable in the argument of the SCOM RECEIVE command contains the vari-
able number as of which the receive data is to be stored.
The process of reading in the data must be started with the SCOMON command. The
process of reading in data runs in the background once it has been started, regardless
of the current command processing in the IPOSplus® program. After the first SCOMON
command, no other SCOM RECEIVE commands are accepted. A change of the data
object will only become active following an IPOSplus® program restart (F5 A/P-STOP /
F9 P-Start, or mains (24V auxiliary operation) turned off and then on again)
You can set up max. 32 data objects for reading in data.
Object structure
H+0 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.
H+1 Number of data bytes and data format
H+2 Number of the variable H" from which point the received data is stored
Differences in user data formats MOTOROLA and INTEL:
INFORMATION
In order to send or receive the data via SBus2, you have to add 0x1000000 to the ob-
ject number (OR operation).
With the SCOM command, even the variables that can be stored in the non-volatile
memory (H0 – H127) and all the parameters are only written in the volatile memory.
Example 1 Cyclical transmission of two variable values (H008 and H009) with the SCOM command
from the sender to the receiver to variables H005 and H006.
Sender settings
514587147
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
INFORMATION
The synchronization procedure (sync ID) has been modified from MOVIDRIVE A. In
contrast to MOVIDRIVE® A, for MOVIDRIVE® B you must ensure that in the IPOSplus®
program of the master drive the actual position is initialized first and then the sync ob-
ject with SCOM().
23.5.5 SCOMON
System Bus Communication On
This command triggers the reception of data or the cyclical transmission of previously
defined data objects.
The SCOM command initializes the data objects with the arguments RECEIVE (receiv-
ing data) or TRANSMIT CYCLIC (sending data cyclically).
In MOVIDRIVE® B, the command has been replaced by SCOMST. However, due to
downward compatibility, it can still be used with MOVIDRIVE® B.
INFORMATION
This command only activates SBus 1, not SBus 2
• Preferably use the SCOMSTATE command.
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.
Regardless of the value for "X1", with MOVITRAC® B, the SCOMST X1 command al-
ways has the same effect as SCOMON (page 321).
Argument Meaning
START ALL Starts cyclical communication synchronously from SBus 1 and SBus 2
STOP ALL Stops cyclical communication synchronously from SBus 1 and SBus 2
START1 Starts cyclical communication from SBus 1
STOP1 Stops cyclical communication from SBus 1
START2 Starts cyclical communication from SBus 2
STOP2 Stops cyclical communication from SBus 2
Structure
Command structure Mxxx: Label (optional)
Mxxx SCOMST X1 X1: Argument
514597259
C (conditional) Only performs reference travel if the drive has not been referenced already
(that is, H473, Bit 20 = 0).
U (unconditional) Always performs reference travel.
W (wait) Waits until the axis has been referenced. No other task is performed in the
mean time.
NW (non-wait) The next command is processed during reference travel (recommended).
ZP (zero pulse) References to the zero pulse of the encoder signal (not significant if 903 = 0
or P903 = 5).
CAM (reference cam) References to the reference cam (not significant if 903 = 0 or P903 = 5).
RESET Reference travel which has started is interrupted (brakes at positioning
ramp) and the call is reset. For a reference axis, the message "Axis refer-
enced" is reset and the message "Axis in position" is set.
Parameter settings
P60_ If a reference cam is used, one input must be set to the REFERENCE CAM function.
P900 Reference offset (writes H498).
P901/ Reference speeds.
P902
P903 The reference travel type and the argument ZP / CAM determine the condition required to end
reference travel.
Example: P903 = 1, GO0 U,W,ZP
The zero pulse is evaluated according to the reference cam.
P904 Not significant for GO0.
INFORMATION
The controller must be enabled to set an absolute encoder using the GO0 command.
Alternatively, the encoder can be set without an enable by setting the offset P905 for
Hiperface® or the parameters P953 ... P955 for an SSI encoder (DIP) .
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. The same danger applies when the
holding brake is released.
One way to prevent this from happening is to position the drive once reference travel
is complete so that the drive is positioned a sufficient distance away from the hardware
limit switch ( approximately 0.5 ... 1 motor revolution) .
If the software limit switches have been set via parameter P920/P921, the software limit
switches are only monitored once reference travel is complete.
If the drive is not connected to an absolute or Hiperface® encoder, the reference point
is lost after an error message occurs and the drive has to be RESET.
INFORMATION
If a waiting referencing command is interrupted by withdrawing the "/controller inhibit",
the error code 39 (reference travel) is set.
The axis does not start up once the signal has been restored. The IPOSplus® program
stops at this command.
A reset must be performed (binary input, fieldbus, SHELL ...). The IPOSplus® program
starts at the beginning of the first statement.
Structure
Command structure Mxxx: Label (optional)
Mxxx GO0 X1 X1: Type of reference travel
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). Constants can be entered in user
travel units.
INFORMATION
If the modulo function is used for positioning, the commands GOA and GOR cannot
be used; the target positions are written directly to H454.
INFORMATION
Axes turning in one direction, for example, turntables, conveyor belts or roll feeders
are usually described as modulo axes (see the modulo function P960 ... P963). In this
case, a mechanical position of the axis corresponds to an actual value H455, irrespec-
tive of the number of revolutions turned (for prerequisites for this function, see the de-
scription of the modulo function).
GOA/GO ABSO- This command performs absolute positioning to the position specified in the second ar-
LUTE gument X2. Argument X2 can be a constant, variable or an indirect variable.
The target position based on position 0 (machine zero) is entered as the travel distance.
The resulting target position is reflected in the system variables H492 (TARGET POSI-
TION).
The message "IPOS in position" is updated within a GOA or GOR command; that is, the
message can be queried directly in the next program line.
Structure
Command structure Mxxx: Label (optional)
Mxxx GOA X1 X2 X1: NoWait: Program processing is continued while the drive is
still moving. This permits the program to be processed at the
same time as the travel movement.
Wait: Program processing does not continue until the actual
position of the drive has reached the position window P922 of
the target position.
X2: K = Target position in user units as a constant.
H = Target position in user units as a variable.
[H] = variable, that contains the target position in increments,
based on 4096 increments/motor revolution.
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.
The message "IPOS in position" is updated within a GOA or GOR command; that is, the
message can be queried directly in the next program line.
Structure
Command structure Mxxx: Label (optional)
Mxxx GOR X1 X2 X1: NoWait: Program processing is continued while the drive is
still moving. This permits the program to be processed at the
same time as the travel movement (recommended).
Wait: Program processing does not continue until the actual
position of the drive has reached the position window P922 of
the target position.
X2: K = Target position in user units as a constant.
H = Target position in user units as a variable.
[H] = variable, that contains the target position in increments,
based on 4096 increments/motor revolution.
Example 1 The program shown below causes the drive to travel between the positions 0 revolu-
tions. and 100 revolutions (entry in the program header: numerator, denominator, unit).
A waiting period of 5 seconds elapses when a position is reached.
n
3000 rpm
0 100 revolutions
515070219
1
2
3
4
5
515071755
1. Reference travel
2. Travel to zero
3. Wait 5 s
4. Travel to 100
5. Wait 5 s
Once the END command has been performed, the IPOSplus® 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. The entire return travel takes place at 3,000 rpm.
n
3000 rpm
100 rpm
1
2
3
4
5
6
7
8
9
10
11
12
13
515074827
Endless positioning
The absolute travel range of IPOSplus® is limited to values in the range –231 ... 0 ... 231
–1. With the relative travel command, a maximum travel distance of 231 can be added
to any actual position (see number circle).
An example of infinite positioning is shown in the jog mode sample program.
INFORMATION
The GOR command always refers to target position H492. For example, if the GOR
1000 incr. command is sent 100 times in a program, the target position is set internally
to 100 x 1000 increments. The position setpoint may shift away from the actual posi-
tion of the motor if the command is called up cyclically. The IPOS control may then fail
as of a critical value 231/2 (drive turns in the opposite direction).
515076363
INFORMATION
Do not exit subroutines by jumping to a main program or another subroutine. Condi-
tional exiting of the subroutine must be performed by jumping to the end of the sub-
routine.
Structure
Command structure Mxxx: Label (optional)
Mxxx CALL Myyy Myyy = Label as of which subroutine begins.
Example The main program positions the drive 10 revolutions CCW, after which there is a sub-
routine call (CALL M1). Set 2 outputs of the basic unit for 1 s (the output parameters
must be set to "IPOS-OUTPUT"). The jump back to the main program (RET) takes place
next and the GOR WAIT #10 positioning command is processed.
515186699
Structure
Command structure Mxxx: Label (optional)
Mxxx JMP X1 X2, Myyy X1: HI= Jump if the input terminals marked in the mask are set to
level 1.
LO= Jump if the input terminals marked in the mask are set to
level 0.
X2: Ixxx ... = Mask for the input terminals.
Myyy: Jump label to which the program branches.
515191051
JMP/comparison The JPM command causes the program to jump to a specified label when comparison
in the command results in a true statement.
Structure
Command structure Mxxx: Label (optional)
Mxxx JMP X1 OP X2, Myyy X1: Variable
OP: Operator: > / > = / < / <= / = / !=
X2: H = variable
K = constant
0 = zero (in a comparison with zero, only the operators = and
!= are possible).
Myyy: Jump label to which the program jumps if the condition is ful-
filled.
515195787
JMP/System Jumps to the label indicated in the command if comparison operation is fulfilled.
The system values listed can be queried directly by means of a JMP command. Other
system values are available as system variables or must be read in using the GETSYS
command and processed further.
Structure
Command structure Mxxx: Label (optional)
Mxxx JMP X1, Myyy X1: UNCONDITIONED: Unconditional jump.
N == 0: Jump if the speed is equal to zero.
N != 0: Jump if the speed is not equal to zero.
NOT IN POSITION: Jump if not in position
TP1: Jump if there is an edge change at touch probe terminal
DI02.
NOT TP1: Jump if there is not an edge change at touch probe
terminal DI02.
TP2: Jump if there is an edge change at touch probe terminal
DI03.
NOT TP2: Jump if there is not an edge change at touch probe
terminal DI03.
Myyy: Jump label to which the program jumps if the condition is ful-
filled.
515235723
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 (> 0) is specified as a constant. The loop ends at the associated
LOOP command. Program loops can be nested.
If the number of loop cycles is to be variable, a JMP command must be used instead of
a LOOP command and the variable condition must be checked at each cycle.
Structure
Command structure Mxxx: Label (optional)
Mxxx LOOPB X1 X1: Number of loop cycles (maximum 256)
LOOPE/LOOP This command specifies the end of a program loop that was started using the LOOPB
END command.
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- No operation is performed. This command can be used, for example, to achieve wait
TION times on the basis of the command cycle time. In MOVIDRIVE® A, for example, this is
1 command/ms in task 1.
Structure
Command structure Mxxx: Label (optional)
Mxxx NOP
REM/REMARK The REM command adds a remark line to the program. Remark lines cannot be saved
in the inverter. All remark lines are lost after DOWNLOAD of the program followed by an
UPLOAD.
Remark lines can only be saved in program files on the PC.
Structure
Command structure X1: Any string
REM X1
RET/RETURN The RET command terminates a subroutine (see the CALL command) and jumps back
to the program from which the subroutine was called. In a main program, the RET com-
mand causes a jump back to the beginning of the main program.
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. The control word and start address are both set to 0 when the power is switched
on, i.e. Task2 is deactivated.
This command is only available as of MOVIDRIVE® B.
Structure
Command structure Mxxx: Label (optional)
Mxxx TASK X1 Myyy X1: TASK2 STOP: Stop task 2.
TASK2 START: Start task 2.
TASK3 STOP: Stop task 3.
TASK3 START: Start task 3.
Myyy: Label at which the task starts.
TASK2 This command is used to define the start address of TASK2 and to start or stop these
with the argument X1 (START/STOP); that is, the control word of TASK2 is written. The
control word and start address are both set to 0 when the power is switched on, i.e.
TASK2 is deactivated.
In MOVIDRIVE® B, the command has been replaced by TASK. However, due to down-
ward compatibility, it can still be used with MOVIDRIVE® B.
Structure
Command structure Mxxx: Label (optional)
Mxxx TASK2 X1 Myyy X1: STOP: Stop task 2.
START: Start task 2.
Myyy: Label at which task 2 starts.
515247499
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.
Structure
Command structure Mxxx: Label (optional)
Mxxx WAIT X1 X1: Waiting time in ms, 0 ... 32767.
Structure
Command structure Mxxx: Label (optional)
Mxxx COPY X1 = X2, X3 X1: Hxxx = Number of the first target variable.
X2: Hyyy = Number of the first source variable.
X3: K = Constant (number of variables to be copied, 1 ... 10).
Myyy: Jump label to which the program jumps if the condition is ful-
filled.
Structure
Command structure Mxxx: Label (optional)
Mxxx GETSYS X1 X2 X1: Hxxx = Start of the variable structure containing the result
after the command has been performed.
X2:
ACTIVE CURRENT Active current in 0.1% rated unit current
ACT.SPEED actual speed in 0.1% rpm
SETP.SPEED Setpoint speed in 0.1% rpm
ERROR Error code according to the "Error messages and list of errors" table in the system
manual
SYSTEM STATUS Operating status, value of the 7-segment display without fault status in accordance
with the table "Operating display" in the system manual
ACT.POSITION Actual position depending on the encoder selected in P941 H509, H510 or H511
SETP.POSITION Setpoint position (current setpoint selection of the profile generator whilst a travel
command is being carried out), identical to system variable H491
TARGET POSITION Target position, identical to system variable H492
INPUTS Binary inputs H483 (MOVIDRIVE® A) / H520 (MOVIDRIVE® B) of the basic unit
and options; identical to system variable H483.
DEVICE STATUS Identical to status word 1 of the fieldbus unit profile (fault code + operating status)
OUTPUTS Binary outputs H482 (MOVIDRIVE® A) / H521 (MOVIDRIVE® B) of the basic unit
and the option
IxT Unit utilization in 0.1% rated unit current
ACT.POSITION / SETP.POSITION / TARGET POSITION: Resolution depends on the encoder selected in P941:
– Motor encoder: 4096 Inc./revolution
– External encoder X14: Encoder resolution P944
– DIP (SSI encoder): Encoder resolution P955
ANALOG INPUTS -10 V ... 0 ... +10 V = -10000 ... 0 ... 10000
H+0 Voltage value analog input 1 [mV]
H+1 Voltage value analog input 2 [mV]
CAM 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.
With MOVIDRIVE® units, you can use an extended cam controller with 8 outputs.
Hxx is the first variable of a data structure (CamControl). The bit with the highest
significance (bit 31) is used in Hxx to decide which cam controller the GETSYS
command refers to.
Bit 31 = 0: Standard cam controller (all MOVIDRIVE® units). The GETSYS com-
mand activates the cam controller. The cams are formed once when the GETSYS
command is processed. If the standard cam controller is to process cyclically, the
command must be called up cyclically.
Bit 31 = 1: Extended cam controller with technology option and CFC or SERVO
mode). The GETSYS command activates the cam controller, the cams are formed
cyclically in the background.
The structure of the variables depends on whether the standard or expanded cam
controller is called.
The data structure is described in section "Position Detection and "Positioning/cam
controllers".
515353867
ANALOG OUTPUTS +/- 10 V correspond to +/- 10000
H The variable in the GETSYS H = ANALOG OUTPUTS command defines the
beginning of the following variable structure.
H+0 Contains the voltage value of analog output 1 (AO1)
H+1 Contains the voltage value of analog output 1 (AO2)
TIMER 0 Loads the current value of timer 0 [ms], identical to system variable H489
TIMER 1 Loads the current value of timer 1 [ms], identical to system variable H488
PO-DATA Reads the PO data buffer (data sent from the master to the unit). 3 PO or 10 PO
data items are read depending on the number of PO data items.
H+0 Bus type
0 = reserved
1 = TERMINAL
2 = RS-485
3 = Fieldbus
4 = reserved
5 = SBus
8 = SBus 2 (only MOVIDRIVE® B)
H+1 Number of PO data
H+2 PO1
H+3 PO2
H+4 PO3
H+5 PO4
H+6 PO5
H+7 PO6
H+8 PO7
H+9 PO8
H+10 PO9
H+11 PO10
DC-VOLTAGE DC link voltage [V]
23.8.3 Set commands variable SET / fault response SETFR / Indirect addressing SETI / Interrupt
SETINT / system values SETSYS
SET The SET command loads argument X1 with the content of argument X2 (variable H or
constant K). The result is written to argument X1, argument X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx SET X1 = X2
X1: Hxxx = Result of the statement.
X2: Hyyy = Source.
SETFR/SET The SETFR command defines the response to a unit fault. The fault code is entered in
FAULT REACTION argument X1 of the command. The reaction to the unit fault is selected with argument 2.
The selected fault reaction will only be executed once the SETFR command has been
processed. The most recently selected fault response (call of the SETFR command or
changes in P83_ "Fault response") is the one in effect.
You can program all responses to a fault as long as it has a point in column "P" in the
fault list in the operating instructions or the system manual.
Example:
• Fault 27 "Limit switches missing", no point in column P: Cannot be programmed
• Fault 28 "Fieldbus timeout", point in column P: programmable
515358219
Structure
Command structure Mxxx: Label (optional)
Mxxx SETFR #X1 = X2
X1: 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
42: Lag error (P834)
43: RS-485 timeout (P833)
47: SBus timeout (P836)
77: IPOS control word
78: IPOS software limit switch (P838)
84: Motor protection (P832)
92: DIP operating range
93: DIP absolute encoder
X2:
NO RESPONSE No response (and no fault display).
DISPLAY FAULT No response, only the fault is displayed (the terminal level of an output pro-
grammed to "/FAULT" is set from 1 to 0).
SWITCH OFF, The output stage is inhibited, no torque, the brake is activated.
FAULT After reset: Response as for power off/on:
The IPOSplus® program, reference position, outputs, parameters (SETSYS command)
and variables set by IPOSplus® are reset (program starts in line 1).
E-STOP, FAULT The drive is stopped at the emergency stop ramp.
After reset: Response → SWITCH OFF, FAULT.
RAPID STOP, The drive is stopped at the rapid stop ramp.
FAULT After reset: Response → SWITCH OFF, FAULT.
SWITCH OFF The output stage is inhibited, no torque, the brake is activated.
WARNING IPOSplus® program continues, reference position, outputs, parameters (SETSYS com-
mand) and variables set by IPOSplus® are retained.*
E-STOP, WARNING The drive is stopped at the emergency stop ramp.
IPOSplus® program keeps running, → SWITCH OFF, WARNING.*
RAPID STOP, The drive is stopped at the rapid stop ramp.
WARNING IPOSplus® program keeps running, → SWITCH OFF, WARNING.*
* even after fault confirmation
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.
MOVIDRIVE® A range 0 ... 512), the fault message IPOS INDEX OVERFL (32) is gen-
erated.
Structure
Command structure Mxxx: Label (optional)
Mxxx SETI X1 = [X2]
X1: Hxxx = Target variable.
X2: Hyyy = Number of the source variable.
Example SET H1 = 7
SET H7 = 11
SET H3 [H1]
After the program has been run, the variables have the following values:
H1 = 7
H7 = 11
H3 = 11
SETI/SET INDI- The variable with the number in variable X1 gets the value from variable X2.
RECT [H] = H
INFORMATION
Is the number of the indirectly addressed variables outside the defined range (e. g.
MOVIDRIVE® A range 0 ... 512), the fault message IPOS INDEX OVERFL (32) is gen-
erated.
Structure
Command structure Mxxx: Label (optional)
Mxxx SETI [X1] = X2
X1: Hxxx = Number of the target variable.
X2: Hyyy = Source variable.
SETINT/SET The SETINT command sets the start address of an interrupt routine. The address is in-
INTERRUPT dicated as label in the command. An interrupt may be triggered by various events. The
events are specified in Argument X1. The interrupt routine itself must be completed with
a RET command.
A jump to the interrupt routine takes place immediately and independent of the currently
processed main program line. If the interrupt routine ends with the RET command, pro-
gram processing continues from the point where the interruption occurred (processing
of an interrupted "wait command" is continued).
The SETINT command is only in effect in task 1 and processing of task 1 is interrupted
whilst the interrupt is processed.
It is only possible to process one interrupt at a time, although an interrupt with a higher
priority can interrupt the processing of another interrupt. ERROR has the highest prior-
ity, then TOUCH PROBE, followed by TIMER 0.
An interrupt only has to be initialized once using SETINT.
515362827
Structure
Command structure Mxxx: Label (optional)
Mxxx SETINT X1, Myyy
X1:
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.
Depending on the set fault reaction (parameter group 830 or SETFR command), pro-
cessing of the interrupt routine will result in a behavior other than the one described
above:
• No interrupt is performed if the faults in parameter group 830 are set to "No
response" or if the SETFR command is set to NO RESPONSE.
• The program is restarted (see the SETFR command) after acknowledgment of the
fault, if the fault response (parameter group 830 or the SETFR command) is set
to "..., FAULT". Any reference ID that has been set is lost.
TIMER 0 Triggers an interrupt when the time set in Timer 0 H489 has elapsed. An "auto reload"
with the system variable H485 takes place after Timer 0 has elapsed. This reload
value determined the time with which the interrupt routine is executed cyclically.
TOUCH PROBE Triggers an interrupt when there is a change of signal level on the touch probe termi-
nal DI02, if the touch probe was activated for terminal DI02 (parameter P601 = IPOS
INPUT) and the TOUCHP command was transmitted.
515392779
23.8.4 SETSYS
The SETSYS command writes the value of one or more variables to an internal system
value. The first argument selects the system value to be written whilst the second argu-
ment contains the number of the (first) source variable.
The system values are reset to their original values when the system is switched off
(mains and 24 V power).
INFORMATION
Writing system values can alter unit settings that have been made for the application
during startup. In particular, changes to positioning ramps and the maximum current
must be adapted to the features of the system to preclude the risk of damage and haz-
ards (e.g. due to mechanical overload).
516336139
Structure
Command structure Mxxx: Label (optional)
Mxxx SETSYS X1, X2
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. The calculation is then started using h+0 SplineMode and either a complete cam
disk or one segment of a selected cam disk is filled. Currently, a spline 0 procedure (for opti-
mum running) and a spline 1 procedure (for section-by-section movements and straight sec-
tions) are available. The calculation is complete after ≤ 200 ms.
– H+0 = SplineMode: (Value range: 0 ... 3)
• = 0: Interpolation not active, or calculation is finished
• = 1: Start interpolation, enter interpolated values from index 0 starting with the
electronic cam (in ascending order, from index 0 to 512).
• = 2: Start interpolation, enter interpolated values from index 512 starting with the
electronic cam (in descending order, from index 512 to 0).
• = 3: Preparatory parameter calculation for interpolation concluded; start entering
interpolated values in the electronic cam.
– H+1 = SplineModeControl:
Reserved
– H+2 = SplineDest: (Value range: 0 ... 5)
Number of the electronic cam in which the interpolated values are to be entered.
– H+3 = SplineNUser: (Value range: 2 ... 10)
Number of curve points to be used for interpolation and the calculation process (bit 7 = 0
spline 0, bit 7 = 1 spline 1)
– H+4 = SplineX0User: (Only a value >= 0 can be entered here!)
X value of the first curve point
– H+5 = SplineY0User: (Value range: long = -231 ... 0 ... (231 -1))
Y value (= position value) of the first curve point
– ...
– H+42 = SplineX19User: (Only a value <= 512 can be entered here!)
X value of the 20th curve point
– H+43 = SplineY19User: (Value range: long = -231 ... 0 ... (231 -1))
Y value of the 20th curve point
SS_MULTIAXIS: Total drive calculation of a trajectory.
Only available on request. Also refer to the addendum to the "Special Design SK-0C for
Caluculated Curves" operating instructions.
1) Applies if parameter P101 is set to "RS485", "Fieldbus" or "SBus".
23.8.5 VARINT
Syntax VARINT Hxx, Mxx
Key points Hxx First variable of a data structure (see table H+0)
Mxx Label with the first command of the interrupt function.
Data structure of the variable interrupt:
Variable VARINT element Description
structure
H+0 Control 0: All VarInterrupt = OFF/Reset
1: Interrupt gets computing time from task 2 and interrupts this task for as
long as the interrupt is processed.
2: Interrupt gets computing time from task 3 and interrupts this task for as
long as the interrupt is processed.
H+1 IntNum 0 ... 3: Defines a sequential number of the VarInterrupt.
An interrupt with the number x, which has already been activated, can
be reactivated during the program run time with another data structure
using the command call VarInt Hxx, Mxx when the same interrupt
number is specified in the new data structure at the position H+1.
This feature is not available for the task 1 interrupts.
H+2 SrcVar Number of the reference variable whose value is compared with the com-
parison value.
ScrVar is the value of the reference variable that ScrVar refers to.
H+3 CompVar Comparison value or mask used to compare the value of the H+2 refer-
ence variable.
Example See "Task Management and Interrupts / Variable Interrupts with MOVIDRIVE® B".
516341515
Structure
Command structure Mxxx: Label (optional)
Mxxx ASTOP X1
X1:
RAPID Braking with the rapid stop ramp followed by speed control. The last target position (H492) to
STOP have been transmitted is retained. Inhibit via control word (command ASTOP (IPOS
ENABLE) is required before the subsequent travel command). The brake is applied if the
brake function is activated.
HOLD Braking with the ramp of the basic unit (P131/P133) followed by position control. The last tar-
CONTROL get position (H492) to have been transmitted is retained. Inhibit via control word (the ASTOP
(IPOS ENABLE) command is required with the subsequent travel command). The brake is
not applied if the brake function is activated.
TARGET Positioning stop with positioning ramp (P911/P912) and calculated "STOP" target position
POSITION (only possible in the positioning mode), followed by position control. The last target position
(H492) to have been transmitted is overwritten by the stop position. No inhibit via control word
(no ASTOP (IPOS ENABLE) command required before the subsequent travel command).
The brake is not applied if the brake function is activated.
Note: Since the actual position is used as the setpoint position at standstill, the command
cannot be processed cyclically. This is the case in axes with process forces or hoists because
otherwise the axis drifts slowly out of position.
IPOS The inhibit is revoked using the IPOSplus® control word.
ENABLE
MEM/MEMORIZE The MEM command makes it possible to save (load) IPOSplus® programs and/or vari-
ables in (from) the non-volatile memory on (to) the unit. The action is specified via the
argument.
INFORMATION
When using the MEM command note that the variables stored in the non-volatile
memory (H0 – 127) and all parameters are not written cyclically. This is because the
number of storage operations with the storage medium (EEPROM) is restricted to 105
storage operations.
516345867
Structure
Command structure Mxxx: Label (optional)
Mxxx MEM X1
X1:
NOP 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.
STORE Only the program from the working memory is saved to the non-volatile memory (EEPROM)
PROG.
LOAD Only the program from the non-volatile memory (EEPROM) is loaded to the working memory.
PROG.
STORE Only the variables from the working memory are saved to the non-volatile memory
DATA (EEPROM)
LOAD DATA Only the variables from the non-volatile memory are loaded (EEPROM) to the working mem-
ory.
Example If an error occurs, the program jumps to an error interrupt routine. Here, the MEM
STORE DATA command is called so that you can continue processing with the stored
interim status of variables H0 ... H127 after the error reset.
If you do not use this command, the program starts with the most recent values from EE-
PROM and overwrites the most recent working values.
TOUCHP/TOUCH The command TOUCHP enables or locks a touch probe input. The touch probe function
PROBE is generally assigned to the input terminals DI02 and/or DI03. Inputs used for the touch
probe function should be set to "IPOS input" to prevent them being allocated twice.
If there is a change of signal level at a touch probe input after the TOUCHP command
has been carried out, the current actual positions (H511, H510, H509) are stored in the
variables intended for this purpose (H502 – H507) once.
A counter is only available in MQX and MOVITRAC® 07 with variable H511. To take an-
other measurement, the touch probe must be enabled again.
It takes 100 µs to store the touch probe positions, regardless of ongoing program pro-
cessing. The terminal level must have been altered for at least 200 µs to be detected
reliably.
The argument can be used to select the edge change that causes a touch probe.
516734219
Structure
Command structure Mxxx: Label (optional)
Mxxx TOUCHP X1
X1:
ENABLE 1 Enables the touch probe input DI02. When the signal changes low/high and high/low,
the actual positions are stored.
DISABLE 1 Inhibits the touch probe input DI02
ENABLE 2 Enables the touch probe input DI03. When the signal changes low/high and high/low,
the actual positions are stored.
DISABLE 2 Inhibits the touch probe input DI03
ENABLE 1_HI Enables the touch probe input DI02. When the signal changes low/high, the actual
positions are stored.
ENABLE 1_LO Enables the touch probe input DI02. When the signal changes high/low, the actual
positions are stored.
ENABLE 2_HI Enables the touch probe input DI03. When the signal changes low/high, the actual
positions are stored.
ENABLE 2_LO Enables the touch probe input DI03. When the signal changes high/low, the actual
positions are stored.
The user can determine whether a touch probe input has been activated either in the
program, for example, with a MP TP2, M0 or with the SETINT TOUCHP1 M0. The user
can determine whether a stored position value lies in a specific position range by com-
paring the values with those in the following user program.
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. (40960 incr.) is traveled from precisely
this touch probe position. For return travel to position 0, the touch probe function is de-
activated using the command DISABLE2.
516738571
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. All tasks are
WATCH DOG halted and the drive is stopped with fault 41 if the time specified in the watchdog timer
OFF/ON H490 elapses before the monitoring function is switched off using the WDOFF com-
mand. (The output stage is inhibited and the brake is applied. The drive coasts to a halt
if there is no brake.)
Structure
Command structure Mxxx: Label (optional)
Mxxx WDON X1 X1: Interval in ms in which the watchdog is called up.
Mxxx WDOFF
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.
516804619
CPEQ/COMPARE The CPEQ command compares, observing the signs, whether variable X1 is the same
EQUAL 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.
Variable X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx CPEQ X1 == X2 X1: Variable (result)
X2: Variable or constant
Example 1 SET H0 = 13
SET H1 = 50
CPEQ H0 == H1
After the program has been processed, H0 has the value zero and H1 the value 50.
Example 2 SET H0 = 13
CPEQ H0 == 13
After the program has been processed, H0 has the value one.
CPGE/COMPARE The CPGE command compares, observing the signs, whether variable X1 is greater
GREATER OR than or equal to the variable or constant X2. Variable X1 contains the result. It is not
EQUAL 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.
Variable X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx CPGE X1 >= X2 X1: Variable (result)
X2: Variable or constant
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 > = -3
After the program has been processed, H0 has the value one.
CPGT/COMPARE The CPGT command compares, observing the signs, whether variable X1 is greater
GREATER THAN than the 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.
Variable X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx CPGT X1 > X2 X1: Variable (result)
X2: Variable or constant
Example 1 SET H0 = -3
CPGT H0 > -3
After the program has been processed, H0 has the value zero.
Example 2 SET H0 = 3
SET H2 = 2
CPGT H0 > H2
After the program has been processed, H0 has the value one.
CPLE/COMPARE The CPLE command compares, observing the signs, whether variable X1 is less than
LESS OR EQUAL or equal to the 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.
Variable X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx CPLE X1 <= X2 X1: Variable (result)
X2: Variable or constant
Example 1 SET H0 = 50
SET H1 = 13
CPLE H0 <= H1
After the program has been processed, H0 has the value zero and H1 the value 13.
Example 2 SET H0 = -3
CPLE H0 <= -3
After the program has been processed, H0 has the value one.
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.
Variable X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx CPLT X1 < X2 X1: Variable (result)
X2: Variable or constant
Example 1 SET H0 = -3
CPLT H0 < -3
After the program has been processed, H0 has the value zero.
Example 2 SET H0 = 2
SET H2 = 3
CPLT H0 < H2
After the program has been processed, H0 has the value one.
CPNE/COMPARE The CPNE command compares, observing the signs, whether variable X1 is not equal
NOT EQUAL to the 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.
Variable X2 remains unchanged.
Structure
Command structure Mxxx: Label (optional)
Mxxx CPNE X1 != X2 X1: Variable (result)
X2: Variable or constant
Example 1 SET H0 = 13
SET H1 = 13
CPNE H0 != H1
After the program has been processed, H0 has the value zero and H1 the value 13.
Example 2 SET H0 = 50
CPNE H0 != 13
After the program has been processed, H0 has the value one.
Structure
Command structure Mxxx: Label (optional)
Mxxx ANDL X1 && X2 X1: Variable (result)
X2: Variable
ORL/LOGICAL OR The ORL command is the logical OR operation of two variables. The result is written to
variable X1. Variable X2 remains unchanged. The result is one when one of the two vari-
ables != 0. The result is zero when both variables = 0.
Structure
Command structure Mxxx: Label (optional)
Mxxx ORL X1 ¦¦ X2 X1: Variable (result)
X2: Variable
NOTL/LOGICAL The NOTL command carries out the logical negation of a variable. The result is written
NOT 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: Label (optional)
Mxxx NOTL X1 = NOT (X2) X1: Variable (result)
X2: Variable
24 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.
516819723
516923787
The RET command is not mandatory in this example as the program was not called as
a subroutine. The return command causes the program to jump back to the first program
line, which is permitted in this case.
24.2.2 Settings
A detailed description of the configuration of inputs/outputs is available in the remark
section of the program source code.
d = 50 mm
i =5 M
BD 100 RHWLS
RSWLS
100
UP
2000
CAM
500
MZP
100
LSWLS
BD 100 LHWLS
516940939
X13 MOVIDRIVE®
DIØØ 1
DIØ1 2
DIØ2 3
CAM DIØ3 4
RHWLS DIØ4 5
LHWLS DIØ5 6
DCOM 7
VO24 8
DGND 9
ST11 10
ST12 11
PLC 0V24
24V
I 01 DIO
DIO11B
I 02
I 03 1 AI21
I 04 X20 2 AI22
I 05 3 AGND
I 06
I 07 1 AOV1
I 08 2 AOC1
X21 3 AGND
O 01
4 AOV2
O 02
5 AOC2
O 03 6 AGND
O 04
O 05 1 DI1Ø
O 06 2 DI11
O 07 3 DI12
O 08 4 DI13
5 DI14
X22 6 DI15
7 DI16
8 DI17
9 DCOM
GND 10 DGND
1 DO1Ø
2 DO11
3 DO12
X23 4 DO13
5 DO14
6 DO15
7 DO16
8 DO17
+24 V 9 24VIN
516945803
PLC = external controller DI04 = /CW limit switch DI16 = Start reference travel
DI00 = /Controller inhibit DI05 = /CCW limit switch DI17 = Start positioning
DI01 = Enable DI10 = Position 1 DO10 = /Malfunction
DI02 = Reset DI11 = Position 2 DO16 = IPOS IN POSITION
DI03 = Reference cam DI12 = Position 3 DO17 = IPOS REFERENCE
Position window The message "Drive in position" should be issued when the target position ± 50 incre-
ments is reached.
24.3.2 Settings
The detailed configuration of the inputs/outputs and the variables used in the program
is documented in the remark section of the program source code.
Variables used:---------------------
H310 = V-jog CW (1/10 rpm)
H311 = "CCW"
H312 = acceleration ramp (ms)
H313 = deceleration ramp (ms)
H316 - H319 = jog auxiliary variable
******************************************
------------------------------------------
Program start Set velocity and acceleration values for jog mode (see
========================================== remark)
Initialization
------------------------------------------
SET H310 = 5000
SET H311 = 5000
SET H312 = 2000
SET H313 = 2000
------------------------------------------
------------------------------------------ Jog CW
Jog + Move for as long as DI14 = 1 and
------------------------------------------ DI15 = 0,
M30: JMP LO I0000010000000000, M31 Query: Is software limit switch active?
JMP HI I0000100000000000, M31
CALL M35 Add 1000 motor revolutions to the current actual position
JMP H319 == 1 , M32 and use the result as the new target position
GETSYS H317 = ACT.POSITION
ADD H317 + 4096000
M32 : ASTOP IPOS ENABLE
GOA NOWAIT H317
JMP UNCONDITIONED , M30
M31 : ASTOP TARGET POSITION
RET
------------------------------------------
Jog -
------------------------------------------
M40: JMP LO I0000100000000000, M41 Jog CCW
JMP HI I0000010000000000, M41 Move for as long as DI14 = 0 and
CALL M35 DI15 = 1,
JMP H319 == 1 , M42 Query: Is software limit switch active?
GETSYS H318 = ACT.POSITION
SUB H318 - 4096000 Add 1000 motor revolutions to the current actual position
M42 : ASTOP IPOS ENABLE and use the result as the new target position
GOA NOWAIT H318
JMP UNCONDITIONED , M40
M41 : ASTOP TARGET POSITION
RET
------------------------------------------
Jog mode end
------------------------------------------
END
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" = "0").
The drive is moved away from a hardware limit switch by entering a "1" signal at the
RESET input (DI02).
24.4.2 Settings
The detailed configuration of the inputs/outputs (see below) and the variables used in
the program is documented in the remark section of the program source code.
The table positions can be written via the variable window of the Assembler or with the
keypad in the variables (H00 ... H15). The variables are stored in the non-volatile mem-
ory.
INFORMATION
The user travel units numerator and denominator in the position window header are
not relevant here because the position values of travel variables are always evaluated
in increments (4096 increments/motor revolution).
Parameterization of inputs/outputs:
In inverter commas = specified function
without inverted commas = IPOS INPUT/OUTPUT
Variables used:---------------------
H300 = Travel speed CW (1/10 rpm)
H301 = Travel speed CCW (1/10 rpm)
H302 = acceleration ramp CW (ms)
H303 = deceleration ramp CCW (linear)
H320 - H324 = auxiliary variables
******************************************
------------------------------------------
Program start Set speed and acceleration values for table position-
========================================== ing (see variable description in the remarks for the
Initialization program source code)
------------------------------------------
SET H300 = 15000
SET H301 = 15000
SET H302 = 1000
SET H303 = 1000
------------------------------------------
Program branch distributor Program branch distributor
========================================== Activate interrupt routine for hardware limit switch pro-
SETINT ERROR M10 cessing reset/move clear of limit switch → main pro-
gram
M100: CALL M50
DI16 = 1 → Reference travel
JMP LO I0001000000000000, M101
CALL M20 DI14 = 1 → Jog CW
DI15 = 1 → Jog CCW
M101: JMP LO I0000010000000000, M102
CALL M30
M102: JMP LO I0000100000000000, M103
CALL M40
M103: JMP UNCONDITIONED , M100
------------------------------------------
Subroutine/move clear of limit switch Reset/move clear of limit switch
========================================== If drive has not moved onto limit switch (DI04/DI05
M10: JMP HI I0000000000110000, M1 Limit switch CW/CCW), then return to branch distribu-
tor. If it has, then unlock travel and wait until drive has
M3: JMP HI I0000000000110000, M2
moved clear of limit switch (parameterized "Reset"
ASTOP IPOS ENABLE input function DI02).
JMP UNCONDITIONED , M3 Then stop drive by setting target position to current
M2: ASTOP TARGET POSITION position
M1 : RET
------------------------------------------
Reference subroutine Reference travel
========================================== Travel release
M20: ASTOP IPOS ENABLE Delete output binary coded table position
AND H480 & FFFFFFF0 hex Delete output "Table position valid"
BCLR H480.5 = 0 Reference travel, no wait, start at zero pulse,
GO0 U,NW, ZP as long as "Controller inhibit" = 0
M22: JMP LO I0000000000000001, M21 and the bit in the status word "IPOS Reference" = 0
SET H319 = 0
BMOV H319.0 = H473.20
JMP H319 == 0 , M22
M21 : ASTOP TARGET POSITION
RET
------------------------------------------
Subroutine jog mode Option: Subroutine (e.g. jog mode)
========================================== Jog CW
M30: RET Jog CCW
M40: RET
Index
H
C
Hiperface offset X14 ............................................ 136
Cam distance .......................................................126
CAN encoder .......................................................139
I
CCount_Ext............................................................36
Incremental encoder ..............................................53
CCount_ExtOn .......................................................36
Incremental encoder simulation .............................53
CCount_Mot ...........................................................36
InpLevelB / INPUT LVLB .......................................36
CCount_MotOn ......................................................36
INPUT LVL.......................................................32, 36
Color, Background ...............................................154
InputLevel / INPUT LVL .........................................32
Control word...........................................................33
Interrupt activation .................................................46
Control word modulo function ................................29
Interrupts..........................................................40, 45
ControlWord / CTRL. WORD .................................33
Interrupt, error interrupt..........................................46
Copyright................................................................15
Interrupt, timer0 interrupt .......................................48
Counting direction ................................................138
Interrupt, touch probe DI02 interrupt......................47
Cycle frequency ...................................................139
IPOS counter .........................................................35
IPOS CTRL.W Task 1.......................................... 132
D
IPOS CTRL.W Task 2.......................................... 132
Designated use ......................................................17 IPOS encoder ...................................................... 134
DIO11A, analog output ..........................................31
IPOS modulo function.......................................... 140
DIO11A, analog outputs.........................................30 IPOS monitoring ..................................................131
DIO11A, binary outputs..........................................31 IPOS parameters .................................................123
DIP11A, binary outputs ..........................................31
IPOS reference travel .......................................... 123
Directories ............................................................156 IPOS setpoint.........................................................38
Directory, #include directives ...............................156