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).
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).
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) 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 |
All |
References |
2 |
M02 |
Open-loop |
Ramps |
|
|
RFC-A |
Ramps_RFC_A |
3 |
M03 |
Open-loop |
SlavingAndPositionFeedback |
|
|
RFC-A |
SlavingAndPositionFeedback_RFC_A |
4 |
M04 |
Open-loop |
CurrentControl |
|
|
RFC-A |
CurrentControl_RFC_A |
5 |
M05 |
Open-loop |
OpenLoopMotorControl |
|
|
RFC-A |
OpenLoopMotorControl_RFC_A |
6 |
M06 |
All |
OpenLoopSequencerAndTiming |
7 |
M07 |
All |
AnalogueIO |
8 |
M08 |
All |
DigitalIO |
9 |
M09 |
All |
UserFunctions1 |
10 |
M10 |
All |
StatusAndTrips |
11 |
M11 |
All |
Miscellaneous |
12 |
M12 |
Open-loop |
OpenLoopUserFunctions2 |
14 |
M14 |
All |
PIDController |
15 |
Function required |
||
18 |
M18 |
All |
ApplicationMenu1 |
20 |
M20 |
All |
ApplicationMenu2 |
21 |
M21 |
Open-loop |
OpenLoopMotor2Parameters |
|
|
RFC-A |
OpenLoopMotor2Parameters_RFC_A |
22 |
M22 |
All |
Menu0Setup |
24 |
M24 |
All |
MFPA |
See Also