Hello
I wanted to change direction with MpAxisBasicParType.
MpAxisBasicParType.direction:=mcDIR_NEGATIVE;
I did it but the direction did not change. What is the reason or is the direction changed with another block?
Answer from AI conversation help:
To change the direction of movement with MpAxisBasicParType, you should set the Direction parameter to mpAXIS_DIR_NEGATIVE, not mcDIR_NEGATIVE. The correct syntax would be MpAxisBasicParType.Direction := mpAXIS_DIR_NEGATIVE; This should change the direction of movement accordingly.
Im not sure. But FUB has input command Update parameter [BOOL], maybe you have to generate positive edge on this input as well.
In this case I get error 1178 [1]
Error 1178 in the context of servo motor direction control typically indicates an issue related to the configuration or command sent to the motor controller. This error might be arising due to an incorrect parameter value or command syntax when attempting to change the direction of the servo motor, as you mentioned trying to use
mcDIR_NEGATIVE
which isn’t correct. The proper way, as noted earlier, involves setting theDirection
parameter tompAXIS_DIR_NEGATIVE
. Ensure this is correctly applied to avoid encountering error 1178, which can be linked to misconfiguration or misunderstanding the command syntax in the control software. (Explanation by AI) ↩︎
If you’re using MpAxisBasic, I’m pretty sure you have to first stop the current movement, then start a new one with the new direction. Jaroslav’s solution of using the Update may also work, but I’ve always stopped the current movement before starting a new one.
If you wanted to feed a constant velocity to the motor and change direction on the fly without stopping, you could use something like MC_BR_MoveCyclicVelocity instead to command the move.
respected official
MpAxisBasicParType.direction:=MIDIR NEGATIVE;
First I wrote, installed the program and ran it, that is, I gave it while the system was stopped, but it didn’t work. Likewise, I used mcDIR_POSITIVE and it didn’t work.
Can you please explain your problem further, and maybe add a code sample? This last reply makes it sound like you’re not getting the axis to move in general, rather than the direction not changing.
Dear Administrator, My system is working, but I want the servo to change direction. So, I want to send 50.0m, but the servo goes -50m according to me. If I give -50, it goes in the direction I want. I wrote the code for this as follows.
ACTION Axis:
MpAxisBasic_2.Enable:= TRUE;
MpAxisBasic_2.MpLink:= ADR(gAxis_5);
MpAxisBasic_2.Parameters := ADR(MpAxisBasicParType_2);
MpAxisBasicParType_2.Direction:=mcDIR_POSITIVE;
…
MpAxisBasicParType_2.Position:=gProcessDB.Stacker.Movement.Z.Z_others.wait_position;
MpAxisBasic_2.MoveAbsolute:=TRUE; MpAxisBasic_2();
END_ACTION
Thank you for clarifying!
I think the issue is that you’re doing an absolute movement. This is a movement to a specific position. If you tell your axis to move to position 50, it can only get there by going in one direction. During an absolute movement, the direction parameter is ignored unless the axis is periodic (which linear axes are not).
If you just want to move a distance of 50m from where you are currently, then you should use MoveAdditive. In this case, I believe the direction parameter should be evaluated.
You can also use a negative on your distance as you’re doing now (i.e. -50.0m). This accomplishes the same thing.