I appreciate any suggestions and helps from community for the following codes for homing 2 motors. The current code used H/W limit sensors but I want to disable HW flag and use SW flags instead. I tried to set I197=1, I124=$20000, I7212=0, I7213=0, I113-32000 and I could not make it to work. Thanks for the help.
I124=131073;729
I224=131073;730
M316=0;731
M317=0;732
M318=0;733
I7212=2;734 capture on rising edge of a flag for Motor1
I7222=1;735 capture on flag low for Motor2
I7213=1;736 use PLIM1 as flag(positive end limit) for Motor1
I7223=0;737 use HOME2 (home flag) as trigger flag
I123=12;738 Home speed with positive direction for Motor1
I223=30;739 Home speed with positive direction for Motor2
I126=0;740 no home offset for Motor1
I226=0;741 no home offset for Motor2
M145=0;742
M245=0;743
HOME1,2;744 Homing for Motor1 and 2
WHILE(M145=0ORM245=0);745
END WHILE;746
I123=-12;747 Home speed with negative direction for Motor1
I223=-30;748 Home speed with negative direction for Motor2
I7212=1;749
I7222=10;750
M145=0;751
M245=0;752
I126=P126;753 P126=-10000 home offset for motor1
HOME1,2;754 Home move for motor 1 and 2
WHILE(M145=0);755
END WHILE;756
M318=1;757
I5211=50;758
WHILE(I5211>0);759
END WHILE;760
M318=0;761
WHILE(M413=0);762
END WHILE;763
I5211=14000;764
WHILE(I5211>0);765
END WHILE;766
M317=1;767
I5211=500;768
WHILE(I5211>0);769
END WHILE;770
M317=0;771
WHILE(M413=0);772
END WHILE;773
PSETX(P30)Y(P31);774
M313=0;775
M314=1;776
P273=M201;777
P264=M264;778
ENABLE PLC2,3;779
P211=1;780
CLOSE;781
OPEN PROG 103 CLEAR;784
PSETX(P30)Y(P31);785
CLOSE;786
OPEN PROG 111 CLEAR;789
M110=1;790
M111=0;791
M112=0;792
M115=0;793
M114=0;794
M113=1;795
I123=P123;796 P123=100 home speed with positive direction for motor1
I124=8519681;797 hardware limit
I126=0;798 no home offset
I7212=2;799 capture on rising edge of a falg
I7213=1;800 using PLIM1 as flag (positve end limit)
HOME1;801 Home move for Motor1
I123=-P123;802 P123=100 home speed with negative direction for motor1
I7212=1;803 capture on flag high
I126=P126;804 home offset -10000
HOME1;805 Homing move for motor1
M118=1;806
I5211=50;807
WHILE(I5211>0);808
END WHILE;809
M118=0;810
DWELL5000;811
M117=1;812
I5211=565;813
WHILE(I5211>0);814
END WHILE;815
M117=0;816
I124=8388609;817
M113=0;818
M114=1;819
M110=0;820
I-variables
I111=32000;25966
I112=16000;25967
I113=0;25968
I114=0;25969
I114=0;25969
I115=0.25;25970
I116=1000;25971
I117=10000;25972
I118=0;25973
I119=100;25974
I120=0;25975
I121=50;25976
I122=32;25977
I123=-12;25978
I124=$20001;25979
I125=$78200;25980
I126=-10000;25981
I127=0;25982
I128=50000;25983
I129=0;25984
I130=34800;25985
I131=1100;25986
I132=1100;25987
I133=9500;25988
I197=0;
I1711=32000;27566
I1712=16000;27567
I1713=0;27568
I1714=0;27569
I7211=0;33066
I7212=1;33067
I7213=1;33068
I7214=0;33069