Danfoss MCO 305 Programming guide

MCO 305 Command Reference
Contents
How to Read this Command Reference.....................................3
Command Reference ................................................................7
Appendix ..............................................................................135
Copyright © Danfoss A/S, 2010 Trademarks VLT is a registered Danfoss trademark. Hiperface® is a registered trademark of the Sick Stegmann GmbH, Max Stegmann GmbH Antriebstechnik-
Elektronik.
Microsoft, Windows 2000, and Windows XP are either registered trademarks or trademarks of the Microsoft
Corporation in the USA and other countries.
1 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference

How to Read this Command Reference

How to Read this Command Reference
This Command Reference completes the MCO 305 Design Guide with the with the detailed description of all commands. Please read also the Operating Instructions, in order to be able to work with the system safely and professionally, particularly observe the hints and cautionary remarks.
Chapter How to Read this Command Reference informs you about the symbols, abbreviations, and definitions used in this manual.
Page divider for ‘How to Read this Command Reference’.
Chapter Command Reference provides a detailed description of all commands including syntax, para­meters, as well as program samples.
Page divider for ‘How to Program’.
Chapter Appendix gives a quick review of what has changed since previous releases in “What’s new?”. Experienced users will find detailed informa­tion in the technical reference material for example the “Array Structure of CAM Profiles”. Plus, the manual ends with an index.
Page divider for ‘Appendix’.
The Online Help provides in Chapter Program Samples almost 50 program samples which you can use to familiarize yourself with the program or copy directly into your program.
3 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ How to Read this Command Reference __
Available Literature for FC 300, MCO 305, and MCT 10 Motion Control Tool
The MCO 305 Operating Instructions provide the necessary information for built-in, set-up, and optimize the controller.
The MCO 305 Design Guide entails all technical information about the option board and customer design and applications.
This MCO 305 Command Reference completes the MCO 305 Design Guide with the detailed description of all commands.
The VLT® AutomationDrive FC 300 Operating Instructions provide the necessary information for getting the drive up and running.
The VLT® AutomationDrive FC 300 Design Guide entails all technical information about the drive and customer design and applications.
The VLT® AutomationDrive FC 300 MCT 10 Operating Instructions provide information for installation and use of the software on a PC.
Danfoss Drives technical literature is also available online at www.danfoss.com/drives.
Symbols and Conventions
Symbols used in this manual:
NB!: Indicates something to be noted by the reader.
Indicates a general warning.
Conventions
The information in this manual follows the system and uses the typographical features described below to the greatest extent possible:
Menus and Functions Menus and functions are printed italics, for example: Controller Parameters. Commands and Parameters Commands and parameter names are written in capitals, for example: AXEND and KPROP; Parameters are
printed in italics, for ex a mple: Proportional factor. Parameter Options Values for use to select the parameter options are written in brackets, e.g. [3]. Keys The names of keys and function keys are printed in brackets, for example the control key [Ctrl] key, or just
[Ctrl], the [Esc] key or the [F1] key.
4 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ How to Read this Command Reference __
Abbreviations
Ampere, Milliampere A, mA Control word CTW Digital Signal Processor DSP Frequency Converter FC Local Control Panel LCP Least significant bit LSB Main actual value MAV Motion Control Option MCO Motion Control Tool MCT Minute min Most significant bit MSB Main Reference MRV Master Unit MU Digital output switching to high side. NPN
Definitions
MLONG
Parameter par. Position Control Loop PID Digital output switching to low side. PNP Pulses per Revolution PPR Quad-counts qc Reference REF Revolutions per Minute RPM Second, Millisecond s, ms Sample time st Status word STW User Unit UU Volts V
An upper or lower limit for many parameters:
-MLONG = -1,073,741,824
MLONG = 1,073,741,823
Quad-counts
Incremental encoders: 4 quad-counts correspond to one sensor unit. Absolute encoders: 1:1 (1 qc correspond to one sensor unit).
Through edge detection, a quadrupling of the incre­ments is produced by both tracks (A/B) of the incremental encoder. This improves the resolution.
Derivation of quad counts
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 5
MCO 305 Command Reference
__ How to Read this Command Reference __
User Units
The units for the drive or the slave and the master, respectively, can be defined by the user in any way desired so that the user can work with meaningful measurements.
Starting with MCO 5.00 the factors SYNCFACTM / SYNCFACTS, POSFACT_Z / POSFACT_N are no longer limited to small values
Internally, it is act as follows: Whenever a value must be multiplied by the gear factor (i.e. master incre­ments per ms), at first it is looked if a multiplication will result in an overflow. If so, a factor (64 bit) is used which consists of
SYNCFACTS/SYNCFACTM to multiply the delta_master. If no overflow occurs, first it is multiplied by SYNCFACTS and then divided by SYNCFACTM. Concerning the error we are dealing with, this means:
Normal case Multiplying by SYNCFACTS has no error, but dividing by SYNCFACTM means that the result may be wrong by
. That means that (worst case) such an error occurs every ms, i.e. that after 1193 hours (49,71 days)
1/2³² we made an error of 1 qc (Slave).
Big factors In that case, the used factor (SYNCFACTS/SYNCFACTM) itself could be wrong by 1/2³² . This means that in
the worst case an error of delta_master * 1/2³²
occurs every ms. Assume that we have an encoder with 1000 counts (4000 qc) per revolution. Assume further, that we drive with 2000 rpm, i.e. we have a velocity of 133 qc/ms. This means we make an error of 133 * 1/2³² per ms. From this follows that in worst case (maximum error every ms always in same direction) we could have an error of 1 qc after 9 hours.
This should not be relevant in most applications.

User Units [UU]

All path information in motion commands are made in user units and are converted to quad-counts internally. These also have an effect on all commands for the positioning: e.g. APOS.
The user can also select meaningful units for the CAM control in order to describe the curve for the master and the slave, for example 1/100 mm, or 1/10 degrees in applications where a revolution is being observed.
In the CAM control, the maximum run distance of the slave or the slave cycle length are indicated in User Units UU (qc).
The unit can be standardized with a factor. This factor is a fraction which consists of a numerator and denominator:
UU UnitUser 1 =
12-32 par.
11-32 par.
Numerator Unit User
Denomintor Unit User
par. 32-12 User Unit Numerator POSFACT_Z par. 32-11 User Unit Denominator POSFACT_N
Scaling determines how many quad-counts make up a user unit. For example, if it is 50375/1000, then one UU corresponds to exactly 50.375 qc.
NB!:
When user units are transferred into qc, then they get truncated. When qc are transferred into user units, then they get rounded.
Master Units [MU]
A factor (fraction) is used for the conversion into qc, as with the user unit:
1033 par.
MU UnitMaster 1
=
1133 par.
Master Factor ationSynchroniz
Slave Factor ationSynchroniz
par. 33-10 Synchronization Factor Master SYNCFACTM par. 33-11 Synchronization Factor Slave SYNCFACTS
6 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference

Command Reference

In the following section all commands are listed in alphabetical order and described in detail with syntax examples as well as short program samples. Please read also the section “Basics” in chapter “How to Progam” in the MCO 305 Design Guide.
7 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
ACC
Summary Setting acceleration for motion commands.
Syntax ACC a
Parameter a = acceleration
Description The ACC command defines the acceleration for the next motion command (speed
control, synchronizing or positioning). The value will remain valid until a new acceleration value is set, using the ACC command. The value is related to the parameters 32-81 Shortest Ramp and 32-80 Maximum Velocity as well as 32-83 Velocity Resolution.
NB!:
If acceleration has not been defined previous to a motion command, then the maximum acceleration will be the setting of par. 32-85 Default Acceleration.
NB!:
If the MCO 305 is used to control FC 300, then the ramps should always set via the option card and not in the FC 300. The FC 300 ramps must always be set to minimum.
Command Group REL, ABS
Cross Index DEC, VEL, POSA, POSR,
Parameters: 32-81 Shortest Ramp, 32-80 Maximum Velocity, 32-83 Velocity Resolution
Syntax Example ACC 10 /* Acceleration 10 */
Example minimum acceleration time: 1000 ms
maximum velocity: 1500 RPM (25 Rev./s) velocity resolution: 100
Velocity
[RPM]
VELMAX
par. 32-80
175MD450
RAMPMIN
par. 32-81
Program Sample ACC_01.M
8 MG.34.R1.02 – VLT
RAMPMIN
par. 32-81
®
is a registered Danfoss trademark
t
[ms]
MCO 305 Command Reference
APOS
Summary Reads actual position
Syntax res = APOS
Return Value res = absolute actual position related to the actual zero point
All path information in motion commands are made in user units and are converted
to quad-counts internally. (See also Numerator and Denominator, parameters 32-12 and 32-11.)
The user unit (UU) corresponds in standard setting to the number of Quad counts.
Parameter ==
Description The APOS command can query the absolute position of the axis related to the
actual zero point. If a temporary zero point which has been set via SETORIGIN exists, then the
position value is relative to this zero point.
NB!:
The read out using APOS may or may not be equal to the target position or commanded position. The error or deviation may be due to the mechanics involved and truncated decimal values in the User Units.
APOS is affected by the parameters 32-12 and 32-11, and by commands SETORIGIN p, DEFORIGIN.
Example: POSA 2000
PRINT "Actual Position Reached", APOS Output: Actual Position Reached 2000 (depending on PID settings a small deviation may occur) Example with SETORIGIN
SETORIGIN 2000 POSA 2000 PRINT "Actual Position”, APOS Output: Actual Position 2000
__ Command Reference __
12-32 par.
11-32 par.
Numerator Unit User
Denomintor Unit User
1
Initial
0
After execution
2000
After Positioning
0
Initial
0
Program on execution sets the original 2000 qc as the origin and then moves the drive by 2000 qc more for positioning command.
Command Group SYS
Cross Index CPOS, DEFORIGIN, SETORIGIN, POSA, POSR,
Parameters: 32-12 User Unit Numerator, 32-11 User Unit Denominator
Syntax Example PRINT APOS /* display the actual position of axis on the PC */
Program Sample APOS_01.M, GOSUB_01.M, MOTOR_01.M
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 9
MCO 305 Command Reference
APOSDIFF
Summary Overflow handling of incremental encoders in applications.
Syntax res = APOSDIFF oldpos
Return Value oldpos = APOS at a previous time
Description Returns difference between APOS and oldpos (res = APOS – oldpos) in UU.
This command simplifies overflow handling of incremental encoders in applications. If, for example, the user stores an actual position in his program and wants to calculate the difference at a later time, then he normally has to account for overflow of the position. Instead this command can be used; see below.
Internally those routines look if the difference is bigger than POS_LIMIT (0x3FFFFFFF). If so then it is assumed that an overflow happened and it is handled correctly.
NB!:
This will not solve the problem of overflowing if the application uses user units.
Portability
Command Group SYS
Cross Index APOS
Syntax Example oldpos = APOS
Command is available starting with MCO 5.00
….. diff = APOSDIFF oldpos // this function returns the difference between APOS and oldpos in user units // handling an overflow if necessary (diff = APOS – oldpos)
__ Command Reference __
AVEL
Summary Queries actual velocity of axis.
Syntax res = AVEL
Return Value res = actual velocity of axis in UU/s, the value is signed
Description This function returns the actual velocity of the axis in User Units per second. The
accuracy of the values depends on the duration of the measurement (averaging). The standard setting is 20 ms, but this can be changed by the user with the _GETVEL command. It is sufficient to call up the command once in order to work with another measuring period from then on. Thus, the command:
var = _GETVEL 100 sets the duration of the measurement to 100 ms, so that you have a considerably
better resolution of the speed with AVEL and MAVEL, however, in condertrast, quick changes are reported with a delay of a maximum of 100 ms.
Command Group SYS
Cross Index MAVEL, APOS, _GETVEL
Syntax Example PRINT AVEL /* queries actual velocity of axis and display on the PC */
10 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
AXEND
Summary AXEND reads info on status of program execution.
Syntax res = AXEND
Return Value res = axis status with the following meaning:
Value Bit 128 7 1 = Motor is reset, i.e. it is ready to start and is controlling
again, e.g. after ERRCLR, MOTOR STOP, MOTOR ON 64 6 1 = axis controller is OFF, motor is off 4 - 5 not in use 8 3 1 = motor is at STOP status 4 Bit 2 1 = speed mode is active 2 Bit 1 1 = positioning procedure is active 1 Bit 0 1 = target position reached; motor is not in motion
Description The AXEND command gives the actual status of the axis or the status of the
program execution. This means for example that you can enquire when the “position is reached” and a
positioning command (POSA, POSR) has actually been completed. When Bit 1 is set at [0] the positioning process is complete and the position reached.
If, however, the positioning command has been interrupted with MOTOR STOP and continued later with CONTINUE, then the following bits would be set at [1]:
the Bit 0 for “motor is at a standstill” the Bit 1 for “positioning process active” the Bit 3 for “motor is at STOP status” the Bit 6 for “axis controller switched off”
The AXEND command is especially suitable for determining whether or not a movement in the NOWAIT ON condition is terminated.
Command Group SYS
Cross Index WAITAX, STAT, NOWAIT
Syntax Example NOWAIT ON // do not wait until position is reached
POSA 100000 WHILE (AXEND&2) DO // as long as the positioning process is active, repeat loop IF IN1 THEN // if input 01 is set VEL 100 // increase velocity POSA 100000 WAIT IN1 OFF // wait until input (key) is off ENDIF ENDWHILE // position reached
Syntax Example IF (AXEND&64) THEN
OUT 1 1 // set output 01, when axis controller is switched off ELSE OUT 1 0 ENDIF
Program Sample AXEND_01.M
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 11
MCO 305 Command Reference
CANDEL
Summary Deletes all or single CAN objects.
Syntax CANDEL objno
Parameter objno = object number, which is returned during the definition of the object
= –1 deletes all objects (except the standard objects)
Description With the CANDEL command CAN objects which were previously created with
DEFCANIN or DEFCANOUT can be deleted. Standard objects, for the buffered input/output (OUTMSG or INMSG) cannot be
deleted with this command. These cannot be created during initialization.
Portability Command is available starting with MCO 5.00.
Command Group CAN
Syntax Example CANDEL –1 /* all CAN objects are deleted */
CANIN
Summary Reads an object via the CAN bus.
Syntax status = CANIN objno time-out control varhi varlo
Parameter objno = object number which is returned during the definition of the object.
time-out = –1 does not wait for data
control = 0 Checks whether the new data has arrived. The new data is
= 1 Sends a remote frame and waits for data in dependence on
varhi = Bytes 0 to 3 of the CAN object data varlo = Bytes 4 to 7 of the CAN object data
Return Value Status = –1 no data has arrived
= 0 o.k.
Description
The CANIN command copies the data (if present) of the CAN object 'objno' to the variables 'varhi' and 'varlo'. If 'control = 1', then the data is requested first.
It is possible to gather all Transmit-PDOs of digital input modules or CAN-Drive status by using only one CAN telegram. This feature is restricted to the Master-bus This feature must use the CAN-Object 15 internally which reduces the number of usable CAN objects on the master bus by 1.
To enable this feature, the command CANINI 999 must be used This command enables reception of TxPDOs by interrupt and stores every received
PDO in a buffer with a depth of 1. This works for all IDs from 1 to 127. That means if any IO-module in that range sends a TxPDO it is captured and stored it in the buffer. The next TxPDO from the same module of course overwrites the first one. To read out of the buffer, the following command can be used:
result = CANIN (id * 100) timeout 0 hi lo This command returns -1 if no new information was in the buffer, otherwise it
returns 0. You can use the timeout normally (-1 does not wait, 0 waits for ever for new information, n waits n ms).
__ Command Reference __
= 0 waits until data arrives > 0 waits for the data in time-out [ms]
subsequently copied to the variables.
time-out
.
12 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
The result is returned in hi and lo, but we already arrange byte ordering so that they can be used as if you read them with PDO[]. That means if lo contains a 32-bit number then you can use it right away without reordering the bytes.
Whenever you use a new CANINI command or you start a new program, this feature is disabled.
Using this feature of course loads the processor if there is heavy PDO traffic on the BUS.
NB!:
It is not the same bus. This may lead to unwanted results. If you use, for example, a CANopen digital I/O module with ID 3 on the master bus with an IN (3*256+1) or with CANINI 3 999, then this will result in a situation where the IN command will work but you would not get the PDOs with the above described CANIN command. This is because two CAN objects will exist with the same ID. In that case, the processor only serves the first one. As mentioned above, we use object 15 for reception of all PDOs, which is the last one.
Portability
Optional command and extended commands CANINI and CANIN to use only one CAN telegram are available starting with MCO>=5.00.
Command Group CAN
Cross Index CANOUT, CANDEL, DEFCANOUT, DEFCANIN, CANINI
Syntax Example MSG = 0
temp = 0 /* Define variables */ rx1 = DEFCANIN 42 8 /* a RX object is created */ STAT = CANIN rx1 1000 0 MSG temp /* wait 1s for data */
Program Sample CAN_sample.M, CANIN.M
recommend this feature be used together with other CAN IO commands on
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 13
MCO 305 Command Reference
CANINI
Summary Initializes the necessary objects (PDOs) for data exchange of CANopen nodes, or
enables extended CANINI, CANIN function.
Syntax CANINI no, no, no, …,
CANINI 999 CANINI no, no, 999, no
is also possible, but only in the same command. The next new command would delete the previous parameters.
Parameter no = guard * (busoffset * 1000 + id)
guard = –1, +1 (without / with guarding)
busoffset = 100000 , 0 (slave bus, master bus) Samples for CANINI values:
Description The CANINI command establishes contact with CAN devices and creates permanent
Every new CANINI command reinitializes all objects which were assigned before
Portability Command is available starting with MCO 5.00.
1…127 CAN I/O with bus ID 1…127 with guarding
-1…–127 CAN I/O with bus ID 1…127 without guarding
corresponding CAN objects in order to be able to communicate (using PDO) with these devices. The advantage is that these input modules can also be used for interrupt functions without permanent bus load due to status polling.
If you do not need any interrupts, then you can accelerate the processing of the IN and INB commands with CANINI, since the corresponding devices send these information autonomously every time a change of state happens.
It is strongly recommended to “guard” (i.e. CANINI > 0) any CAN devices, which are initialized using CANINI. That is the only way to make sure, that the device is still present and takes part in bus communication. If one device is no longer present, then an error 188 is triggered by the missing feedback of the GUARD object. An error routine, defined with ON ERROR can react to such an error state.
When CANINI is executed for drives, the corresponding PDO is created and also the SYNC object if necessary. If guarding is started, a guarding telegram is sent every 20 ms to one device. If for example 4 devices are guarded, it takes 80 ms to check each device once. No response within 100 ms indicates an error 188 (guarding error).
A maximum of 16 modules can be stored internally.
with CANINI, i.e. guarding (GUARD) is stopped and also SYNC telegrams. This is not true, if there are permanent objects from par. 32-00 or 32-30 Incremental Signal Type. These objects will still remain, like the internal automatically created PDOs corresponding to the definition of parameters 32-00 and 32-30 Incremental Signal Type.
The CANINI command starts all modules synchronously, i.e. for every module a NMT0 message is sent to set the module on the status “operational”.
If a CANINI fails, it is possible to read the SYSVAR 67 [0x01220244] GuardErrorId to find out which id caused the problem.
__ Command Reference __
Deletes any objects, which were formerly assigned using the
0
CANINI command. enables reception of all TPDO1s (0x181-0x1FF) by interrupt and
999
stores every received PDO in a buffer with a depth of 1.
14 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
NB!: If the CANINI command is used on controls with multiple separated CAN bus circuits, GUARD and SYNC functionality is only supported on the so-called slave bus.
Command Group CAN
Cross Index IN, INAD, INB, OUT, OUTB, OUTDA,
par. 32-00 and par. 32-00 Incremental Signal Types
Syntax Example CANINI 1,2,3,4 /* Initialize the CAN modules with pre-set node number */
Program Sample CAN_sample.M
CANOUT
Summary Sends message with an internal number.
Syntax CANOUT no valhi vallo
Parameter valhi Bytes 0 to 3 of the CAN object data
vallo Bytes 4 to 7 of the CAN object data
Description A CAN message is sent with this command from a sending object defined by
DEFCANOUT. The values hi and lo are 4 bytes long
Portability Command is available starting with MCO 5.00.
Command Group CAN
Cross Index CANIN, CANDEL, DEFCANIN, DEFCANOUT
Syntax Example valhi = 21
vallo = 41 tx1 = DEFCANOUT 500 8 /* TX object is defined with Id=500 and data length = 8 bytes */ CANOUT tx1 valhi vallo /* a CAN message is sent */
Program Sample CANOUT.M
__ Command Reference __
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 15
MCO 305 Command Reference
COMOPTGET
Summary Reads a Communication option telegram
Syntax COMOPTGE T n o a r ray
Parameter array = the name of an array which must be at least the size of no
no = number of words to be read
Description COMOPTGET reads from the Communication option buffer the no words and writes
them in the array ‘array’, starting with the first element.
Portability Option
Communication
Option Function
Control data: The function of Control word (CTW) and Main Reference (MRV) depends on the
Process data: PCD’s 1 – 4 of PPO type 2/ 4 and PCD’s 1 – 8 of PPO type 5 are not assigned a
Command Group Communication option
Cross Index COMOPTSEND
Program Sample COM_OPT
Parameters: Read and write parameters are not affected by the option board.
NB!:
The parameters 9-15 and 9-16 have additionally to be set with the correct values.
setting of par. 33-82 Drive Status Monitoring; Status words (STW) and Main actual value (MAV) is always active:
Parameter 33-82 Parameter 33-82 “Enable MCO 305” “Disable MCO 305” CTW/MRV Disabled Active STW/MAV Active Active
parameter number by parameters 9-15 and 9-16 but are used as a free data area which can be used in a APOSS program.
The command COMOPTGET is copying the data received on the communication option into an array, where each array element contains one data word (16 bit).
The command COMOPTSEND is copying data from an array, where each array element contains one data work (16 bit) into the send buffer on the communication option, from where it is send via the network to the master.
__ Command Reference __
COMOPTSEND
Summary Writes in the Communication option buffer
Syntax COMOPTSEND no array
Parameter array = the name of an array which must be at least the size of ‘no’
no = number of words to be sent
Description COMOPTSEND writes in the Communication option buffer. In doing so the first ‘no’
values are sent from the ‘array’.
Portability With built-in Communication option.
Communication
See command COMOPTGET
Option Function
Command Group Communication option
Cross Index COMOPTGET
Program Sample COM_OPT
16 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
CONTINUE
Summary Continues positioning from point of interrupted motion
Syntax CONTINUE
Description By using CONTINUE, positioning and speed motion commands which have been
aborted via the MOTOR STOP command or an error condition or stopped via MOTOR OFF can be resumed.
The CONTINUE command can be used especially in an error subroutine in connection with the ERRCLR command, to enable the correct continuation of a motion procedure following an error abort.
NB!:
However CONTINUE does not continue interrupted synchronization commands.
Command Group CON
Cross Index MOTOR STOP, ERRCLR, ON ERROR GOSUB
Syntax Example CONTINUE /* continue interrupted motion procedure */
Program Sample MSTOP_01.M
CPOS
Summary Reads the actual command position of an axis
Syntax res = CPOS
Return Value res = Absolute commanded position in User Units (UU) related to the actual zero
point
Description The CPOS command queries the actual commanded position of the axis related to
the actual zero point. The commanded position is understood to be the temporary set position which is re-calculated every millisecond by the positioning control during a positioning procedure or a movement in rotation mode.
The command position can be queried independently of the operating condition (position control during standstill, positioning process, speed control or synchronization).
NB!:
If a set and active temporary zero point (set via SETORIGIN) exists, then the position value is relative to this zero point.
Command Group SYS
Cross Index APOS, DEFORIGIN, SETORIGIN, POSA, POSR,
Parameters: 32-12 User Unit Numerator, 32-11 User Unit Denominator
Syntax Example PRINT CPOS /* actual command position of axis */
Program Sample CPOS_01.M, GOSUB_01.M
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 17
MCO 305 Command Reference
CPOSDIFF
Summary Overflow handling of incremental encoders in applications.
Syntax res = CPOSDIFF oldpos
Parameter oldpos = CPOS at a previous time
Return Value Returns difference between CPOS and oldpos (res = CPOS – oldpos) in UU.
Description This command simplifies overflow handling of incremental encoders in applications.
If, for example, the user stores an actual position in his program and wants to calculate the difference at a later time, then he normally has to account for over­flow of the position. Instead this command can be used; see below.
Internally those routines look if the difference is bigger than POS_LIMIT (0x3FFFFFFF). If so then it is assumed that an overflow happened and it is handled correctly.
This will not solve the problem of overflowing if the application uses user units.
Portability Command is available starting with MCO 5.00.
Command Group SYS
Cross Index CPOS
Syntax Example oldpos = CPOS
….. diff = CPOSDIFF x(1) oldpos // this function returns the difference between CPOS and oldpos in user units // handling an overflow if necessary (diff = CPOS – oldpos)
__ Command Reference __
CSTART
Summary Starts the speed mode
Syntax CSTART
Description The CSTART command is starting the drive in speed control mode.
Acceleration/deceleration, as well as the speed should be set via the ACC, DEC and CVEL commands prior to starting.
CSTART does not contain the command MOTOR ON which turns on the motor control. When using CSTART an explicit calling up of MOTOR ON is necessary after previous use of MOTOR OFF.
NB!:
If no speed value has been defined via CVEL before the beginning of CSTART, then the default velocity 0 is used – this means that the motor will not rotate, but the PID controller is active.
All CVEL commands following the start of speed mode will be carried out immediately, i.e. a corresponding speed change will take place immediately, with the defined acceleration or deceleration (ACC/DEC).
Command Group ROT
Cross Index ACC, DEC, CVEL, CSTOP
Syntax Example CSTART /* rpm mode start */
Program Sample CMODE_01.M
18 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
CSTOP
Summary Stops the drive in speed mode
Syntax CSTOP
Description Via the CSTOP command, the speed mode is terminated and the positioning mode
is started, whereby a still rotating axis is stopped the deceleration defined with DEC and the motor is held in the stop position.
NB!:
A CSTOP command carried out in the positioning mode can also cause an abrupt termination of the positioning procedure.
Command Group ROT
Cross Index ACC, DEC, CVEL, CSTART
Syntax Example CSTOP /* rpm mode stop */
Program Sample CMODE_01.M
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 19
MCO 305 Command Reference
CURVEPOS
Summary Retrieve slave curve position that corresponds to the current master position of
the curve.
Syntax res = CURVEPOS
Return Value res = Slave position in CAM units (UU) absolute to the current zero point.
Description CURVEPOS returns the slave value which corresponds to the actual curve master
position. The position can be retrieved independently of the operating status (position
control at standstill, positioning procedure, velocity control or synchronization).
CMASTERCPOS (SYSVAR) and CURVEPOS are now updated even if SYNCC is no
longer active. The update of these values starts after a SETCURVE command (if par. 33-23 Start Behavior for Sync is < 2000) or after SYNCC and the first master marker (if par. 33-23 = 2000).
After the SYNCC command is stopped, we continue to update these values if Start Behavior for Sync. < 2000.
NB!:
The position is only defined if a SETCURVE has been set before.
__ Command Reference __
NB!:
If a temporary zero point exists which has been set with SETORIGIN and is active, the position value will refer to this zero point.
NB!:
DEFMCPOS and DEFMORIGIN can still modify this position.
Command Group CAM
Cross Index APOS, DEFORIGIN, SETORIGIN, POSA, POSR, DEFMCPOS,
Parameters: 33-10 Syncfactor Master, 33-11 Syncfactor Slave
Syntax Example PRINT CURVEPOS // print actual slave position of the curve
Sample
Fix points of a curve: Master Slave 0
500 700 1000
0 500 300 1200
Say the current master position is 800. Then the CURVEPOS returns the corres-
ponding slave position of 450. Case 1: Current Master Position is 800 and current slave position is 200.
CURVEPOS will return the value 450.
Case 2: Current Master Position is 800 and current slave position is 700.
CURVEPOS will return the value 450.
Hence CURVEPOS is independent of the slave position.
20 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
CVEL
Summary sets velocity for speed controlled motor movements
Syntax CVEL v
Parameter v = velocity value (negative value for reversing)
__ Command Reference __
Description The velocity for the next speed controlled motor movement is set with the CVEL
command. The value remains valid until a further CVEL sets a new velocity. The velocity value to be given will be related to the parameters 32-80 Maximum
Velocity and 32-83 Velocity Resolution.
NB!:
CVEL commands which take place after CSTART will be carried out immediately i.e. the velocity will be adapted via the ACC/DEC set acceleration or deceleration to the new value of CVEL.
If a velocity has not been defined before the start of speed control mode (CSTART), then the default velocity is 0, i.e. the motor will not turn, and a velocity input via CVEL will start the movement in speed control mode.
Command Group ROT
Cross Index ACC, DEC, CSTART, CSTOP,
Parameter: 32-80 Maximum Velocity
Syntax Example CVEL 100
Program Sample CMODE_01.M
DEC
*V [RPM] Velocity Command =
Velocity Maximum 80-32 par.
Resolution Velocity 83-32 par.
Summary sets deceleration
Syntax DEC a
Parameter a = deceleration
Description The DEC command defines the deceleration for the next motion command (speed
control synchronization or positioning). This value will remain valid until a new deceleration value is set with another DEC command. The value is related to the parameters 32-81 Shortest Ramp and 32-80 Maximum Velocity as well as 32-83 Velocity Resolution.
NB!:
If deceleration is not defined previous to the positioning command then decele­ration will be the setting of parameter 32-85 Default Acceleration.
NB!:
If you work with the MCO 305 then you should always set the ramps via the option card and not in the FC 300. The FC ramps must always be set to minimum.
Command Group REL, ABS
Cross Index ACC, Parameters: 32-81 Shortest Ramp, 32-80 Maximum Velocity, 32-83 Velocity
Resolution
Syntax Example ACC 50 /* acceleration: 50, while braking 10 */
DEC 10
Example minimum acceleration time: 1000 ms
maximum velocity: 1500 RPM velocity resolution: 100
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 21
MCO 305 Command Reference
__ Command Reference __
DEFCANIN
Summary Defines a receive object.
Syntax objno = DEFCANIN id dlen
Parameter id = CAN-identification number
dlen = data length of the object in bytes (max. 8 bytes)
Return Value objno
A positive value means that the object was successfully created. This value is an internal number of the object and is used by other APOSS-CAN commands. A negative value means an error has occurred.
Description This command defines an incoming communication object in the CAN-Controller.
This command can also be used with the offset for the slave bus (telegram ID
100000). These objects can now be deleted one by one via the command CANDEL objno,
where objno is the number returned by DEFCANIN or DEFCANOUT.
Portability Command is available starting with MCO 5.00. Command Group CAN Program Sample var1 = 0 /* declare variables */
var2 = 0 rx1= DEFCANIN 500 8
/* RX object with Id=500 and data length=8 bytes is defined */
CANIN rx1 0 0 var1 var /* a CAN message is read */
DEFCANOUT
Summary Defines a transmit object in the CAN controller.
Syntax objno = DEFCANOUT id dlen
Parameter id = CAN-identification number
dlen = data length of the object in bytes (max. 8 bytes)
Return Value objno
A positive value means that an object was successfully created. This value is an internal number of the object and is used by other APOSS-CAN commands. A negative value indicates an error.
Description This command defines an object in the CAN-Controller. This object is an outgoing
object with a length of n bytes and the CAN identification of (id). Thus, objno is an internal number of the object ld and is used by the CANOUT command.
This command can also be used with the offset for the slave bus (telegram ID 100000). So it is possible to define messages for slave and master bus. These objects can
now be deleted one by one via the command CANDEL objno, where objno is the number returned by DEFCANIN or DEFCANOUT.
Portability Command is available starting with MCO 5.00.
Command Group CAN
Cross Index DEFCANIN, CANOUT, CANIN
Syntax Example no = DEFCANOUT 500 8
/* defines an object with ld=500 and length 8 bytes */ /* the function returns a 1 */ /* a message with ld=500 and a length of 8 bytes can now be sent */ /* with the command CANOUT 1 value1 value2 */
no = DEFCANOUT id len
22 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
DEFCORIGIN
Summary Sets the command position as zero point.
Syntax DEFCORIGIN
Description DEFCORIGIN sets the command position as zero point. All absolute positioning
commands (POSA etc.) refers to this zero point from now on. In doing so CPOS is set to zero and APOS is set in that way, that the difference is
remained.
Portability Command is available starting with MCO 5.00.
Command Group INI
Cross Index POSA, DEFORIGIN, CPOS
Syntax Example POSA 80000 /* absolute positioning */
DEFCORIGIN X(1) /* define command position as zero point */
DEFMCPOS
Summary Define initial position of the master
Syntax DEFMCPOS p
Parameter p = position in Master Units (MU)
Description DEFMCPOS defines the initial position of the master (in MU) in the CAM-Mode and
thus the point where the curve begins as soon as the master pulses are being counted.
Command Group CAM
Cross Index DEFMORIGIN, SETMORIGIN, SYNCC,
Parameter: par. 33-23 Start Behavior for Sync.
Syntax Example DEFMCPOS 1000 // Set internal MU counter to 1000
Sample DEFMCPOS positions Master’s current physical position to the master curve position
indicated irrespective of what the MAPOS is.
When a DEFMCPOS 500 is issued, master’s physical position is made as the position 500 of the curve.
When a DEFMCPOS 500 is issued, master’s physical position is made as the position 500 of the curve.
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 23
MCO 305 Command Reference
__ Command Reference __
DEFMORIGIN
Summary Set the current master position as the zero point for the master.
Syntax DEFMORIGIN
Description DEFMORIGIN defines the current master position as the zero point for the master.
The master position (MAPOS) refers to this zero point until a redefinition takes place using DEFMORIGIN or SETMORIGIN.
NB!:
The command DEFMORIGIN can not be used with absolute encoders (see par. 32­30 Incremental Signal Type).
Command Group INI
Cross Index MAPOS, SETMORIGIN
Syntax Example DEFMORIGIN /* Set current position as the zero point for the master */
DEFORIGIN
Summary Sets the current position as zero point
Syntax DEFORIGIN
Description With the DEFORIGIN command the current position is set as the zero point. All
absolute positioning commands (POSA) then refer to this zero point. The actual position reached in a positioning command is the Target position plus
some error which is not compensated automatically while using a DEFORIGIN.
NB!:
The command DEFMORIGIN can not be used with absolute encoders (see par. 32­00 Incremental Signal Type).
Command Group INI
Cross Index POSA
Syntax Example POSA 80000 /* Absolute positioning */
DEFORIGIN /* define actual position as zero point */
Sample POSA 2000
PRINT "Position before new origin", APOS DEFORIGIN PRINT "Position after defining new origin", APOS Output Position before new origin 2000, Position after defining new origin 0
Program Sample DORIG_01.M, ORIG_01.M
Initial
0
After executio n
0
(after DEFORIGIN)
24 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
DEFSYNCORIGIN
Summary Defines master-slave relation for the next SYNCP or SYNCM command, or
defines the start values for standard curves with SYNCC command.
Syntax DEFSYNCORIGIN mcpos spos
Parameter mcpos = master reference position in qc, or
spos = slave reference position, or spos < SlaveCurveLenght = slave curve position spos > SlaveCurveLength = the actual curve position has to be seen as the
Description This command defines how much distance ahead or behind should the slave be in
relation to the master position. It allows defining the relation between master and slave for the next SYNCP or SYNCM command. It sets the internal slave command position (Mpcmd) to the slave value.
The master value is used for an internal MOVESYNCORIGIN. For that reason, a MOVESYNCORIGN will be overwritten by this command. Both actions are done at the moment, when the SYNC command is activated. So it is guaranteed, that master and slave will be synchronized at the above master-slave position.
With SYNCC the DEFSYNCORIGIN can be used to define the start values for
standard curves as follows: Here, mcpos tells the controller that the actual master position (MAPOS)
corresponds to a master curve position of mcpos.
spos has two different meanings: spos < SlaveCurveLenght = defines the actual position of the slave as the slave
spos > Slave CurveLength = the actual curve position has to be seen as the correct
Example: Assuming that the curve is a straight line going from 0,0 to 2000,4000 in terms of (master,slave).
Further assuming that the slave is at a position of 11000 qc and that the master has an actual position of 15000 qc. To make it simple, let us assume that the gear factors are 1 : 1.
If now a SETCURVE is done without any further commands, then the following would happen. The controller tries to find out where the slave is located within a curve. Therefore, it calculates the remainder of 11000 / 4000 which is 3000 and the remainder of 15000 / 2000 which is 1000. That means the result would be that the actual MCPOS (master curvepos) is 1000. So the corresponding slave curve position should be 2000. But at the moment the slave is at a curve position of 3000 instead. (The csstart position is the start position of the last curve, which would be 8000 in our case). If this curve is started, the slave would try correct the position and move to 2000.
If now the following command is used DEFSYNCORIGIN 500 100000 the following will happen:
__ Command Reference __
master curve position in qc
correct position within the curve corresponding to the master position mcpos
curve position spos.
position within the curve corresponding to the master position mcpos (spos itself does not have any meaning, it just has to be greater than slave curve length).
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 25
MCO 305 Command Reference
The actual master position is defined as the master curve position of 500. And because 100000 is bigger than the slave curve length of 4000, the actual slave
position (of 11000 qc) equates to the slave curve position belonging to the master curve position of 500 which is 1000. So csstart will be set to 10000. If now the curve is started, it will be ok and just follow the curve when the master starts moving.
DEFSYNCORIGIN in conjunction with CU_GRAD curves (type 3) In case of a CU_GRAD curve, the DEFSYNCORIGIN can be used to define the
absolute end position of the curve in qc. In that case, the curve is started immediately and is calculated in such a manner that the end positions will be reached at the end of the curve.
NB!:
To avoid degenerate polynomials, the distances must be in a correct relation. If you start with velocity zero and want to end up with a velocity of 1 (slave has same velocity as master), then the master distance should be less than two times the slave distance. Otherwise, the polynomial will have extremes within the interval. This is more difficult to predict in other cases (start velocity not 0 or end velocity not
1). Therefore, you can check the PG_FLAG_CURVE_ERR to see if the last SETCURVE produced a curve with extremes (see STAT). Then you can read out the SYSVAR PFG_LASTERROR (see SDO dictionary) to decide what it was.
Portability Starting with MCO 5.00 start values for curves can be defined. Command Group SYN
Cross Index MOVESYNCORIGIN
Sample Here when the master is in 2000 qc the slave should be in 4000 qc, i.e., slave
should be ahead of master by 2000 qc. Also when the master is in 3000 qc the slave should be in 5000 qc.
__ Command Reference __
26 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
__ Command Reference __
DELAY
Summary Time delay
Syntax DELAY t
Parameter t = time delay in milliseconds (maximum MLONG)
Description The DELAY command leads to a defined program delay. This parameter gives the
delay time in milliseconds. If an interrupt occurs during the delay time, then following the processing of the
interrupt procedure, the programmed delay will take place after the correct inclusion of the interrupt time. Thus, the DELAY command gives a constant delay time, independent of whether various interrupts have to be processed during the programmed delay time.
If the interrupt requires more processing time than is available for the delay, then the interruption procedure will be carried out to the end, before the command following the DELAY instruction is commenced.
Command Group CON
Cross Index WAITT, WAITI, WAITAX
Syntax Example DELAY 1000 /* 1 second delay */
Program Sample DELAY_01.M
DELETE ARRAYS
Summary Delete all arrays in the RAM.
Syntax DELETE ARRAYS
Description With DELETE ARRAYS you can delete all arrays in the RAM without also deleting the
Command Group INI
parameters etc. This command has the same effect as the menu command Controller Reset Arrays.
NB!:
If you then execute a SAVE ARRAYS, the arrays in the EPROM are also overwritten!
NB!:
If DELETE ARRAYS is carried out after a DIM assignment in the program, it is then no longer possible to access the array elements.
NB!:
If a program contains a DELETE ARRAYS command, there are no more arrays in the RAM after the program is exited.
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 27
MCO 305 Command Reference
DIM
Summary Definition of an array
Syntax DIM array [n]
Parameter array = name of the array
n = number of array elements
Description Via a DIM instruction at the commencement of the program, it is possible to
declare one or more arrays (= Variable fields). Arrays are valid for all programs. If arrays are not yet available in the MCO 305
memory, then the arrays are allocated via the DIM instructions. Arrays which are already available in the memory are checked to see if their size corresponds to the current DIM commands. If differences are found, then an error registration is made. If, additionally to the corresponding arrays, new arrays are declared, then these must also be added at the end of the DIM command.
Each array element can later be accessed, similar to a variable, calculation results, characters or other information can be stored.
An array element can be called up via the array name and an index. The indices are admissible from 1 to the defined size in the DIM allocation. An essential difference between variables and array elements consists in the fact that arrays are stored in the non-volatile memory, and their contents are permanent even when the power supply is switched off – insofar as it is saved with SAVEPROM or SAVE ARRAYS.
In contrast to variables, arrays have a validity not only for one, but for all programs in the VLT unit flow. The only condition necessary is that the arrays must be accessible via a DIM command in the desired program which enables a data exchange between several programs. It is of no importance whether or not the array is identified with the same name in all the programs. What is important is the order of the array definitions. This means, for example, that the first defined array in all programs always refers to the first stored array in the memory, independent of the array name.
NB!:
The DIM command must be the first instruction in a program, and must appear before the subroutines. Indices from 1 to the defined size of the array are permissible.
The array content will not be lost, even following switching off the power supply. A defined array size is v alid for all pr ogr ams, and cannot be altered. Only the order of
the array definitions (not the names) det ermines which of the data- fields will be accessed.
Array definitions can only be canceled via erasure of the entire memory.
Command Group CON
Syntax Example DIM xpos[100], ypos[100]
/* define array XPOS and YPOS each with 100 elements */
Program Sample DIM_01.M
__ Command Reference __
28 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
MCO 305 Command Reference
DISABLE … interrupts
Summary Locks the execution of interrupts.
Syntax DISABLE inttyp
NB!:
DISABLE cannot be called up during interrupt procedures. (The system automatically switches back to enabled after an interrupt.)
Parameter
Description DISABLE switches off all or explicitly specified interrupts – apart from ON ERROR.
inttyp = ALL CANMSG COMBIT INT KEYPRESSED PARAM PERIOD position interrupts: ON APOS, ON IPOS, ON MAPOS, ON MCPOS, ON MIPOS STATBIT TIME
NB!:
The execution of error handling ON ERROR can not be locked with DISABLE. The error interrupt has the highest priority and it also interrupts other active interrupts.
If the function DISABLE … is used in the main program, it can prevent interrupts of the corresponding type.
This is particularly useful if a variable, which is set in an interrupt procedure, is used in the main program. To do this you should first switch off the corresponding (or all) interrupts in the main program DISABLE … alter the variable and then switch the corresponding (or all) interrupts back on with ENABLE …
NB!:
If an interrupt is disabled it still exist, but is not processed anymore (Exception: DISABLE ALL).
The detection is still running in the background and the interrupt is captured in case of a non (!) edge-sensitive or a message-oriented interrupt (ON PERIOD, ON APOS, ON PARAM etc.). If the interrupt is ENABLEd again and there was a captured (non edge-sensitive) interrupt before, this interrupt is processed immediately.
In case of edge-sensitive interrupts (e.g. ON INT, ON COMBIT, ON STATBIT), all interrupts, which take place during the DISABLEd phase are not processed, even not after switching on ENABLE again. These interrupts have no memory in case of DISABLEd state. Edge-sensitive interrupts which take place after the anew ENABLEing are still processed again.
NB!:
Exception: DISABLE ALL In opposite to the selective disabling of edge-sensitive interrupts (e.g. DISABLE
INT) – these will be ignored and not executed after enabling – in case of DISABLE ALL the request is stored (edge-sensitive interrupts too) and the interrupt are still executed after enabling (ENABLE ALL)!
DISABLE ALL in combination with selective DISABLE Please note, that an ENABLE ALL has no impact on simultaneous valid blockings
defined by selective DISABLE commands (e.g. DISABLE INT). Thus a selective blocking must also be cleared by the corresponding selective ENABLE!
__ Command Reference __
MG.34.R1.02 – VLT
®
is a registered Danfoss trademark 29
MCO 305 Command Reference
__ Command Reference __
Interrupt handling within an Interrupt During the execution of an interrupt subroutine at first a DISABLE ALL will auto-
matically be done internally. This blocks the execution of all other interrupts, but keeps upcoming interrupt requests still in mind. At the end of the ‘current’ interrupt subroutine an ENABLE ALL will be again executed automatically. With the comple­tion of the ‘current’ interrupt the upcoming stored interrupts will be executed yet. Therefore the execution of the commands DISABLE ALL and ENABLE ALL within an interrupt is not necessary and not meaningful, too.
The selective blocking of single interrupts within an interrupt subroutine can be necessary, depending on the application. Think of the following example: If the execution of an interrupt should lock the request and execution of other interrupt types, a selective DISABLE (e.g. DISABLE INT) can be done. In this case the selective interrupt blockage must be cleared (e.g. ENABLE INT) by the application program later on again. Typically this is done at the end of the current interrupt subroutine and enables the execution of corresponding interrupt requests in future again. All edge triggered interrupts, which were received between the correspon­ding selective DISABLE and ENABLE, will be ignored and not executed any longer (nor later). All interrupts, which were received before the selective blocking (e.g. DISABLE INT) or after the new selective release (e.g. ENABLE INT) will be processed after the completion of the “first“ interrupt.
Command Group INT
Cross Reference ON INT, ON CANMSG, ON COMBIT, ON KEYPRESSED, ON STATBIT, ON PARAM, ON
PERIOD, ON TIME, ENABLE .. Interrupts
Syntax Examples DISABLE ALL /* Switch off all interrupts */
DISABLE STATBIT /* Switch off the interrupt for the status bit */
30 MG.34.R1.02 – VLT
®
is a registered Danfoss trademark
Loading...
+ 122 hidden pages