5.1 Overview of All User Commands
Command code and its meaning Page number
ACC - Acceleration change 5-7
AEA - Bit set / clear 5-7
AKN - Compare bit 5-8
AKP - Compare byte 5-9
APE - Byte set / clear 5-10
BAC - Branch conditional on count 5-11
BCE - Branch Conditional on bit 5-12
BIC - Branch conditional on bit field value 5-12
BIO - Branch conditional on byte compare 5-13
BPA - Branch conditional on byte 5-14
CIO - Copy bitfields 5-15
CLC - Clear counter 5-15
CON - Steady state speed 5-16
COU - Count 5-16
CPJ - Compare and jump 5-18
CPL - Clear position error 5-18
CPS - Compare and set a bit 5-19
CST - Change Subroutine stack level 5-19
CVT - Convert Variable <- -> Marker
FAK - Length scaling factor 5-22
FOL - Slave axis 5-23
HOM - Home Axis 5-24
JMP - Jump Unconditional 5-25
JSR - Jump to Subroutine 5-25
JST - Jump and Halt 5-26
JTK - Program jump in parallel Task 5-26
MAT - Mathematics 5-27
MOM - Torque Limitation 5-27
NOP - No Operation (Blank Block) 5-28
A
B
C
F
H
J
M
N
5-2
Writing the User Program ECODRIVE03 FLP-01VRSPBK - Stop motion 5-29
PFA - Pos. absolute against end-stop 5-30
PFI - Pos. incremental against end-stop 5-30
POA - Position absolute 5-31
POI - Position Incremental 5-32
PSA - Position absolute with in-Position 5-33
PSI - Position incremental with in-Position 5-32
REP - Jump on max. search limit reached 5-35
RTM - Round table-Modus 5-35
RTS - Return from Subroutine 5-36
SAC - Set Abs. position Counter 5-37
SET -.Set variable 5-38
SRM - Drive to registration mark 5-38
VCC - Velocity change command 5-40
VEO - Velocity Override Command 5-42
WAI - Wait 5-46
P
R
S
V
W
ECODRIVE03 FLP-01VRS Writing the User Program
5-3
5.2 General Information
The basic programming is preprogrammed, and the user has no external access to it.
The programming language for the user program is a code similar to the BASIC programming language and was developed especially for use with this program.
The user program can have a maximum size of 1000 instructions or lines.
Only one command is stored within each program instruction.
In programming, any four-digit program number between 0000 and 0999 is allowed.
The user program can be loaded via the serial port.
Program input can take place in any operating mode. A running program should not be interrupted.
With most commands, the processing time for an instruction is exactly the same as the CPU cycle time of 2 ms.
After that, the instruction with the next higher sequence number is processed (unless a jump instruction is given). In the descriptions that follow, this action is called ‘proceed immediately to next instruction.’
In the case of commands involving wait states for receipt of an outcome, the process time is always extended by the CPU cycle time required for the outcome to arrive.
In most commands, both constants and variables can be used. For clearer understanding, command examples are shown with variables and with constants. If both example lines contain a variable or a constant in the same location, only this type of value is allowed.
5-4
Writing the User Program ECODRIVE03 FLP-01VRS5.3 Loading the Program
The program can be loaded via the serial port of any computer having an RS232C or RS485 interface.
Parameters B001 and B002 control the activation and setting of the serial interface. The programming module can be used to provide a default setting to ensure establishment of a reliable communications link.
Handling of the interface and the transmission format used are described in Section 9.2.
5.4 Starting the User Program
The user program can be started only in the ‘Automatic’ operating mode.
One exception is the ‘manual vector’
The program start address for Task 1 is reset to '0000' after each change of operating mode or system restart. The start addresses for Task 2 and Task 3 are set in Parameter AA00.
In Task 3, the program runs as a higher-level program in every operating mode (except parameter mode) and is not affected by the ‘Start’ or
‘Immediate Stop’ input variables.
The program start command is received via the ‘Start’ input.
5.5 Stopping the User Program
The running program can be stopped again at any time. There are two ways to accomplish this:
1) Stop the program externally using the ‘Immediate Stop’ input 2) Stop the program using the JST user command
If the operating mode was not changed after such a stop, the program continues from the point of interruption once the start command is received.
There are also two ways to interrupt the user program. Unlike a program stop, no start command is required once the cause of the interrupt is removed, i.e., the program continues from the point of the interrupt.
1) Program interrupt caused by signal at input 'Interrupt' 2) Program interrupt caused by signal at input 'Feed angle
monitoring'
See also Section 8, Parameter A116
In the event of an error message, the user program is always stopped in Tasks 1, 2. Continuation of the program following correction of the problem is possible only at instruction 0000 for Tasks 1 and 2 for the
ECODRIVE03 FLP-01VRS Writing the User Program
5-5
5.6 Variables
The commands contain data which are contained in the instruction.
These constants can also be changed on-line via the serial interface, but not from the user program.
Using variables is an alternative. They can be programmed in place of the constants, so that this data can also be edited from the user program.
The variables are retained and all have the same format:
+12345678.123456
If a variable is used in a command, only the size of the constant that has been placed here is used. If the content of the variable is greater or less than the size of the constant, an error message is generated.
Note: The variable's operational sign is always taken into account!
e.g.
For a travel command POI, several inputs are shown.
With Constants:
POI 1 +123456.123 111
Velocity in ‰ Feed length in IUs Axis 1
For feed length, the following data size is assigned min.: -200000,000 max: +200000.000 For velocity, the following data size is assigned min.: 000
max: 999 V600 = +00123456.123456
V601 = +999.9999
V602 = +01234567.123456 V603 = -999.99999
V604 = -1234.123456
POI 1 +V600 V601
The value +123456.123 is picked up from the variable V600.
The value 999 is picked up from the variable V603.
POI 1 +V602 V603
The value of variable V602 is too large. An error message is generated.
The value of variable V603 is negative. An error message is generated.
POI 1 -V604 V601
The content of variable V604 is negative. With the operational sign from the command, the feed length becomes positive.