Homing to a hard st...
 
Notifications
Clear all

Homing to a hard stop example program

2 Posts
1 Users
0 Likes
3,453 Views
 Kurt
(@Kurt)
Posts: 0
New Member Guest
 

In the homing to a hard stop example program, you switch from a MV move to a MT move after hitting the hard stop. Do I need a "G" to start the motor torque move?

'-----------------------
GOSUB0 'go to home subroutine
'------------------------------------------------------------------
END 'END OF PROGRAM
'---------------------------------------------------------
C0 'HOME ROUTINE
h=-500 'This is some home offset from hard stop
'to define home as zero
r=1
'Make r a -1 to reverse home direction

v=500000 'some faster home speed off of hard stop

PRINT("Homing motor",#13)
MV
V=-100000*r 'HOMING VELOCITY
A=1000 'HOMING ACCEL
E=30 'SETTING ERROR FOR HARD STOP LIMIT
'This may need to be changed
G 'start a velocity mode move

'The following line looks at the Position error status bit.
'You should expect to get a position error when you hit a hard stop.
WHILE Be==0 LOOP
'You will drop out of the above loop when Be equals 1
'i.e. you errored on position.

PRINT("Hit hard stop",#13)
PRINT("Switching to torque mode",#13)
T=-100*r
MT
WAIT=1000
PRINT("Setting position register",#13)
O=h*r 'Setting present position to HOME OFFSET value
X
E=500 'setting normal running error limit
V=v
MP
P=0
PRINT("Moving to Zero",#13)
G
TWAIT 'do nothing until trajectory is complete
PRINT("Motor is at Home",#13)
RETURN

 
Posted : 06/06/2016 3:37 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

Yes. A G is needed to change to any new mode.

 
Posted : 06/06/2016 3:46 pm
Share: