Differences to SYPTLite and Unidrive SP

Navigation:  »No topics above this level«

Differences to SYPTLite and Unidrive SP

Previous pageReturn to chapter overviewNext page

 

Differences Overview

 

The Unidrive M Onboard programming capability is a new generation of the onboard programming capability provided by Unidrive SP. There are a number of differences between the programming capability of of Unidrive M and SP as described in the following sections.

 

Program Tools and Languages
Program Structure
Task Differences
Program Variables
Program Size and Memory Limits
Initialization
Data Types

 

See Also

 

Unidrive M Programming Reference

 

 

Program Tools and Languages

 

Unidrive SP programs are written using the SYPTLite ladder diagram editor. SYPTLite allows the user to write a single section of ladder program, containing a number of ladder rungs, for execution in a background task on the SP.

 

Unidrive M is programmed using Machine Control Studio. Compared to SYPTLite, Machine Control Studio supports the following languages for onboard programming:-

 

Standard IEC 61131-3 programming via the following languages:-

 

Function Block Diagram
Ladder Diagram
Instruction List
SFC (Sequential Function Chart)
Structured Text

 

and an extension to IEC 61131-3:

 

CFC (Continuous Function Chart)

 

To find out more about these languages please consult the main Machine Control Studio help file or search on your favourite search engine, e.g. Google or Yahoo, for information on IEC 61131-3 languages.

 

See Also

 

Differences Overview

 

Program Structure

 

SYPTLite allows the user to write a single section of ladder program, containing a number of ladder rungs.

 

Machine Control Studio allows the user to construct a program from a number of POUs. A POU (Program Organisation Unit) can be a function, function block or program. Unlike SYPTLite, Machine Control Studio also allows the user to construct and share their own libraries of POUs. All these capabilities allow the user to create more adaptable programs with much greater structure than is possible with SYPTLite.

 

For a description of the POU types, read below:

 

Function
Function Block
Program

 

Note: All of the POU types can be written in any of the supported languages, e.g. you can write function blocks in Structured Text or Ladder and not just in function block diagrams.

 

Function

 

The standard description of a function is that "a function is a POU which yields exactly one data element (which can consist of several elements, such as fields or structures) when it is processed".

 

The main advantage of using a function to perform some processing when writing a user program is that the function releases any RAM it uses after it has been executed and does not store any values between successive calls. The standard library provided with CoDeSys contains a number of examples of functions such as ABS or LIMIT - all these functions simply work out their result from the arguments you pass on each call. This means that functions are relatively light-weight in terms of memory usage compared to function blocks.

 

Note: The standard description of a function is not entirely accurate - a function can have many outputs. There is no need to write a function block (which will use more RAM) in order to write a POU that returns multiple values. As an example, take the simple function below (written in Structured Text).

 

// This function takes two inputs and returns the result of multiplying them together.

// It also outputs double the value of each input.

FUNCTION DoSomeMultiplication : DINT

VAR_INPUT

 XI : DINT;

 YI : DINT;

END_VAR

VAR_OUTPUT           // Note that the function outputs these values (XO and YO).

 XO : DINT;

 YO : DINT;

END_VAR

VAR

END_VAR

 

 XO := 2 * XI;

 YO := 2 * YI;

 DoSomeMultiplication = X1 * Y1;

 

END_FUNCTION

 

then a call to the function can be performed using named association between the argument names and actual values ...

 

// Get  3 values from calling the function - the return result plus the values of the XO and YO output arguments.

TheResult := DoSomeMultiplication(XI := 2, YI := 4, XO => X, YO => Y);

 

See Also

 

Differences Overview

 

 

Function Blocks

 

A function block in Machine Control Studio is similar to a function block in SYPT Pro. The block will remember the values of its variables between calls. In order to remember values between calls, a function block stores all its variables and arguments on the program heap which means that each function block you use eats in to the amount of RAM available to the user program.

 

One key difference between SYPTLite function blocks and Machine Control Studio function blocks is that you have to declare an instance of a function block before you can call it. For example, to use the CTD (down counter) function block, an instance would be declared as follows:

 

VAR

 MyDownCounter : CTD;

END_VAR

 

and then the instance would be called:

 

MyDownCounter(CD:= VarBOOL1, LOAD:=VarBOOL2 , PV:= VarWORD1);

 

See Also

 

Differences Overview

 

 

Programs

 

A program POU is very similar to a function block POU. The main use of a program POU is that only program POUs can be called from tasks. The program POU can then contain code and call functions and function blocks to perform the desired processing.

 

See Also

 

Differences Overview

 

 

Task Differences

 

Unidrive SP provided a single, non-deterministic Background task to the user program. Unidrive M also provides a background task - now called Freewheeling - but it also provides a deterministic Clock task. For more information, see Tasking Model.

 

See Also

 

Differences Overview

 

 

Program Variables

 

A SYPTLite program could only access drive parameters but a Unidrive M onboard user program can also declare variables. This offers a number of advantages in that a program can declare more user-defined data than was possible using a SYPTLite ladder diagram; also accessing variables is a lot quicker than accessing a drive parameter.

 

See Also

 

Differences Overview

 

 

Program Size and Memory Limits

 

Memory Type

Size

Description

RAM

1KB+

The Unidrive M makes approximately 4 times the amount of RAM available to the user program compared to Unidrive SP.

ROM

11KB

The Unidrive M makes approximately 2.5 times the amount of program code space available to the user program compared to Unidrive SP.

 

See Also

 

Differences Overview

 

 

Initialization

 

Unlike SYPTLite and the Unidrive SP, there is no FIRST_SCAN block that can be used to indicate whether a program/ task is being scanned for the first time since the program was started. Instead, Unidrive M implements a scheme that allows initialization to be performed in the Freewheeling task BEFORE the Clock task (if present in the user program) first runs.

 

See Tasking Model for more information.

 

See Also

 

Differences Overview

 

 

Data Types

 

SYPTLite and Unidrive SP did not support definition of variables in programs. Not only does Unidrive M let you create variables, it includes a far richer set of data types than older Control Techniques tools like SYPT Lite and even SYPT Pro.

 

Unidrive M supports double-precision floating-point maths using the LREAL data type. This can make programming more natural for the developer, especially when reading and writing parameters that contain decimal places. On Unidrive SP, if the value of a parameter containing decimal places was read into the user program, the value would automatically be scaled into a fixed point number, e.g. if the Speed Reference had a value of 1.3, then the scaled integer value 1300 would be returned when the program read the parameter value. On Unidrive M, the user program will be returned the floating-point value 1.3.

 

In addition to LREAL, Unidrive M onboard programming supports data types such as BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT and so on.

 

For more information, please consult the main Machine Control Studio help file.

 

Note that Unidrive M DOES NOT support the 64-bit integer and bit data types - LINT, ULINT.

 

See Also

 

Differences Overview