Anyone tell me what command I can use to hold motor at position after home index and subroutine execution.
My program will start by homing to index to get me a repetative starting point. After homing I want the motor to hold position while I check the status of 2 inputs.Input status will send the program into three possible sub routines one will jog the motor clockwise a designated amount and the other will jog the motor counterclockwise a designated amount and one will hold present position.
The program will than continually monitor the inputs for any future move commands. If powered down unit will home again upon activation.
I have attached program . subroutines function but motor cycles back and forth constantly when running program.
Anyone point me in the right direction. Thanks Kent
EIGN (W,0)
O=0
ADT=100
VT=10000
MP
PRT=20
G
TWAIT
i=I(0)
Ai(0)
PRT=-4000
G
WHILE Bi(0)==0
LOOP
X
TWAIT
PT=I(0)
G
TWAIT
O=0
C10
IF IN (16)==0
GOSUB20
ENDIF
IF IN (17)==0
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
The expanded 24VDC I/O is sourcing... so a value of 0 means the input is not made... which would make it cycle through the subroutines continuously. You may just need to change the I/O comparison to 1 instead of 0.