There are three methods of reading and writing drive parameters from within a user program:
The following formats are supported by Machine Control Studio for accessing parameters and menus:
• | mm = the menu number |
• | ppp = the parameter number in the menu |
• | <MenuName> = the menu name (see table below) |
Each menu on the drive can be accessed in editors and via the input assistant by using the format Mmm.Pppp.
For example, to set menu 18, parameter 20 to the value 10, the following structured text could be used:
M18.P020 := 10;
Note each parameter is of a specified data type (see Parameter Data Types), to read / write a raw value with no decimal point (non floating point) the following syntax can be used:
M01.P021_Raw := 1001;
As Preset Reference 1 (#01.021) is a floating point value with 1 decimal place the value displayed on the keypad will be 100.1.
A set of functions are available in the library User Runtime Library for reading and writing device parameters:
The functions listed below are used to read the different parameter data types that the drive and modules provide.
▪ | ReadUserParameterBOOL |
▪ | ReadUserParameterDINT |
▪ | ReadUserParameterINT |
▪ | ReadUserParameterLREAL |
▪ | ReadUserParameterSINT |
▪ | ReadUserParameterUDINT |
▪ | ReadUserParameterUINT |
▪ | ReadUserParameterUSINT |
If these functions are used, ensure that the correct function is used for the data type of the parameter being read.
Inputs:
Slot : UDINT; Set to the required slot number. Set to 0 to access a drive parameter or option module setup menus from the drive
Menu : UDINT; Set to the required menu number (15 = Slot 1 setup, 16 = Slot 2 setup, 17 = Slot 3 setup).
Parameter : UDINT; Set to the required parameter number
Return value: The data type of the returned value depends on the function used. The last part of the function name indicates the data type returned.
The functions listed below are used to write values to the different parameter data types that the drive and modules provide.
▪ | WriteUserParameterBOOL |
▪ | WriteUserParameterDINT |
▪ | WriteUserParameterINT |
▪ | WriteUserParameterLREAL |
▪ | WriteUserParameterSINT |
▪ | WriteUserParameterUDINT |
▪ | WriteUserParameterUINT |
▪ | WriteUserParameterUSINT |
Inputs:
Slot : UDINT; Set to the required slot number. Set to 0 to access a drive parameter or option module setup menus from the drive
Menu : UDINT; Set to the required menu number (15 = Slot 1 setup, 16 = Slot 2 setup, 17 = Slot 3 setup).
Parameter : UDINT; Set to the required parameter number
Value : <Indicated in function name>; Set to the required value to write to the parameter
MyVar1 := ReadUserParameterBOOL(0, 15, 05) // This is valid to read a option setup menu in slot 1
MyVar1 := ReadUserParameterBOOL(1, 15, 05) // This is NOT valid to read a option setup menu in slot 1
Note: Unidrive M Onboard User Programs can only reference slot setup menus (i.e. 15, 16, 17) and NOT internal module menus (i.e. menu 90)
Menus and parameters can be referenced by name from within editors and the input assistant. The chart below lists menus by name.
For example, to set menu 18, parameter 20 to the value 10, the following structured text could be used:
ApplicationMenu1.AppsMenu1ReadWriteInt20 := 10;
The table below has a list of available menu names, once used in editors the application intellisense or Input Assistant will offer a list of parameters available in the menu:
Number |
Mmm |
Mode (s) |
<MenuName> |
---|---|---|---|
1 |
M01 |
OpenLoop |
FrequencyReferences |
|
|
RFC A & RFC S |
SpeedReferences |
|
|
Regen |
N/A |
2 |
M02 |
OpenLoop |
FrequencyRamps |
|
|
RFC A & RFC S |
SpeedRamps |
|
|
Regen |
N/A |
3 |
M03 |
OpenLoop |
FrequencySlavingAndPositionFeedback |
|
|
RFC A & RFC S |
RFCFrequencySlavingAndPositionFeedback |
|
|
Regen |
RegenControl |
4 |
M04 |
OpenLoop |
OpenLoopCurrentControl |
|
|
RFC A & RFC S |
RFCCurrentControl |
|
|
Regen |
RegenCurrentControl |
5 |
M05 |
OpenLoop |
OpenLoopMotorControl |
|
|
RFC A |
RFCAMotorControl |
|
|
RFC S |
RFCSMotorControl |
|
|
Regen |
RegenMotorControl |
6 |
M06 |
OpenLoop |
OpenLoopSequencerAndTiming |
|
|
RFC A & RFC S |
RFCSequencerAndTiming |
|
|
Regen |
RegenSequencerAndTiming |
7 |
M07 |
All |
AnalogueIO |
8 |
M08 |
All |
DigitalIO |
9 |
M09 |
All |
UserFunctions1 |
10 |
M10 |
All |
StatusAndTrips |
11 |
M11 |
All |
Miscellaneous |
12 |
M12 |
OpenLoop |
OpenLoopUserFunctions2 |
|
|
RFC A & RFC S |
RFCUserFunctions2 |
|
|
Regen |
RegenUserFunctions2 |
13 |
M13 |
OpenLoop |
OpenLoopMotorControl |
|
|
RFC A & RFC S |
RFCMotorControl |
|
|
Regen |
RegenMotorControl |
14 |
M14 |
OpenLoop & RFC |
PIDController |
|
|
Regen |
PIDControllerRegen |
15 |
Function required |
||
16 |
Function required |
||
17 |
Function required |
||
18 |
M18 |
All |
ApplicationMenu1 |
19 |
M19 |
All |
ApplicationMenu2 |
20 |
M20 |
All |
ApplicationMenu3 |
21 |
M21 |
OpenLoop |
OpenLoopMotor2Parameters |
|
|
RFC A |
RFCAMotor2Parameters |
|
|
RFC S |
RFCSMotor2Parameters |
|
|
Regen |
RegenMotor2Parameters |
22 |
M22 |
All |
Menu0Setup |
31 |
M31 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCGeneralSetUp |
|
|
Regen |
N/A |
32 |
M32 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCMasterPosition |
|
|
Regen |
N/A |
33 |
M33 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCSlavePosition |
|
|
Regen |
N/A |
34 |
M34 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCReferenceSelector |
|
|
Regen |
N/A |
35 |
M35 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCCam |
|
|
Regen |
N/A |
36 |
M36 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCCamTable |
|
|
Regen |
N/A |
37 |
M37 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCElectronicGearBox |
|
|
Regen |
N/A |
38 |
M38 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCProfileGenerator |
|
|
Regen |
N/A |
39 |
M39 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCPositionControlLoop |
|
|
Regen |
N/A |
40 |
M40 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCHomingSystem |
|
|
Regen |
N/A |
41 |
M41 |
OpenLoop |
N/A |
|
|
RFC A & RFC S |
AMCControlAndStatus |
|
|
Regen |
N/A |
See Also