Delta Tau Forums

Full Version: Motor[X].HomeOffset sometimes does not work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
After configuring the motor, write the parameters of ppsave.cfg into global definitions.pmh.
After running home.plc, (Enter "enable plc home" in the terminal ) I found that homeoffset always has problems. Powerpmac is powered on and started. Home.plc is executed for the first time.After returning to zero, the zero position from the reference point is not the offset value I set .

The value of Motor[1].HomeOffset in the monitoring window of the IDE is indeed my setting. I am sure that Motor[1].HomeOffset has not changed when the plc is running.

When I enter $$$ in the terminal to search for home again, the zero position from the reference point is correct.
Does the global definitions.pmh setting parameter (the parameter in pp_save.cfg) affect the homeoffset?

The following is my home.plc

open plc home
p11=0
p12=0
p13=0

Motor[1].CaptureMode=0
Gate3[0].Chan[0].CaptFlagSel=0
Gate3[0].Chan[0].CaptCtrl=1
Motor[1].HomeVel=-327680
Motor[1].HomeOffset=-32768000
Motor[1].CaptPosLeftShift=4

while(Gate3[0].Chan[0].HomeFlag==0)
{
Motor[1].JogSpeed=327680;
Motor[1].JogTa=-9.8999997e-05
Motor[1].JogTs=-0.090000004
if(Gate3[0].Chan[0].HomeFlag==0&&p11==0)
{
p11=1
cmd "#1jog+"
}
}

if(Gate3[0].Chan[0].HomeFlag==1&&p12==0)
{
p12=1
cmd "#1home"
}

disable plc home

close
How is this PLC “enabled” when you get the wrong value for “HomeOffset”?

What is the value you get that is wrong?
This PLC jogs forward indefinitely until the home flag is true. Then when the PLC sees that the flag is true it starts a homing search move looking for the home index. This is problematic because it may be too late to start the homing move by the time the PLC sees the home flag, you may have already passed one home index.

What is your intended behavior? Do you want your trigger for homing to be when both the home flag and home index are true at the same time? Or would you rather first move to the home flag and then trigger off the home index? In either case we can modify the PLC to reliably get your desired behavior.
I am curious. Where is local technical support coming from on this project?
Eric, thank you for your reply.
Here I need to explain, Gate3[0].Chan[0].HomeFlag, connect a photoelectric sensor to detect the positive direction of the motor to HomeFlag. At this point, start homing search move (#1home). The motor moves in the Negative direction to find the home index.
The final position of the motor should be the mark of the grating encoder(home index).
The mark of the grating ruler is in the middle position. I must first move the motor forward to the end (homeflag) to ensure that the mark of the grating ruler can be found.
My problem is that the home setting has not changed. After each homing search move, the stay position changes more than ten millimeters.
It sounds like you want to first move in the positive direction to reach the home flag. Then you want to home to the index in the negative direction.

The jog move in your PLC may go too far before stopping. You might try changing it to a triggered jog move like this. Note that a triggered jog move needs a size, so I went with 100. If your motor is in counts you will probably need to extend this.

Code:
open plc HomePLC

// First triggered jog move to home flag
Motor[1].CaptureMode=0
Gate3[0].Chan[0].CaptCtrl=2
Gate3[0].Chan[0].CaptFlagSel=0
Motor[1].CaptPosLeftShift=4

JOG1=100^0
CALL Timer.msec(100)
WHILE(Motor[1].InPos == 0) {}

// Second homing move to home index
Motor[1].CaptureMode=0
Gate3[0].Chan[0].CaptCtrl=1
Motor[1].HomeVel=-327680
Motor[1].HomeOffset=-32768000
Motor[1].CaptPosLeftShift=4

HOME 1
CALL Timer.msec(100)
WHILE(Motor[1].InPos == 0) {}

DISABLE PLC HomePLC
close

This assumes you have the timer that is added to new projects in the latest IDE. You may have to change the timer call.
If you don't have the in position function set up, you can change the while loops to:
Code:
WHILE(Motor[1].DesVelZero == 0) {}
Can't he just home on the flag alone and then do a second homing on the index?
Quote:Can't he just home on the flag alone and then do a second homing on the index?
Yes. The first move can be a triggered jog move, a homing move or a triggered rapid move. A homing move requires changing more parameters (HomeVel and HomeOffset) between moves, but it does allow an indefinite move.

That would look more like this.
Code:
open plc HomePLC

// First triggered jog move to home flag
Motor[1].CaptureMode=0
Gate3[0].Chan[0].CaptCtrl=2
Gate3[0].Chan[0].CaptFlagSel=0
Motor[1].HomeVel=327680
Motor[1].HomeOffset=0
Motor[1].CaptPosLeftShift=4

HOME 1
CALL Timer.msec(100)
WHILE(Motor[1].InPos == 0) {}

// Second homing move to home index
Motor[1].CaptureMode=0
Gate3[0].Chan[0].CaptCtrl=1
Motor[1].HomeVel=-327680
Motor[1].HomeOffset=-32768000
Motor[1].CaptPosLeftShift=4

HOME 1
CALL Timer.msec(100)
WHILE(Motor[1].InPos == 0) {}

DISABLE PLC HomePLC
close