Persons supervising and performing the electrical installation or maintenance of a Drive
and/or an external Option Unit must be suitably qualified and competent in these duties.
They should be given the opportunity to study and if necessary to discuss this User Guide
before work is started.
The voltages present in the Drive and external Option Units are capable of inflicting a
severe electric shock and may be lethal. The Stop function of the Drive does not remove
dangerous voltages from the terminals of the Drive and external Option Unit. Mains
supplies should be removed before any servicing work is performed.
The installation instructions should be adhered to. Any questions or doubt should be
referred to the supplier of the equipment. It is the responsibility of the owner or user to
ensure that the installation of the Drive and external Option Unit, and the way in which
they are operated and maintained complies with the requirements of the Health and Safety
at Work Act in the United Kingdom and applicable legislation and regulations and codes of
practice in the UK or elsewhere.
The Drive software may incorporate an optional Auto-start facility. In order to prevent
the risk of injury to personnel working on or near the motor or its driven equipment and to
prevent potential damage to equipment, users and operators, all necessary precautions
must be taken if operating the Drive in this mode.
The Stop and Start inputs of the Drive should not be relied upon to ensure safety of
personnel. If a safety hazard could exist from unexpected starting of the Drive, an
interlock should be installed to prevent the motor being inadvertently started.
General information
The manufacturer accepts no liability for any consequences resulting from inappropriate,
negligent or incorrect installation or adjustment of the optional operating parameters of
the equipment or from mismatching the variable speed drive (Drive) with the motor.
The contents of this User Guide are believed to be correct at the time of printing. In the
interests of a commitment to a policy of continuous development and improvement, the
manufacturer reserves the right to change the specification of the product or its
performance, or the contents of the User Guide, without notice.
All rights reserved. No parts of this User Guide may be reproduced or transmitted in any
form or by any means, electrical or mechanical including photocopying, recording or by
any information-storage or retrieval system, without permission in writing from the
publisher.
5.8 Program monitoring and debugging facilities5-12
6 Serial Communications 6-1
6.1 Introduction6-1
6.2 Hardware connections6-2
6.3 ANSI communications6-4
6.4 Serial communications modes6-12
6.5 ANSI instructions6-15
6.6 Example ANSI instructions6-16
7 Reference 7-1
7.1 Tasks7-1
7.2 Instructions and functions7-5
8 Features8-1
8.1 PLC parameters8-1
8.2 Introduction8-2
8.3 Encoder lines8-3
8.4 Position8-4
8.5 Enabling the position controller8-5
8.6Default and Reset Values8-6
8.7 Parameter Descriptions8-7
8.8 Logic Diagrams8-20
8.9 Digital Lock8-25
8.10 Cam function8-27
8.11 Reference Switching8-30
8.12 Timer/Counter unit8-32
8.13 Digital I/O ports8-36
8.14 Non-volatile memory storage8-37
8.15 Using the RS232 port for Drive to Drive
communications8-37
9 Diagnostics 9-1
9.1 Run-time errors9-1
9.2 Run-time trip codes9-2
9.3 Compiler error messages9-3
9.4 Advanced error-handling9-5
10 Parameters 10-1
10.1 UD70 set-up parameters10-1
10.2 Virtual parameters10-4
10.3 RS485 port modes10-11
10.4 General-purpose parameters10-12
1Introduction
On a Variable Speed Drive such as Unidrive, timing functions necessary for
the correct operation of power devices are performed by its own
microprocessor operating in real-time. This imposes limitations on the
microprocessor when carrying out other duties, resulting in a reduction of
flexibility of the Drive.
To maximize this flexibility, a second processor can be used for running
application-specific software. This second microprocessor is the
which allows the Drive to be easily adapted to applications by programming
software in the UD70.
1.1 Overview
The UD70 is a compact microcomputer contained in a Large Option Module
for easy installation in any size of Unidrive.
Together with the
software or use pre-written software in order to enhance the flexibility of a
Unidrive.
DPL Toolkit (Windows™ interface)
The DPL Toolkit is contained on two diskettes. It is a program which runs in
Microsoft® Windows™ Version 3.1x and Windows™ 95. Programs for the
UD70 are written on a host PC using the DPL Toolkit.
The
UD70 uses a high-level programming language called DPLDPL
(Drive Programming Language) which is in many respects similar to the
BASIC language. DPL is a compiled program which gives it the ability to run
at high speed.
The DPL Toolkit is used to write, compile and download a DPL program to an
UD70. The Toolkit also has a comprehensive set of de-bugging facilities to
aid the development and testing of the DPL program.
Connection between the
communications link. This link need only be used during program
development, testing and commissioning. It can be disconnected after the
software has been successfully loaded.
UD70
DPL Toolkit, the UD70 allows the programmer to write
UD70 and host PC is via an RS232 serial
UD70
Issue code: 70nu2
Introduction1-1
UD70 connected to a host computer by a serial link
1.2 Memory
The compiled UD70 program and the user-created source program are
stored in non-volatile EEPROM memory on the UD70 card. This type of
memory allows the programs to be loaded using the serial port.
Latest versions of programs can be easily updated without removing any
integrated circuits or without using any specialized programming equipment.
The filing system of the
UD70 at any one time.
The compiled program can be stored along with the DPL source code. This
allows the site engineer to read the program stored in the
program is not on the host PC. (This option can be disabled if it is not required.)
UD70 allows only one program to be stored in the
UD70, even if the
1.3 PC requirements
The minimumminimum requirement for the DPL Toolkit is as follows:
IBM AT compatible 386SX PC, Windows™ 3.1, 4Mb RAM, DOS5
PC with 8MB RAM is recommended
A 486
1.4 Technical data for the UD70
Intel 960 32-bit RISC processor
96kb of user program storage
8kb user
16MHz clock
RS232 port for programming (IBM AT compatible)
RS485 optically isolated port for permanent serial communications
RAM
1.5 User knowledge
This User Guide assumes that the user has at least superficial knowledge of
Microsoft® Windows™. Refer to the Windows User’s Guide for specific
information on performing operations in Windows™.
1-2Introduction
Issue code: 70nu2
UD70
2Installation
The voltages present in the Drive are capable of
inflicting a severe electric shock and may be lethal. The
Stop function of the Drive does not remove dangerous
Warning
2.1 Installation procedure
voltages from the Drive or the driven machine.
AC supplies to the Drive must be disconnected at least
15 minutes before any cover is removed or servicing
work is performed.
Location of the UD70 in the Unidrive
Refer to the Unidrive User Guide for instructions on fitting a large option
module to the Drive.
UD70
Issue code: 70nu2
Installation2-1
2.2 Configuring the system
Host PC connections
RS232 Port
RS232 serial port is a dedicated link to the host PC. The port is a 9-way
The
female D-type connector. Ready-made cables for RS232 serial
communications are generally available.
The table below gives the minimum required connections between the
and a 9-way and 25-way pin COM port connector.
UD70
pin no.
223
332
557
9-pin connector
pin no.
25-pin connector
pin no.
The RS232 port should be used only for commissioning because isolation or
protection of the port is not included.
Use the following instructions for connecting a host
1 Ensure no static charge has built up when the plug is inserted.
2 Using a maximum cable length of not more than 3 metres (10 feet),
connect an
RS232 cable to the RS232 serial port on the UD70 and to the
communications serial port of the host
PC:
PC.
Installing the DPL Toolkit in the host PC
Use either of the following procedures:
Windows 3.1
The DPL Toolkit requires a minimum of 4Mb of computer memory. This may be
virtual memory. Virtual memory may be set in the 386386 Enhanced Enhanced section of Windows
Control Panel.
1 Start Microsoft Windows
2 Insert disk 1 of the DPL Toolkit into the A: Drive of the host PC.
3 In Windows Program Manager, select FileFile on the menu bar. Select RunRun.
4 Type A:\SETUP.
RAM or
UD70
5 Click on
Windows 95
1 Insert disk 1 of the DPL Toolkit into the A:A: of the host PC.
2 In the menu, select RRun...un....
3 Type A: \SETUP .
4 Click on
2-2Installation
Issue code: 70nu2
UD70
Downloading the system file
The UD70 has no pre-loaded system software. The first task is to program
the system software using the DPL Toolkit. Use the following procedure:
1 Connect the serial communications cable to the UD70.
2 Apply AC power to the Drive.
3 In Windows 3.xx Program Manager, or in the Windows 95 Start menu,
click on:
The DPLDPL Toolkit Toolkit window appears. At the top of the window are a
menu bar and toolbar.
4 If the serial port of the host PC is not COM1, open the ProjectsProjects menu
and select ConfigureConfigure. In the drop-down menu that appears, select
ComportComport. This opens a further drop-down menu which allows
selection of the required communications port.
5 Click on (Open Task ManagerOpen Task Manager). After a few moments, the DPLDPL
Task ManagerTask Manager dialog box appears.
If the dialog box does not appear, and all the buttons in the lower
6 Click on . The File Viewer File Viewer dialog box appears.
UD70
Issue code: 70nu2
toolbar of the window appear shaded (inactive), communications
could not be established with the
correct, and the correct
COM port is used.
UD70. Check the connecting cable is
Installation2-3
Note
In the panels on the left side of the dialog box the path and names of
.SYS files can be selected.
the
The system files are located in directory MD29GUI\BIN\SYS.
7 Select the correct path for the required system files. Double-click on
SYS file specified in the following table:
the .
DriveFile
UD70UD70OS.SYS
UD70 with Interbus S or
Profibus DP
UD70 with ModBus PlusMBPLUS.SYS
UD70 with CTNetUD70NET.SYS
IBSPROFI.SYS
The ProgrammerProgrammer dialog box appears.
2-4Installation
Issue code: 70nu2
UD70
8 Click on (green light showing). The system file is now loaded
into the
UD70.
UD70
Issue code: 70nu2
Installation2-5
2-6Installation
Issue code: 70nu2
UD70
3Getting Started
3.1 Introduction
This chapter explains the key elements of DPL programming, and the
methods used to create, compile and run an example program using the DPL
Toolkit.
An example of a short
of the program instructions.
Note that parameter numbers are denoted in this User Guide and in
DPL programs by # (eg. parameter 1.21 is denoted as #1.21).
3.2 Example DPL program
The DPL program described here is called SawtoothSawtooth, because it applies a
repetitive cycle consisting of a linear increase in speed demand followed by
an instantaneous reduction to zero, as shown in the following diagram.
Repetitve cycle produced by the Sawtooth program
DPL program is given below, followed by explanations
UD70
Issue code: 70nu2
Getting started3-1
Start
#1.21 = 0
Is #1.21 < 1000?
No
Flow diagram of program Sawtooth
Program instructions
$TITLE Sawtooth
$VERSION 1.1.1
$DRIVE Unidrive
$AUTHO R MyName
$COMPA NY MyCo
//Note: T his is a c o m me nt.
BACKGROUND{
Top:
#1.21=0
DOWHILE #1.21<1000
#1.21=#1.21+1
LOOP
GOTO
Top:
}
Yes
#1.21=#1.21+1
3-2Getting started
Issue code: 70nu2
UD70
Explanation of the example program
$TITLE Sawtooth
The first line of a program must be
can have a maximum of 64 characters.
$VERSION 1.1.1
The second line is
of eight characters. The recommended format is $VERSI ON 1.0.0.
Updates are easily shown by increasing the last number, eg. 1.0.11.0.1.
Major modifications are shown by 2.0.02.0.0, 3.00 3.00, etc.
$DRIVE Unidrive
The third line is
it is installed in. (Since the DPL Toolkit can be used with the UD70 and
the MD29, this must be stated.)
$AUTHOR MyName
$COMPANY MyCo
The fourth and fifth lines are used to define the author of the program
and the company name.
Note
Unless these lines are included, the program will not be
compiled.
//Note: This is a comment.
The program ignores comment lines which can be placed anywhere in a
program. Comments are always preceded by either a double forward
slash [////] or a semi colon[;].
Comments are useful for inserting descriptions, or for giving
explanations for the benefit of the user or programmer.
BACKGROUND{
BACKGROUND is a type of Task. (All executable code must be
contained within a Task.) There are many different types of Task,
which, in effect, define the priority of the code and allow blocks of
code to be run on different time-bases.
BACKGROU ND task is a free-running task which can be compared to
The
the way a PLC runs a program, for example. Full details of the Tasks are
given in Real-time programming in Chapter 4 DPL Programming.
Top:
Top:Top: is a label which marks an absolute position in the program. A label
must always be followed by a colon [::].
A label defines the destination of a
any name (eg. mylabelmylabel).
#1.21=0
A hash (##) expression accesses Drive parameters. In this case the
parameter is 1.21 (menu 1, parameter 21). This is a preset speed
reference parameter in the Unidrive, and it is set at zero.
$TITLE program name. The name
$VERSIO N number. The number can have a maximum
$DRIVE drive name. This tells the compiler which Drive
GOTO statement. It can be given
UD70
Issue code: 70nu2
Getting started3-3
Note
DO WHILE #1.21<1000
DO WHILE is a loop statement. In this example, it gives the program an
instruction to repeat the following block of code while the value of
parameter 1.21 is less than 1000.
#1.21=#1.21+1
This line adds the value 11 to parameter 1.21. Every time this command is
executed, 11 is added to the parameter value.
LOOP
LOOP is the end expression for the Instruction DO WHILE. LOOP tells
the program to go back to the line DOWHILE and check that the DO
instruction remains true. When the value of #1.21 = 1000#1.21 = 1000, DO
WHILE
#1.21 < 1000 #1.21 < 1000 becomes false. The instructions between DO
WHILE
and LOOP stop being repeated and the program goes to the
WHILE
next line after the LOOP command.
GOTO Top:
GOTO is a flow-control instruction. In this case, it tells the program to
go to the label Top:Top:. This causes the program to run continuously.
The label name must be specified using a colon[:].
} Closing brace
Instructions within braces belong to the defined Task. Closing-braces
work in conjunction with opening-braces. In this example, the
opening- and closing-braces work in conjunction with the Task
BACKGROUND..
3.3 Creating a DPL file using the DPL Toolkit
This section shows how to write, compile and download the example
DPL program for the Unidrive.
Opening the DPL Toolkit
In Windows 3.xx Program Manager, or Windows 95 Start menu, click on:
The DPLDPL Toolkit Toolkit window appears. At the top of the window are a menu bar
and toolbar.
3-4Getting started
Issue code: 70nu2
UD70
Creating a file
1 Click on or open the File File menu and select NewNew.
2 Enter the following program exactly as it appears, using the tab key to
indent lines.
$TITLE Sawtooth
$VERSION 1.1.1
$DRIVE Unidrive
$AUTHO R MyName
$COMPA NY MyCo
//Note: T his is a c o m me nt.
BACKGROUND{
Top:
#1.21=0
DOWHILE #1.21<1000
#1.21=#1.21+1
LOOP
GOTO
Top:
}
3 Open the FileFile menu and select Save As...Save As.... The Save File AsSave File As dialog box
appears.
4 In the Folders: Folders: list, select the ProjectsProjects directory. In the FileFile name: name:
5 Click on . The file is now saved.
The program is ready for compiling into machine code.
Important Note
UD70
Issue code: 70nu2
text box, type
DPL programs must be saved as .DPL files. If this is not
SAWTOOTH.DPL.
done, the program cannot be compiled into machine code.
Only the saved version of the program is compiled.
Getting started3-5
Compiling the program
The DPL Toolkit contains a compiler which converts DPL programs from text
format to binary machine code which the UD70 can understand. The
compiler converts the .DPL file into a binary file with a .BIN extension.
Use the following procedure.
1 Click on at the right of the Toolbar. The Compile...Compile... dialog box
appears.
2 If the DPL source file is required to be downloaded to the UD70, ensure
the Embed DPL Source CodeEmbed DPL Source Code check box is checked. This facility
allows the DPL program to be read back to the
computer copy becomes lost, for example).
If the DPL source file is not to be downloaded, ensure the check box is
unchecked. When the Compile...Compile... dialog box next appears, the check
box retains the last setting.
(The other options in this dialog box are described in Compiling and
running programs in Chapter 5 DPL Toolkit.)
PC at a later date (if the
3 Click on
4 The CompilationCompilation box appears for a few seconds. It is not necessary to
observe the contents of the CompilationCompilation box.
5 The program is now compiled, ready for downloading to the UD70.
If instead a Build errorsBuild errors window appears with errors displayed, correct
the program for typing mistakes and repeat the compilation. (Error
messages are described in Chapter 9, Diagnostics.)
3-6Getting started
Issue code: 70nu2
UD70
Connecting to the UD70
It is now necessary to establish communications from the host PC to the
UD70 in order to download the compiled file.
Use the following procedure:
Click on
appearing below the standard toolbar.
Note
If all the buttons on the lower toolbar appear shaded, it is
an indication that communications could not be
established with the UD70. Check that AC power is applied
to the Drive, and that the serial communications cable is
correctly inserted.
Downloading the program
1 In the Task Manager toolbar, click on . The ProgrammerProgrammer dialog
box appears.
. The Task Manager opens with the Task Manager toolbar
2 In the ProgrammerProgrammer dialog box, click on (green light showing).
UD70
Issue code: 70nu2
The files
the
SAWTOOTH..BIN and SAWTOOTH..DPL are now downloaded to
UD70. Down-loading takes a few seconds to complete.
Getting started3-7
Note
Running the program
The Sawtooth program rapidly alters the speed
reference parameter of the Drive. For safety, ensure
the Drive is disabled before running the program.
Warning
In the Task Manager toolbar, click on
The Speed referenceSpeed reference parameter #1.21 #1.21 in the Drive will change value.
The UD70 can hold only one compiled program (ie. .BIN file)
in memory at one time. A program that is downloaded to
the UD70 will over-write an existing program.
Note that the ramping-up behavior cannot be observed since the
program alters the parameter value at a faster rate than the display is
updated.
3-8Getting started
Issue code: 70nu2
UD70
4DPL Programming
This chapter explains the following parts of a DPL program:
• Program headers
• Comments
• Variables
• Parameters
• Tasks
• User-defined sub-routines
• Instructions
The explanation is followed by a section on optimizing
4.1 Program headers
A DPL program must begin with five program headers in the correct order,
as follows:
• Program title
• Program version
• Drive name
• Author name
• Company name
Each program header must be contained on a single instruction line in
the program.
Program title
DPL programs.
Syntax
$TITLE Program title
The
Maximum length: 64 characters
Program version
Syntax
UD70
Issue code: 70nu2
$VERSION
The $VERSION VersionVersion NumberNumber is for use by the programmer. It is
recommended that the format of the version number should be as follows:
Minor updates can be shown by increasing the last digit, eg. 1.0.21.0.2. Major
modifications can be shown by increasing the first digit, eg. 2.0.02.0.0.
Maximum length: 8 characters
$TITLE ProgramProgram titletitle is for use by the programmer.
$TITLE Sawtooth generator Sawtooth generator
eg.
Version Number
$VERSIO N 1.0.1 1.0.1
DPL programming4-1
Drive name
Syntax
$DRIVE
The type of Drive must be specified in $DRIVE DriveDrive namename since the DPL
Toolkit can be used with different types of Drive.
This program header ensures that the program is correctly compiled for the
option module and Drive.
Note
If a different Drive is specified, the program may not be
compiled, or run-time error 53 will occur when the
program is downloaded to the UD70.
Author name
Syntax
$AUTHOR
The $AUTHOR
Maximum length: 64 characters
Company name
Syntax
$COMPANY
The $COMPANY
Maximum length: 64 characters
Example program headers
Drive name
Author name
Author name
Company name
Company name
is for use by the programmer.
is for use by the programmer.
$TITLE Sawtooth
$VERSION 1 .0 .1
Unidrive
$DRIVE
$AUTHOR A.H.
$COMPANY
Control Techniques
4.2 Comments
Comments are purely for information and explanation purposes. They act in
the same way as REM commands by not acting on the program.
Comments begin with a double forward slash [//] or a semi-colon [;]. They
can be placed on their own line, or at the end of instruction lines. A
Comment ends at the end of the line.
Example
//This line contains a comment, which ends with the line.
//If the comment fl ows onto the next line, double forward
//slashes must be used to start the n ext lin e.
4-2DPL programming
Issue code: 70nu2
UD70
4.3 Variables
Basic variables
There are two basic types of variable, as follows:
• Integer variable (
• Floating-point variable (
INT)
FLOAT)
Integer
variables
Floatingpoint
variables
Integer variables are denoted by placing a % % symbol after the name of the
variable, and are internally represented by a two’s complement
32-bit number. This gives a decimal range of ±2147483647.
Floating-point variables have no symbol. These variables are
IEEE double-precision (64-bit) numbers which give a range of approximately
±1.7976 x 10
Accessing the variables
All variables are global within a program (ie. they can be accessed and
altered by any task). (There are no local variables.)
Bit-addressing of variables
All integer variables and arrays (see below) may be bit-addressed. This
means that each individual binary bit in the variable may be separately read
or written to. Bit-addressing is achieved by appending .n.n to the end of the
variable name, where nn is the bit number to be accessed.
Example
flag s% .3 = 1;set bi t 3 to 1
IF flags%.5 = 1 T HE N ... ;check bi t 5
Naming conventions
The first character of a variable must be a letter. Subsequent characters
may include letters, numbers and the underscore (_) character. These may
be in any order.
Variable names are case sensitive (eg. the variable name speed%speed% is not the
same as SPEED%SPEED%).
308
±
.
Preferred use of variables
It is recommended that integer variables are used where possible.
Operations on integer variables perform much faster than for
floating-point variables.
UD70
Issue code: 70nu2
DPL programming4-3
Arrays
Arrays are collections of variables of the same type (integer or floating
point) under the same name. Note that only single-dimension arrays
are allowed.
Each element (individual component) of an array is, in effect, a separate
variable. An element is accessed by a program by specifying the array name,
then placing the element number in square brackets [ ][ ] after the array name
The two basic forms of arrays are as follows:
Dynamic
arrays
Example
Constant
arrays
Example
Dynamic arrays can be set up and changed by DPL programs. A dynamic
array must contain, integer variables or floating-point variables, but not
both types of variable.
A dynamic array must first be specified using the
the INITIAL task), and the number of elements specified in square brackets
after the variable name. Dynamic arrays are placed in the 8kB of volatile
memory in the UD70 which limits the maximum size of the array.
DIM myarray%[20];Integer array having 20 ele ments
DIM array2[30];Floating-point array having 30 ele me nts
The elements in an array are numbered as follows:
0 to [Number of elements] – 1
From the example of an integer array given above, the first element of
myarray%[]myarray%[] is as follows:
myarray%[0 ]
The last element is as follows:
myarray%[19]
Constant arrays contain fixed pre-defined values that cannot be changed
by the DPL program when the program is being run. The values of the
constant array are defined in the DPL program by using a special section
CONST. (This section is typed in exactly the same way as a task.)
called
Only integer values can be defined in a constant array.
The advantage of using a constant array is that the array is placed in the
96kB of memory space in the
limited only by the amount of available program space in the UD70, and not
by the size of the 8kB RAM. The program space is used to store the
compiled DPL program, constant array data, and (optionally) the
This defines an array called c c_array%[]array%[], which containes nine elements.
Note that the value of each element can be separated by a comma or a
new line.
UD70 which allows the size of the array to be
DIM instruction (usually in
4-4DPL programming
Issue code: 70nu2
UD70
4.4 Parameters
There are two types of parameter, as follows:
• Drive parameters
• Virtual parameters
(See Chapter 10 Parameters.)
Parameters are denoted by a ## (hash) symbol and are accessed using an xx,yy
format, where xx represents the menu and yy represents the parameter in the
menu.
For example, parameter p7.05p7.05 is accessed by entering #07.05#07.05, and p18.01p18.01 is
accessed by entering #18.01#18.01. Leading zeroes in the parameter can be
omitted, eg. #7.5#7.5 is the same as #07.05#07.05.
Parameters can also be accessed indirectly using an integer variable to
denote the parameter number. See Parameter pointers later in this chapter
for details.
4.5 Operators
Operators perform mathematical or logical operations on values. The
following operators are supported in DPL programming.
Note
Certain operators work only with integer values
or variables.
Operators for floating-point and integer variables
+ Plus
– Minus
/ Divide
* Multiply
UD70
Issue code: 70nu2
DPL programming4-5
Operators for integer variables only
Example
Example
Example
& Logic ANDAB Y
000
010
100
111
5 & 14 = 4
| Logic OR
Logic XORAB Y
!Value
Bit invert
AB Y
000
01 1
101
111
000
01 1
101
110
This Operator inverts the least-significant bit, and converts all
other bits to zero.
Example
!(value, bit-field-size)
Bit-field invert
1001000 (binary) is converted to 0000011 (binary)
This Operator inverts the specified number of least significant
bits, and converts all other bits to zero. The bitbit-field-field-size-size
specifies the number of least-significant bits that are to be
converted.
Example
Result% = !(value%, 3)
100100100 (binary) is converted to 000011011 (binary).
%
Remainder
This Operator gives the remainder when an integer is divided
by another integer.
Example
5 % 2 = 1
8 % 3 = 2
5 | 14 = 15
5 & 14 = 11
4-6DPL programming
Issue code: 70nu2
UD70
4.6 Tasks and real-time programming
Real-time programming runs with reference to a clock to enable the user to
specify the actual times instructions are executed, not just the order in
which they are executed. When real-time programming, a task Structure
(or philosophy) has to be maintained.
UD70 programs contain sections called tasks, where a task enables a priority
to be given to a sub-routine. Seven levels of priority are defined by these
tasks in the following order:
INITIAL task
•
BACKGROU ND task
•
CLOCK task
•
ENCODER task
•
SPEED task
•
EVENT task
•
ERROR task
•
Each task is specified by its name in the program. The contents of each task
must be placed in braces { }{ }.
Example
INITIAL task
Example
CLOCK{
instru ct ions
}
The INITIAL task is used typically to initialize program variables and Drive
parameters in the DPL program. The task runs only when the UD70 is reset
or at the moment AC power is applied.
The
INITIAL task has total priority over all other tasks when running; the
other tasks are prevented from running. This is significant when the CLOCK,
or ENCODER tasks are to manipulate data which have initial values.
EVENT
INITIAL{
// This is the only place to reliably initia lize ‘timer’
time r% = 0
}
CLOCK{
//This task is set a t 5 ms
//The v alue of time r m u st b e initiali z ed be fore CL OC K i s ru n
time r% = ti m er% + 1
IF timer% > 200 THEN
//200, 5ms inte rvals = 1 second
PRINT “1 Second expired”
timer% = 0
ENDIF
}
UD70
Issue code: 70nu2
DPL programming4-7
BACKGROUND task
The BACKGROUND task is used for functions and commands that do not
require time-related or encoder-related monitoring. This task would be
used for the following:
The
recommended that the majority of the program is run in the BACKGRO UN D
Task.
Note
• Data logging
• Checking digital inputs
• Setting output status
BACKGROU ND task runs after the INITIAL task is completed. It is
The BACKGROUND task does not automatically loop.
Example
BACKGROUND{
RAMP:
#1.21 = 0
DO WHILE #1.21<1000
#1.21 = #1.21+1
LOOP
GOTO RAMP:
}
4-8DPL programming
Issue code: 70nu2
UD70
Loading...
+ 124 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.