I am using the MpAxisBasicConfig function block. However, even after assigning MpAxisBasicConfigType.Axis.Movement.Limits.Position.UpperLimit := 250;, setting MpAxisBasicConfig.Command := mcAXIS_BASIC_CFG_LOAD; and MpAxisBasicConfig.Execute := TRUE;, and subsequently resetting MpAxisBasicConfig.Execute to FALSE once the operation is complete (indicated by MpAxisBasicConfig.Done := TRUE;), the upper limit value for my axis does not change; this remains the case even when I move the axis using a “jog” command.
What is the error on my part? I haven’t been able to see it.
According to AS help, the cmd CmAXIS_BASIC_CFG_LOAD, simply loads the axis configuration to variables not otherwise, I believe you need write or save (depending your case)
I first tried the CFG_SAVE command, followed by CFG_LOAD, but neither worked. Subsequently, when I attempted the CFG_WRITE command, the following error occurred: MpAxisBasicConfig.ErrorID := -1067278070. Additionally, MpAxisBasic triggered an error, returning the error code -1067278080.
-1067278070 simply mean condition or precondition has not been fulfilled to use this FB, more detailed should be available in the logger which you can check, quite likely due to the fact that you have only set the upper limit value, and none other in data (quite big structure).
I can see two options here, first do a cfg_load, like this your variable will have all the current existing value, then change the limit to the desired value, and then cfg_write it.
Or using the “secion” option in MpAxisBasicConfigParType to only write the axis limit value
I have been working with this function block for a while so I can share my workflow with it.
First, -1067278070 and -1067278080 are general errors, if you look in the logger, it will tell you what the problem is. Most of the time, it is an invalid parameter like the resolution being at 0.
When using MpAxisBasicConfig, read/write and load/save are the same but the first is for the parameterization and the other for configuration. Parameterization are modifying directly the axis parameters and will be lost after a restart. Configuration is more permanent.
So which one you’ll be using will be based on what you are trying to do:
If you write the axis value every time the machine is booting (exemple when you are defining the full configuration in the code): read/write would be the right choice.
If you are just modifying a value from time to time in the axis and not touching it after that: load/save would be the right choice.
But I would always start by doing a read/load before save/write because your data variable is normally empty and you need to fully set it for the config to be accepted (you can set parameters.Section to limit what you have to set). By doing a read/load, you are filling automatically your variable. Then you can modify what you want and save/write them back in the config/parameterization.
The information you provided was very helpful; however, I haven’t been able to achieve the desired result. I must be making a mistake somewhere. I read the current values (CFG_READ) and saved them (CFG_SAVE), then performed a load operation (CFG_LOAD). Afterward, I changed my limit value—specifically, I updated the MpAxisBasicConfigType.Axis.Movement.Limits.Position.UpperLimit parameter from 300 to 400—and then saved (CFG_SAVE) and loaded (CFG_LOAD) the configuration again. Where am I going wrong?
So from what I understand. You want to change MpAxisBasicConfigType.Axis.Movement.Limits.Position.UpperLimit once and let the machine run with that.
So what I would do is start with a mcAXIS_BASIC_CFG_LOAD to read what’s on your configuration right now. After that you can modify MpAxisBasicConfigType.Axis.Movement.Limits.Position.UpperLimit to the new value you want to apply. Then, you can use mcAXIS_BASIC_CFG_SAVE to save the data to the configuration so the change is permanent. You can after that use the mcAXIS_BASIC_CFG_WRITE to change the value you have right now for the axis.
And finally (this is optionnal), do a mcAXIS_BASIC_CFG_READ to verify the new value is indeed applied.
I will add to verify that parameter.section is set mcAXB_CFG_SEC_ALL.
If it is set to mcAXB_CFG_SEC_MOVE_LIMITS, just do a mcAXIS_BASIC_CFG_READ → mcAXIS_BASIC_CFG_WRITE
(load and save will not work with mcAXB_CFG_SEC_MOVE_LIMITS)
Thank you; the information you provided was very helpful. I would like to configure the parameters for my machine once and then leave them as they are, making changes only when necessary.
The sequence “Change Upper Limit → mcAXIS_BASIC_CFG_SAVE → mcAXIS_BASIC_CFG_WRITE” worked as expected; however, the servo’s .IsHomed output reverted to false, which necessitated a re-homing process. Why does this procedure cause the .IsHomed status to be lost? Furthermore, why did the sequence “Change Upper Limit → mcAXIS_BASIC_CFG_SAVE → mcAXIS_CFG_LOAD” fail to work? You had mentioned that changes made via mcAXIS_BASIC_CFG_WRITE are not permanently saved to memory.
I wouldn’t be surprise if the axis requires a rehoming if all its parameters are changed. Normally it is doing it for things like gearbox, resolution and some other parameters (which is normal, if you are changing the fundamental settings of the axis, the home position is no longer reliable). My guess is that it is interpreting a mcAXB_CFG_SEC_ALL as writing those critical parameters. If rehoming is a problem there is 2 solution I’m thinking could work (normally I’m playing with the axis parameters before homing but if it is not possible, that’s what I would do)
We can try to see if using parameter.Section in mode mcAXB_CFG_SEC_MOVE_LIMITS is avoiding the rehoming. That will require a little change in the sequence
So what we are doing is writing only the limits to the axis in parameterization and changing the mode to all too allow a save command for the configuration.
If 1 is not working, you can simply do a sequence where you save the position before writing, and then after the homing is lost, do a home direct with that position to restore it. A bit less clean but should do the trick.
Finally to answer your last question. I think the confusion comes from the configuration living on the PLC and the parameterization living on the drive. When you are starting your machine, the PLC will write its configuration to the parameterization of the drive. After that, it will not be touched again if you are not doing a restart. So when doing a load/save, you are just modifying what’s on the plc and it will not applied it until next restart. Parameterization is directly on the drive so the changes are applied immediately, problem is, next restart the PLC will write the configuration back. That’s why a load/save alone will not change immediately the limits and the read/write will only temporarely change them.
as you know MpAxisBasicConfig calls internally MC_BR_ProcessParam and MC_BR_ProcessConfig.
When you call MC_BR_ProcessParam for changing axis base type or mechanical elements on fly (even if you’re writing the same values of current axis parametrization) you lose your homing, in the network command the flag ‘Home position valid’ = 0:
so don’t call MC_BR_ProcessParam when it’s not necessary …yup it’s a pain! but R&D after few polite requests made important improvements on MpAxisBasicConfig (MC_BR_ProcessParam works in the same way even after those improvements):
We have new enumerations available just for updating drive controller or Axis movement limits (as already reported by Wenbo Ruan):
Since mappMotion 6.8 for command mcAXIS_BASIC_CFG_WRITE the “Mechanical elements” are only written when values in assigned structure differ from current axis parametrization. This avoid a need to re-execute homing command as “IsHomed” status of axis is preserved, when “Mechanical elements” are not written.