Homing when power i...
 
Notifications
Clear all

Homing when power is turned on

4 Posts
1 Users
0 Reactions
7,880 Views
 BL24
(@BL24)
Posts: 2
New Member Guest
Topic starter
 

I need to home the motor every time the motor is turned on, do not really want to use hard stops. Can I store a home location in memory? Any suggestions or code would be great.

Also, in the following program, when input 16 is triggered it rotates once and when input 17 is triggered it rotates back. If the input signal is still on when a subroutine is completed the motor will continue to rotate. Also, if a signal is received and shuts off in the middle of a subroutine it will not make the requested move. How do I fix these problems?

Thanks, Ben

EIGN (2)
EIGN (3)
ZS
ADT=100
VT=100000
PT=0
G
TWAIT
C10
IF IN (16)==1
GOSUB20
ENDIF
IF IN (17)==1
GOSUB30
ENDIF
GOTO(10)
END
C20
MP
ADT=100
VT=100000
PRT=4000
G
TWAIT
RETURN
C30
MP
ADT=100
VT=100000
PRT=-4000
G
TWAIT
RETURN

 
Posted : 12/12/2013 8:54 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

Hi Ben,
Since it's an incremental encoder... not absolute... the only method besides homing to a switch or a hard stop is to home to the index marker... but this only works within one revolution of the motor.

I added a couple of lines in your subroutines that should keep it from repeating. A signal change while the subroutine is being executed shouldn't interrupt operation.

EIGN (2)
EIGN (3)
ZS
ADT=100
VT=100000
PT=0
G
TWAIT
C10
IF IN (16)==1
GOSUB20
ENDIF
IF IN (17)==1
GOSUB30
ENDIF
GOTO(10)
END
C20
MP
ADT=100
VT=100000
PRT=4000
G
TWAIT
WHILE IN(16)==1 LOOP
RETURN
C30
MP
ADT=100
VT=100000
PRT=-4000
G
TWAIT
WHILE IN(17)==1 LOOP
RETURN

 
Posted : 12/12/2013 9:05 am
 BL24
(@BL24)
Posts: 2
New Member Guest
Topic starter
 

Thank you for the quick response. The while loops worked very well and a constant signal will not produce a constant rotation of the motor. However, if multiple signals are sent during the first rotation they are still not detected. For example, we are sending two pulses to the motor because we want two rotations and currently we have to wait for the first rotation to be completed before the second signal can be detected. Is there a way to count the pulses to know how far we must rotate?

By the way, if there is a better way to do this please let me know.

 
Posted : 12/12/2013 11:01 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

That's a little tricky if you only have I/O and no way to set a variable with the number of rotations. The easiest approach (with I/O)would be to use more I/O and more subroutines. You can take 4 I/O and use 3 of them to represent a binary number between 0-7... then use the 4th I/O to read the binary number and call one of 8 subroutines.

 
Posted : 12/12/2013 11:20 am
Share: