04+Introduction+to+Programming+with+MCC+en
04+Introduction+to+Programming+with+MCC+en
D
The unit concept in SIMOTION
IN
Programming languages in SIMOTION ................................................................................................
...........................................................................................
3
4
N
Programming with motion control chart MCC ................................................................................ 5
Creating or opening the MCC units in the PROGRAMS folder................................................................ 6
Compiler settings for MCC units ...................................................................................... 7
AI
IA
MCC synchronous start ................................................................................................................. 39
Compiling created MCC charts ..................................................................................................... 40
Assigning created programs to a task ........................................................................................ 41
Compile a project and downloading ......................................................................................... 42
Download individual sources .............................................................................................................
D
43
The "Monitor" test function ......................................................................................................... 44
Monitoring variables using the symbol browser ........................................................................... 45
Monitoring I/Os via the address list ........................................................................................ 46
Monitoring variables in watch tables
Operations with lists (watch tables, …)
IN
............................................................................................
.....................................................................................
Reference data: Cross-references (1)..................................................................................................... 49
Reference data: Cross-references (2)..................................................................................................... 50
Reference data: Program structure and code attributes.......................................................................
Finding/replacing variables in the project................................................................................................. 52
47
48
51
N
Exercise 4.1: Write an empty program for the PeripheralFaultTask ................................................. 53
Exercise 4.1: Establish an online connection, load the project, and test the operating changeover..... 54
Exercise 4.2: Creating a program for traversing axes ............................................................. 55
Exercise 4.2: Establish an online connection and load the project............................................................. 56
AI
Exercise 4.3: Expand the program with a program loop counter ........................................................ 57
Exercise 4.4: The "Test_LEDs" program .......................................................................................... 58
If you want to know more ................................................................................................. 59
Downloading a program during run .................................................................................................... 60
Downloading individual sources ......................................................................................................... 61
TR
this language offers entry-level users support with quick and transparent
creation of program sequences in MotionTasks.
LAD/FBD These programming languages are unparalleled for programming binary signal
logic operations. In addition to the wide range of options in the area of binary
TR
signal logic operation (edge evaluation, flip-flops, etc.), many other functions
such as IEC-compliant counter and timer blocks are integrated. Almost all
system functions can be directly called and tested in a network.
Due to the many control structures it offers, ST is also suitable for programming
process sequences.
DCC The Drive Control Chart (DCC) option is a modular, scalable programming
language based on the STEP 7 package CFC (Continuous Function Chart), to
develop continuous open-loop or closed-loop control solutions for controlling
drives. At the moment, programming with DCC is only possible in the STEP 7
environment with SCOUT Classic.
Modular machines With the help of units, the concept for "modular machines" is also better
supported. Machines are usually put together out of individual machine
TR
Know-how protection Further, units can be protected against unauthorized access (shortcut menu ->
Know-how protection). Then, a password must be entered to open or view the
SI
Embedding in
SIMOTION SCOUT The individual components of the MCC programming environment are easy and
convenient to use. They are fully integrated into the SCOUT Workbench.
• Project navigator: The project navigator displays the project structure. It also
provides an overview of all programs that have been created. The project
navigator can be used for example to create new MCC charts.
• Work area: The MCC editor displays the charts and associated parameter
screens in the work area. The MCC program elements can be inserted from
SI
the tool list into the MCC chart for creation of program sequences.
• The top part of the editor contains a window for declaration of the local
variables.
• Detail view: Variables, alarms, error messages, etc. are displayed in this
window. The display depends on the element selected in the project
navigator.
SIMATIC S7.
Further, MCC units can be protected against unauthorized access (shortcut
menu -> Know-how protection). Then, a password must be entered to open or
view the protected MCC units and the MCC charts contained in them.
TR
Insert MCC unit You can insert a new MCC unit in the following ways:
• In the project navigator: In the "PROGRAMS" folder, via the Insert MCC unit
element.
• Via the menu Paste -> Program -> Insert MCC unit
• Via the shortcut menu Insert new object -> MCC unit
• Via the "MCC unit" toolbar with the "Insert MCC unit" icon.
SI
Defining the name The name of the MCC unit is defined in the "Name" entry field. The name can
be up to 128 characters long. Further, names must comply with the rules for
identifiers of the ST language:
• Names comprise letters (A to Z, a to z), numbers (0 to 9), or individual
underscores (_) in any sequence.
• The first character must be a letter or underscore.
• No distinction is made between upper case and lower case.
module can now be accommodated in one subfolder with its own name. This
subfolder can be copied to the clipboard or exported via "XML- Export" and
inserted or imported into another project in which the same machine module is
used.
A subfolder could also be inserted into the TO folder axes to accommodate all
TO axes required to control the machine module.
TR
Subfolders only offer structuring capabilities; they have effect on naming. This
means that the name assigned to all objects in the main folder must be unique.
For example, the axis name "Axis_1" or the unit name "Source_1" can only exist
once in the "AXES" folder or "PROGRAMS" folder.
Libraries Subfolders are also possible in a library and in the monitor for the watch tables.
Note that different libraries cannot be combined in one folder. Subfolders are
SI
Settings The following settings can be made under the "General" tab:
• Name: Enter the name of the program or function block or function to be
created (within the surrounding unit) here. This name can be up to
25 characters long.
• Creation type: Here you can select whether the created MCC chart will
describe a program, function block, or function.
• Exportable: If the check box is activated, an MCC chart can be called from
other program sources (e.g. MCC units, ST source files) in the same way as,
SI
Toolbar All commands are sorted into command groups and are available on a toolbar.
AI
Inserting a command You can insert a command in an MCC chart from a command group as follows:
SI
1. First select the position in the MCC chart where you want to insert the
command.
2. Click the command you want to execute on the toolbar. It is automatically
inserted at the selected position.
Double-clicking a command in the sequence chart opens further command-
specific dialog boxes. You can define the associated command parameters in
these dialog boxes.
and are available for special settings (e.g.: acceleration, velocity profile, etc.).
The end position of a traversing motion is defined in the middle entry field.
The exact interpretation of the "Position" parameters depends on the "Type"
parameter.
If you select "Absolute" as type, the position is interpreted as an absolute
TR
position. The programmed position value marks the end position of the motion.
If "relative" is set, the position is interpreted as a traverse path of the movement,
starting at the current axis position.
The traversing direction for a relative motion can be set in "Direction". Modulo
axes can be set to "Shortest path" in addition to the directions "Positive" and
"Negative".
The lower half of the box contains the settings for the transitional behavior from
the preceding command and the step enabling condition for the next command.
SI
"Delay program
execution" This check box determines when the next command will be executed. MCC is
optimized for sequential programming; therefore, the default setting for this
check box is "active". Otherwise the next command in the sequencer is
executed immediately.
can be specified.
Note If the value "Default" is selected in the appropriate entry fields, a reference is
made to the settings in the "Default" screen form of the associated axis TOs.
SI
Cyclic
programming Cyclic programming corresponds to conventional program creation in PLCs. In
this case function calls are performed asynchronously. After the function call is
issued, the program advances to the next command without waiting for the job
to be completed. It is then necessary to query the status of the command in the
following program section run The next task can be started upon termination of
the current one.
Wait for axis This command can stop execution of a motion task until the specified axis has
reached the programmed axis status or axis position. The axis status or axis
position refers to the total movement of the axis.
TR
If the event occurs, the priority of the motion task is temporarily raised. The
commands that are located within the grayed out area under the wait command
are started with the next IPO cycle and processed with the highest priority. After
execution of the commands in the grayed out area, the priority of the motion
task is reset.
Wait for signal With this command, execution of a motion task is stopped until the selected
SI
• WHILE statement
• UNTIL statement
• Synchronous start
Editing The buttons can be used to create the desired functions in ladder diagram
TR
Interruptibility If the assignments are to take place without being interrupted by other tasks,
select the "Uninterruptible assignments" check box.
If you select this check box, UserInterrupt Task_1 must be created. If an error
occurs during execution, the execution system automatically calls
UserInterruptTask_1. You can program an error response in this task.
TR
SI
groups:
• System variables
• Global user variables
• Local user variables
TR
Note You can also access system variables and global user variables from HMI
devices.
SI
purpose, select the required device or the TO in the project navigator; the
variables of the device or TO are then displayed in the symbol browser (detail
view).
Global device
variables Global device user variables are created with the symbol browser. For this
TR
purpose, the "Global device variables" item must be selected in the project
window below the required SIMOTION device. In the symbol browser window,
the required variables can then be created with their name, data type, settings
for POWER OFF, and initial value.
These variables can be accessed from all sections of the user program. And
can be monitored and modified in the symbol browser in online mode. They can
also be accessed from HMI devices.
SI
peripheral outputs), start address (byte address) and the length of the
variables (B: byte, W: word, D: double word) in the "I/O address" column
(e.g. PIW5, PQD3; PI4.5, etc.).
• Peripheral variables of SINAMICS_Integrated: To do this, in the
"I/O address" column, the entry "IN" automatic telegram configuration,
"Save and compile" automatically creates an appropriate telegram extension
TR
called and the outputs are written to after the position controller is called.
During the StartupTask access is not possible to the I/O variables. In the RUN
operating state and in the ShutdownTask, I/O variables can be accessed
without restriction.
TR
I/O of the
SINAMICS_Integrated On accesses to the I/Os of the SINAMICS_Integrated or the CX32 modules, the
associated I/O variable is updated in the set position control cycles.
Access via
process images Process images are memory areas in the RAM of the SIMOTION device, onto
which a subset of the I/O address space is mapped.
The system automatically mirrors the first 64 bytes of the I/O address area to
SI
Assigning
I/O variables For I/O variables that originate from the SINAMICS_Integrated, for example, this
procedure is extremely tedious, as the user must also handle the necessary
extension of the telegram, the BICO interconnections and the correct calculation
and input of the I/O address.
With V4.2, this work is performed by the "Symbolic assignment" via SIMOTION
TR
3. Click the 3 dots in the "Assignment" column to open the Assignment dialog
box.
4. In the assignment dialog box that opens, select the required variable and in
the "Assignment" column select "Assign".
5. Confirm the dialog box with "OK".
6. This assigns the I/O variable. At the next "Save and compile", the system
automatically performs the necessary extensions etc.
In addition, blocks which are inserted in other MCC units can also access
these variables (global variables). INTERFACE variables are also available
on HMI devices, this means that an HMI device can also access these
variables. The total size of all unit variables in the interface section is limited
to 64 KB.
• If a variable is declared in the implementation section (IMPLEMENTATION)
TR
of the declaration table, this variable is only valid in the MCC unit. All MCC
charts (programs, function blocks and functions) within the MCC unit can
access these variables. Access from other MCC units or from HMI devices
to these variables is not possible.
Note Only the static variables of the local variables of an MCC chart can be
monitored and changed in the symbol browser.
In the symbol browser, it is not permissible to select the higher-level source, but
rather the "Execution system" entry. The appropriate task in the symbol browser
window is then taken to navigate to the program with the static variables.
data types The elementary data types are the smallest elements of any programming
system. In SIMOTION, the elementary data types are predefined according to
IEC 61131-3. The data types have been selected to allow time stamp
management and high-precision motion control of axes in addition to the
conventional tasks of a PLC, which include digital and analog signal processing.
TR
BOOL, BYTE,
WORD, DWORD Variables of the BOOL data type consist of one bit, variables of data types
BYTE, WORD, DWORD are bit sequences of 8, 16, or 32 bits. The individual
bits are not processed in these data types.
SINT, INT, DINT ... Variables of these data types represent integers for performing calculations,
such as counting operations. SIMOTION supports both signed integers – such
as: SINT, INT, and DINT and the corresponding unsigned data types: USINT,
SI
REAL, LREAL These are numeric data types with the corresponding number of decimal
places. In addition to counting operations, they can be used for extended
mathematical operations and functions (such as the trigonometric functions sin,
cos, etc.).
TIME, DATE, ... With these data types, time stamps can be managed in the user program of a
SIMOTION device.
STRINGs in MCC If, in MCC variables, the STRING data type is declared, the maximum number
of characters that can be included in the string variables is limited to 80 (default
setting). String variables with a maximum length of 254 characters can only be
declared in the ST language.
Comparison
SI
operations String variables are used to assign constant character strings (e.g. 'Fueller_rot')
or other string variables. If the character string to be assigned has more than
80 characters, it is automatically truncated.
For all comparison operations, a comparison is made of the individual
characters based on the associated ASCII code from left to right (lexicographic
comparison).
When comparing two string variables of different lengths, the shorter variable is
expanded to the longer variable by inserting $00.
From V4.0, using comparison operations (=, <>) complete field variables can be
compared with one another for equality and/or inequality, for example:
• ArrayName1 = ArrayName2
Note If array limits are violated during the runtime, this results in a processing error in
the program.
SI
the "Name Structure" column. In the same line, the name of the first element
must be entered, together with its data type and additional identifiers (array
length, initial value). Additional elements of the structure are then added in the
following lines, in this case, the "Name Structure" field remains empty. The
definition of a new structure starts with a new name in the "Name Structure"
field.
TR
Variables Defining a structure does not reserve memory space to store data. Variables of
the defined structure can be declared as usual under the "Variable/parameter"
tab in the declaration part of an MCC unit or an MCC chart. Access is only
possible after declaring variables.
1. Open the declaration part of an MCC unit or an MCC chart and select the
"Enumerations" tab.
2. In the first line of the column "Enumeration name", enter the name of the
enumeration.
3. In the same line, add the name of the first element.
TR
• to another MCC, ST, and LAD/FBD source under the same SIMOTION
device
• to libraries
Setting up
connections Connections to other units (program source files) are defined in the declaration
TR
table of the MCC unit. The mode of action of a connection depends on the
section of the declaration table in which it is defined.
• In the interface section of the declaration table: The imported functions,
variables, etc., will continue to be exported to other units and to HMI devices.
This can lead to name conflicts. This setting is necessary, for example, if
variables are declared in the interface section of the MCC unit with a data
type that is defined in the imported program source file.
• In the implementation section: The imported functions, variables, etc. will no
SI
Structured
programming SIMOTION supports the concept of structured programming using functions
(FC) and function blocks (FB). FCs and FBs are parameterizable blocks, in
which the necessary algorithms and data for solving partial tasks (mathematical
calculations, closed-loop controls, etc.) of a user program can be saved. FCs
and FBs can be called using different parameter sets at various locations in a
TR
user program and support, in this way, the reusability concept. FCs and FBs for
special tasks can also be combined in preconfigured libraries and supplied.
Further, standard FCs and FBs are already integrated in the system.
Functions (FC) Functions are parameterizable code blocks without memory, i.e. without static
data. Intermediate results, which are obtained while the function is being
executed, can be saved in temporary variables. All local variables of a function
lose their value when you exit the function and are reinitialized the next time you
SI
Function block (FB) A function block (FB) is a code block with static data. Unlike FCs, FBs are
instantiated, i.e. an FB is assigned to its own private data area. When called,
this instance can for example "note" process states from call to call. Programs
are similar to FBs, but cannot be parameterized. However, they can be
assigned to execution levels or tasks.
function block is executed. Once the system function or system function block is
executed, the execution of the MCC chart resumes after the command.
SI
Interrupt task This command interrupts a task at the current location. The command does not
stop axis motion that has previously been started from this task.
Corresponds to the call _suspendTaskId
TR
Continue task This command will resume processing of an interrupted task at the location at
which it was interrupted. Interrupted motions are not automatically resumed.
Resumption of interrupted motions must be programmed explicitly.
Corresponds to the command _resumeTaskId
Reset task Using this command, a MotionTask is stopped. The task can be restarted with
the Start task command with data initialization.
SI
Determine taskId This command generates a project-wide unique task ID from the name of a
task. This task ID is assigned to a variable of data type StructTaskId.
Corresponds to the call _getTaskId
IF branch The program flow branches into the TRUE or FALSE branch depending on the
result of the logic operation.
The program flow branches as follows:
• Condition is fulfilled: Execution continues down the TRUE path.
• Condition is not fulfilled: Execution continues down the FALSE path.
TR
CASE branch The CASE statement is used to select 1 of n program sections. The selection
defines an expression, which must be one of the following types – integer
number data type (SINT, INT, etc.) or enumeration data type (selector). The
selection is made from a list of values (constants) and a program path is
assigned to each value or group of values.
SI
The value of the selector is tested during program execution. If its value is
contained in the value list, the program branches to the associated path. The
ELSE branch is optional. It is executed if the value returned by the selector is
not contained in the value list.
GOTO You can implement program jumps within an MCC chart using the Go To
command. A jump is defined as a jump label (Go to command) and a jump
destination (Selection command), each with the same name. A circle symbol
with a name marks the exit and entry point in each case. Several exit points with
the same name can be programmed, but only one entry point.
When the loop is started, the control variable is set to the initial value and
incremented (or reduced for a negative step width) by the specified value on
each loop cycle. The FOR loop is exited when the control variable has reached
the end value.
The FOR statement is used whenever a statement sequence is to be looped
TR
through for a fixed, known number of cycles. If the number of cycles is not
known, use the WHILE or REPEAT statement.
REPEAT statement REPEAT statements repeat statement sequences between REPEAT and
UNTIL until a particular condition is fulfilled and the action is aborted. The
termination condition is formulated in accordance with the rules for a logic
expression.
The condition is evaluated after every completed execution of the statement
sequence. This means that the sequence is executed at least once, even if the
abort condition has been fulfilled from the start.
Notice When using the synchronous start command, the UserInterruptTask_1 must be
created, as MCC calls this when an error occurs. You can program an error
response in this task.
TR
SI
The consistency checks are triggered with the compilation process – and in the
event of an error, explanatory error messages are output in the detail window.
Double-click the error displayed in the detail view, then you are taken directly to
the command containing the error.
Save and compile You can save and compile an MCC unit in the following ways:
TR
• Select the required MCC chart in the MCC unit and click the "Save and
Compile" icon on the MCC toolbar.
• In the project navigator, select the desired MCC chart from the MCC unit and
choose the following command from the shortcut menu:
Accept and compile.
• In general, all blocks belonging to the selected source are compiled.
The detail view (tab: "Output") displays any errors occurring during
SI
4. Click the ">>" button. The selected program is displayed in the "Programs
used" list.
5. Select the "Task configuration" tab and define any additional settings for the
task there. Especially for MotionTasks, you can select with a check box
whether the selected MotionTask will be automatically started after the
StartupTask.
6. Click the "Close" button to confirm what you have entered. The settings that
have been made will be applied in the project data. Before the project can be
loaded into the target system, the complete project must be compiled.
Downloading to
the target device The intermediate code generated in SIMOTION SCOUT can be downloaded
after a connection has been established with the target system (online channel).
Follow the steps below to download a project to the target system:
TR
1. First check the consistency of the program. To do this, select the menu
command Project -> Check Consistency.
2. Compile the project from scratch again, taking account of all dependencies.
To do this, select the menu command: Project -> Save and Compile All or
the equivalent icon on the toolbar
3. Go online with the target system: To do this, use the menu command
Project -> Connect to target system or the corresponding icon on the toolbar
SI
4. Download the project to the target system. To do this, use the menu
command Target system-> Download -> Project to target system or the
corresponding icon on the toolbar.
In this case, the project data of all devices of the project are loaded. Whether
the data are also loaded into the drive units depends on the settings in the
dialog box: Options -> Settings -> Download.
Alternatively, the project data can be downloaded into individually selected
devices using the command: Target system -> Download -> To target device
or using the icon "Download CPU to target device".
inconsistent programs). This can be performed in the STOP and RUN operating
states. Subsections of a configuration can therefore be downloaded and
commissioned even when certain units are not yet ready for a download.
If several operators have an online connection between their PCs and a
SIMOTION controller, in particular during commissioning, each user can load
and test their own processing units.
TR
Downloading The downloading of individual sources can only be started via the shortcut menu
on the unit or on the execution system. The execution system is relevant if you
wish to load a new source with a program which has been newly registered in
the execution system. So that the program is also performed on the target
device, the execution system must also be loaded along with the unit. If several
units are loaded, they must be marked via multiple selection in the project
navigator and then loaded via the shortcut menu command "Load to target
SI
device".
After downloading a subset, SIMOTION SCOUT ensures that a consistent state
is established again on the target device as a whole. To do this, SCOUT checks
and visualizes the dependencies on other units, which must then also be
downloaded when required.
With this specification, the user can verify whether the download would cause
problems (e.g. that no unit is downloaded outside of its appropriate area). After
the download confirmation loading to the target device is started.
does make the program execution time longer. The program execution tracking
can only be activated for MCC charts that are assigned to precisely one task.
Program execution monitoring is started by activating the menu command MCC
Chart -> Monitor with an open MCC chart or by clicking the associated icon on
the MCC toolbar.
TR
Program execution
with single step Only MCC charts that are created as a program and assigned to exactly one
task can be tracked in single-step mode. If single step is active, the program
is suspended until the user activates the next program step. The next command
to be executed is highlighted in pale blue. After initiation of the next single step,
the active command is shown in yellow until execution of the command has
finished. The program is then suspended again.
SI
Program status You can use Program Status to monitor variables for the following commands:
• IF, WHILE, UNTIL, and ST zoom
• The values of the following variables are displayed:
• Variables with an elementary data type (INT, REAL, etc.)
• Individual elements of a structure, provided an assignment is given
• Individual elements of an array, provided an assignment is given
• Variables with enumeration data types
The Status of ST Loops is available if Monitoring is active, just place the cursor
on a variable to see the status value.
Fixing the display Normally, in the symbol browser, the variables of the particular object are
SI
displayed that was selected in the project window. By clicking the "Maintain
display" symbol in the right-hand upper corner of the symbol browser, the
display in the symbol browser can be fixed for the active object. To free the
display, click the same symbol again.
• The display is fixed. The content of the symbol browser window does not
change if another object is selected in the project window.
• The display is not fixed. The content is displayed depending on the selected
object in the project window.
"I/Os" view In this view, the I/O variables are specified that should either be connected to
AI
view The All addresses view contains all the information contained in the I/Os view
as well as additional information on the I/O variables. It also contains
information on interfaces on TOs that have been assigned by the system as well
as I/O variables as "Sources", which are interconnected to telegram extensions
via assignments.
You can also enter I/O variables in this view that are to be connected via
assignments. The assignments are made in an assignment dialog box.
SI
Note The "All addresses" view is available only when the CPU firmware version is at
least V4.2 and, in the SCOUT user interface, the symbolic assignment has been
activated with the command: Project -> Use symbolic assignment.
Move The individual entries in a watch table can be moved as required. This can be
used to resort a watch table. For this purpose, select the appropriate entry in the
AI
first column and move it to the required position with the mouse button pressed.
Hide/display Entries in the watch tables can be hidden and displayed again. For this purpose,
select the appropriate entry in the first column and select the "Hide" or "Display"
command from the shortcut menu.
TR
Group To reduce the complexity of entries in a watch table and to structure the data,
elements of a watch table can be combined to form a group. For this purpose,
select the required element and select the "Group" item from the shortcut menu.
The group created can be opened using the "+" character or closed again using
the "-" character. You can assign a specific name to the new group in the
"Name" column. This grouping can be ungrouped again using the "Cancel
grouping" item from the shortcut menu.
SI
Information For user variables, comments from the declaration of variables are displayed in
the "Information" column. The entry can be overwritten as required in the watch
table.
Comment lines Comment lines can be displayed at any position in a watch table. To do this, in
the first column select the line in front of which a comment line should be
inserted, and from the shortcut menu, select the "Insert comment line"
command. Any text can then be inserted in the comment line.
Using the
cross-reference list The following functions can be executed using the cross-reference list:
• Sort the column contents alphabetically
• Set filter functions
• Copy the content to the clipboard and transfer to Excel
• Print contents
• Using the "Go to use" button, open the referenced program source and
position the cursor onto the associated MCC command (line of the ST
source file or LAD/FBD element)
Note In arrays and structures, only the variable can be selected, not a single element.
Code attributes The following are displayed in a table for all selected program sources:
• Identifier of program source file
• Memory requirement, in bytes, for the following data areas of the program
source:
TR
(code size)
• Number of referenced sources
result opens the program and the corresponding position in the program is
highlighted.
If you perform a replace action, the replacement term is displayed in the detail
view in addition to the found results. Click "Replace" to replace the search
results with the new term. A check box precedes each search result.
TR
For the replace action, only those search results that you have marked will be
replaced. The search also returns results that cannot be replaced. In this case,
you cannot mark the search result for the replace action.
Know-how protection If you have set know-how protection on sources, they are no longer included in
the search. They are excluded from the search. A search is only possible if you
open the source in the appropriate editor or if you delete the know-how
protection.
SI
The free search does not return any results for the technology objects and
drives from the expert lists.
Use the cross-reference list if you want to search for variables and the relations
and uses in the programs. You will find it in the shortcut menus of each of the
objects in the project navigator under Reference data > Create.
opens.
2. In the "Name" field, enter the name "FaultUnit".
3. Confirm your entries by clicking "OK".
4. Double-click on the "Insert MCC Chart" icon below the inserted MCC unit.
The "MCC chart" dialog box opens.
TR
5. Enter the name "FaultProgram" and set the creation type to "Program".
6. Confirm your entries by clicking "OK."
An empty MCC program with a start and end step is displayed
7. Save and compile the program.
In the next step, assign the program to the execution system.
8. In the project navigator, double-click the "Execution system" symbol.
The task overview opens.
SI
Procedure
1. To establish an online connection to SIMOTION, click the highlighted icon
AI
In the open "Load to target system" dialog box, the following options can
already be selected.
• "Store additional data on the target device"
• "After loading, copy RAM to ROM"
3. After successfully downloading the project, use the operating mode control to
put the SIMOTION device into the required operating modes. Can the RUN
operating mode now be selected?
SI
negative direction at the same speed and for the same distance.
Procedure
1. Double-click the "Insert MCC unit" icon. The "MCC unit" dialog box opens.
2. In the "Name" field, enter the name "AxisOpt" and, under the "Compiler" tab,
select the options "Permit program status" and "Permit single step".
TR
11.In the "Task configuration" tab, activate the "Activation after StartupTask"
option.
12.Save and compile the project.
Task After an online connection has been established, the project data should be
loaded into the target system and the MCC program tested. Procedure:
TR
value of "1".
3. Use the WHILE or FOR commands to implement the loop function. Observe
the following points:
• The "loop" variable must be incremented by 1 at the end of each run.
• If the variable exceeds a value of five, the loop must be exited.
4. Before each traversing motion, set the corresponding output or reset the
output after every traversing command.
SI
5. "Save and compile" the project and download it to the target system.
6. After the download, switch the D425-2 into the RUN operating mode and test
the program.
7. In the project navigator, select the MCC unit "AchsOpt", and in the symbol
browser, check the value of the "loop" variable.
8. Check the value of the "loop" variable, by opening the While instruction
and selecting the function "Program status".
and select the entry ADDRESS LIST in the window of the project navigator.
2. Select the detail view for the "Symbol browser". In the symbol browser,
create a variable called "bo8_All_DO_1" with assignment to I/O output byte 5
(PQB5). As a data type of the variable "bo8_All_DO_1", select the BYTE
entry.
TR
3. Make sure that the item "replacement value" is selected under "Strategy".
4. Create a new MCC unit "LED_Test". In this unit, create the MCC program
"Test_LEDs". Implement the desired functionality.
5. Save and compile the MCC unit file.
6. Open the dialog box for setting the EXECUTION SYSTEM and assign
the created program to MotionTask_2. For MotionTask_2, under the "Task
configuration" tab, select the item "Activation after StartUpTask".
SI
Notes For MotionTasks, the MotionTask must first be terminated before the code can
be changed. With cyclic tasks, the system will try for 2 seconds to replace the
AI
code. If this is not successful, because, for example, long commands are being
processed, the download is interrupted with the corresponding message. The
function must be enabled via the SCOUT menu command: Options -> Settings
->CPU download -> Permit download / RAM to ROM during RUN.
The download during RUN must be performed via the menu command: Target
system - Download -> To target device or alternatively via the corresponding
TR
2. In the project navigator, select the device for which you have made the
program changes, e.g. D425-2.
3. Click the "Download CPU / drive unit to target system" icon or open the
shortcut menu and choose the command: Target device -> Download to
target device.
4. However, after a download, the changes are in the RAM, not in the ROM.
If the data on the data storage medium of the target device are to be saved,
then, in the message window that opens, select the option "Copy RAM to
ROM". Then confirm with "Yes".
processing units.
Downloading The downloading of individual sources can only be started via the shortcut menu
on the unit or on the execution system. The execution system is relevant if you
wish to load a new source with a program which has been newly registered in
the execution system. So that the program is also performed on the target
device, the execution system must also be loaded along with the unit. If several
units are loaded, they must be marked via multiple selection in the project
SI
navigator and then loaded via the shortcut menu command "Load to target
device".
After downloading a subset, SIMOTION SCOUT ensures that a consistent state
is established again on the target device as a whole. To do this, SCOUT checks
and visualizes the dependencies on other units, which must then also be
downloaded when required. With this specification, the user can verify whether
the download would cause problems (e.g. that no unit is downloaded outside of
its appropriate area). After the download confirmation loading to the target
device is started.
3. Activate the setting "Store additional data on the target device" and confirm
the dialog box with "OK".
4. Before downloading the project, select the function "Save and recompile all".
The next time the project is downloaded to the target device, the additional data
will be automatically saved on the target device.
SI
system.
Object comparisons are only performed using saved data. By contrast, detailed
comparisons use the data in the work memory of the PC/PG. Object and
detailed comparisons may, therefore, produce different results.
An online comparison and a comparison with a different project behave as
TR
follows:
• The comparison only uses the saved data in the open project.
• During an online comparison, the device being used for comparison
purposes is implicitly uploaded. Therefore, the comparison is made with a
copy of the online data.
Note A comparison with online objects is only possible if an online connection has
already been established to the target system. No communication connection is
SI
3. Object present (column A, column B): The columns indicate whether or not
a tree object is present for comparison partner A and/or comparison partner
B.
4. Result of comparison: The comparison result is shown in this column
(same/different).
TR
11. Data transfer: Transfer of data from comparison partner B into the open
project.
12. Status bar
13. Object comparison tab
• TOs (technology objects, for example; axes, output cams, measuring inputs,
etc.)
• DOs (Drive Objects in SINAMICS drives)
Starting a
detail comparison The detailed comparison for ST/MCC/LAD/FBD programs, TOs and DOs can
be directly started from the comparison tree by clicking on the "Start detail
TR
comparison" button.
You can only start the detail comparison if
• you have found differences or
• if the additional data required is available for the online comparison.
In a detailed comparison, the different values of the two objects being compared
are displayed in tabular form.
SI
Comparison result For MCC units, the comparison is performed at the source text level (ASCII
basis). For INTERFACE (Exported declaration and connections are the first
difference shown in the detailed comparison.) For IMPLEMENTATION (Internal
source declarations and connections are also the first difference shown in the
detailed comparison.)
For programs, functions, and function blocks, a detailed comparison is available
for declarations, execution-relevant code and for differences in the comments
and formatting.
Differences in the compiler settings or the object address are displayed under
"Properties".
in this program, the source code is the same in both cases but the
compilation result is different.
• Data structure, retain data and non-retain data
• Exported interface (effective) export data and used data types, exported
POEs
Under "HMI-relevant data", differences in the structural setup (data type of
variables, number of variables) of the data which an HMI system can access are
displayed. If the setup changes, the HMI configuration must be updated. Data
included.
The individual parameters for this command are then listed in this window.
Differences in the offline or online version are color-coded.
The values of the online parameter can be transferred into the offline project by
selecting the check boxes for the various parameters and then closing the
window with the "OK" button.
TR
SI
For the debug mode, you must also acknowledge the safety notes.
Operating modes The following operating modes can be set:
• Process mode: Program execution in the SIMOTION device is optimized for
maximum performance. The following diagnostic functions are available:
Monitoring variables in the Symbol Browser
TR
Program status
Trace tool with measuring functions for drives and function generator.
• Only 1 MCC chart can be monitored and 1 trace activated.
• Test mode: The same diagnostic functions are available as for process
mode. The restrictions have been resolved to a great extent.
However, only one MCC can be monitored for each task and 4 traces
can be initiated at each SIMOTION device.
SI
2. Select the "Debug task group" item in the shortcut menu. The dialog box to
define the "Debug task group" opens.
3. Select the tasks to be stopped on reaching the breakpoint:
• If you wish to specifically halt individual tasks in the RUN state, assign
these tasks to the "Tasks to be stopped" list:
TR
• If you wish to stop all tasks, select the "All tasks" option.
In this case, you can define as to whether the outputs will be activated
again after continuation
to be stopped"
Output Active Inactive
Cycle monitoring Inactive Inactive
Axis technology Axes in position control No position control
Note The "Debug task group" can only be modified if no breakpoints are active.
1. Using the command: View-> Toolbar -> Breakpoints, display the breakpoint
toolbar.
2. Select the required instruction in the MCC chart.
3. Click the "Set/remove breakpoint" icon on the "Breakpoint" toolbar (shortcut
key: Ctrl+H). A breakpoint that has been set can be removed by clicking the
TR
Note You can use other diagnostic functions, for example "Program Status" and the
"Breakpoints" function together in one MCC chart.
SI
the program source, line number, name of the POU). If the selected
calling code position is, in turn, called by multiple code positions, further
lines are displayed in which you proceed similarly.
• All displayed code positions are selected. Moreover, all code positions
(up to the top level of the hierarchy) are selected from which the
displayed code positions are called.
5. If the breakpoint is only to be activated after the code position has been
SI
Note You can view the call path with the "Display call stack" function, depending on
the task selected. To do this, place the cursor on the line of the ST source file
with the breakpoint and click the "Display call stack" button.
again.
To activate/deactivate all breakpoints, proceed as follows:
1. On the "Breakpoints" toolbar, click the "Activate all breakpoints" button.
2. To deactivate all breakpoints, click the "Deactivate all breakpoints button".
TR
An active breakpoint is shown as a solid triangle at the top left hand corner of
the MCC command.
Note Breakpoints can also be activated and deactivated in the debug table. To do
this, select the SIMOTION device in the project navigator and select "Debug
table" from the shortcut menu.
The windows that open execute the action below, depending on which
breakpoints you activate or deactivate:
SI
Continue program Executing the selected command or continuing the program execution is
possible with the "Continue" button (Shortcut: Ctrl+F8) on the "Breakpoints"
toolbar. Program execution then stops when the next breakpoint is reached.
Next step In the MCC and LAD/FBD programming languages, the task in single steps that
was stopped at an activated breakpoint can be resumed. On a subprogram call,
the called subprogram is considered as an instruction and executed as such.
SI
Stepping through
a subprogram In the MCC and LAD/FBD programming languages, the task in single steps that
was stopped at an activated breakpoint can be resumed. On a subprogram call,
stepping is performed into the subprogram.
Note The "Breakpoints" function and the "Monitoring" function can be used together in
an MCC chart.