Jump to content
OMRON Forums

HOMEZ command


PGoms
 Share

Recommended Posts

I'm having some trouble with the HOMEZ command. I'm trying to do a quickfix in the end of a homing program. ( I just need it to move about 20000 counts past a reference trigger istead of stopping just at it) #2J=-20000 After this I'm trying to set this position to zero by doing a HOMEZ2 command but once I add the 'HOMEZ2' command it wont even run the Jog movement. With only the jog movement it works and I can type the HOMEZ2 command online to zero it. I guess there is probably some obvious mistake I did but I cant figure it out. Any ideas is appreciated :)
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Why dont you use Ixx26 Motor xx Home Offset instead? The only time I have needed to use HOMEZ is when the move is to big for the offest. I always check to make sure it is in posistion before issuing a HOMEZ WHILE(DES_VEL_ZERO_2_M = OFF OR IN_POS_2_M = OFF) ENDWHILE HOMEZ 2
Link to comment
Share on other sites

PGoms, As Ron22 mentioned, if you want to move a distance away from a trigger point and call it zero, then the easiest option is using [b]Home Offset[/b] (Ixx26). Once you have selected the position capture condition in [b]I7mn2[/b] and selected the corresponding flag in [b]I7mn3[/b], you can set the desired distance from the trigger point in Home Offset (Ixx26) parameter in 1/16 count unit. Note that this value is a signed value and the sign represents the direction of the encoder. for example, if you want to move until you detect the user flag high and then move 1000 counts toward positive direction of the scale your settings for motor 2 would be: I7022=2 //Flag High Capture Condition I7023=3 //User Flag used for Capture I226=16000 // 1000 counts in positive direction in units of 1/16 of a count
Link to comment
Share on other sites

Hi guys, Thanks for quick reply. I was able to do the HOMEZ in a different program but not in the same program right after the jog move. So yeah I understand what you're saying about the xx26 Offset, but I tried that first and it didn't work like wanted. It is most certain a problem withthe homing program itself. But I tried setting the xx26 to -21000(I guess it should be 16*-21000 to get me to -21000) , well, to basicly anything else than the set 0 but with no luck. If I set it greater than -200 it would just jog away right into my end limit switch(emergency one not home position). If I kept it smaller it would move down to a position far greater than set value *1/16 counts, but still move back to the 0 pos after.. But I guess this program jumps a bit back and forth when the status changes, but even when I changed the last x26 in each of the IFs it would still not give me the wanted pos. Here's the program itself: ;MOTION PROGRAM 41 ;REF.KJØRING AKSE BX ;---------------------------------- CLOSE DELETE GATHER DELETE TRACE OPEN PROG 41 CLEAR #include "macro_def.PMC" DummyProg40=0 I121=500 I221=500 IF(M120=1 AND M220 =1 AND DummyProg40=0) ;HMFL av B og av X? I123=-25 ;HOME-hastighetB I126=0 ;HOME offsetB I7212=11 ;Trigger på HMFL på B I7213=0 ;Velg triggesignal (HMFL) B I223=-20 ;HOME-hastighetX I226=0 ;HOME offsetX I7222=11 ;Trigger på HMFL på X I7223=0 ;Velg triggesignal (HMFL) X HOME 1,2 ;HOME-kjøring DummyProg40=1 ENDIF IF(M120=0 AND M220=0 AND DummyProg40=0) ;HMFL på B og på X? I123=5 ;HOME-hastighetB I126=1000 ;HOME offsetB I7212=3 ;Trigger på HMFL av B I7213=0 ;Velger triggesignal (HMFL) B I223=5 ;HOME-hastighetX I226=1000 ;HOME offsetX I7222=3 ;Trigger på HMFL av X I7223=0 ;Velger triggesignal (HMFL) X HOME 1,2 ;HOME-kjøring DWELL 5 I123=-5 ;HOME-hastighetB I126=0 ;HOME offsetB I7212=11 ;Trigger på HMFL på B I7213=0 ;Velg triggesignal (HMFL1) B I223=-5 ;HOME-hastighetX I226=0 ;HOME offsetX I7222=11 ;Trigger på HMFL på X I7223=0 ;Velg triggesignal (HMFL) X HOME 1,2 ;HOME-kjøring DummyProg40=1 ENDIF IF(M120=1 AND M220=0 AND DummyProg40=0) ;HMFL av B og på X? I123=-5 ;HOME-hastighetB I126=0 ;HOME offsetB I7212=11 ;Trigger på HMFL av B I7213=0 ;Velger triggesignal (HMFL) B I223=5 ;HOME-hastighetX I226=1000 ;HOME offsetX I7222=3 ;Trigger på HMFL av X I7223=0 ;Velger triggesignal (HMFL) X HOME 1,2 ;HOME-kjøring DWELL 5 I223=-5 ;HOME-hastighetX I226=0 ;HOME offsetX I7222=11 ;Trigger på HMFL på X I7223=0 ;Velg triggesignal (HMFL) X HOME 2 ;HOME-kjøring DummyProg40=1 ENDIF IF(M120=0 AND M220=1 AND DummyProg40=0) ;HMFL på B og av X? I123=5 ;HOME-hastighetB I126=1000 ;HOME offsetB I7212=3 ;Trigger på HMFL av B I7213=0 ;Velger triggesignal (HMFL) B I223=-20 ;HOME-hastighetX I226=0 ;HOME offsetX I7222=11 ;Trigger på HMFL av X I7223=0 ;Velger triggesignal (HMFL) X HOME 1,2 ;HOME-kjøring DWELL 5 I123=-5 ;HOME-hastighetB I126=0 ;HOME offsetB I7212=11 ;Trigger på HMFL på B I7213=0 ;Velg triggesignal (HMFL1) B HOME 1 ;HOME-kjøring DummyProg40=1 ENDIF DWELL100 RefFerdigX=1 ReferanseBX=0 DummyRefX=0 DWELL100 RefFerdigB=1 ReferanseBX=0 DummyRefB=0 CLOSE I guess some of the variable names here are Norwegian but you should be able to understand the program. What I have here is a homing program for two axes,B(rotation) and X(length movement) (still trying to figure it completly, I didn't write the code). It has 4 IF loops for the different homing states(B and X not done, X done not B, B done not X, both done. This whole setting is a bit confusing, the machines homes back and forth 3-4 times(well because the status of B and X changes) before it finally rests at the final home pos. Does this look like a good way of doing it? I got my position now with the HOMEZ command but I would want a better way of doing it in the future :)
Link to comment
Share on other sites

PGoms, Thanks for posting your code. Since you are trying to home your machine, it is always suggested that such a task be implemented in a PLC and not a Motion Program. Since the execution of PLC follows a logical sequence, but a motion program is a synchronized program and although it supports logic call statements and loops, it's mainly designed for move sequences in a coordinate system. So If we change your code into a PLC, it should look like this: (Note: I haven't tested this code since I don't have all your IO, however, it should get you started) [code] #include "macro_def.PMC" // for following M-variables, use suggested M-variable definitions #define Mtr1HomeComplete M145 #define Mtr2HomeComplete M245 #define Mtr1InPos M140 #define Mtr2InPos M240 #define Mtr1DesVelZero M133 #define Mtr2DesVelZero M233 //PLC replacement for MOTION PROGRAM 41 //REF.KJØRING AKSE BX //---------------------------------- CLOSE DELETE GATHER DELETE TRACE OPEN PLC 4 CLEAR DummyProg40=0 I121=500 I221=500 IF(M120=1 AND M220 =1 AND DummyProg40=0) //HMFL av B og av X? I123=-25 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL på B I7213=0 //;Velg triggesignal (HMFL) B I223=-20 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL på X I7223=0 //Velg triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 AND Mtr2HomeComplete = 0 AND Mtr1DesVelZero=0 AND Mtr2DesVelZero=0 AND Mtr1InPos=0 AND Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile DummyProg40=1 ENDIF IF (M120=0 AND M220=0 AND DummyProg40=0) //HMFL på B og på X? I123=5 //HOME-hastighetB I126=1000 //HOME offsetB I7212=3 //Trigger på HMFL av B I7213=0 //Velger triggesignal (HMFL) B I223=5 //HOME-hastighetX I226=1000 //HOME offsetX I7222=3 //Trigger på HMFL av X I7223=0 //Velger triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 AND Mtr2HomeComplete = 0 AND Mtr1DesVelZero=0 AND Mtr2DesVelZero=0 AND Mtr1InPos=0 AND Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile I123=-5 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL på B I7213=0 //Velg triggesignal (HMFL1) B I223=-5 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL på X I7223=0 //Velg triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 AND Mtr2HomeComplete = 0 AND Mtr1DesVelZero=0 AND Mtr2DesVelZero=0 AND Mtr1InPos=0 AND Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile DummyProg40=1 ENDIF IF(M120=1 AND M220=0 AND DummyProg40=0) ;HMFL av B og på X? I123=-5 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL av B I7213=0 //Velger triggesignal (HMFL) B I223=5 //HOME-hastighetX I226=1000 //HOME offsetX I7222=3 //Trigger på HMFL av X I7223=0 //Velger triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 AND Mtr2HomeComplete = 0 AND Mtr1DesVelZero=0 AND Mtr2DesVelZero=0 AND Mtr1InPos=0 AND Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile DWELL 5 I223=-5 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL på X I7223=0 //Velg triggesignal (HMFL) X Mtr2HomeComplete=0 CMD"2HM" //HOME-kjøring While (Mtr2HomeComplete = 0 AND Mtr2DesVelZero=0 AND Mtr2InPos=0) //Wait for homing of 2 to finish EndWhile DummyProg40=1 ENDIF IF(M120=0 AND M220=1 AND DummyProg40=0) //HMFL på B og av X? I123=5 //HOME-hastighetB I126=1000 //HOME offsetB I7212=3 //Trigger på HMFL av B I7213=0 //Velger triggesignal (HMFL) B I223=-20 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL av X I7223=0 //Velger triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 AND Mtr2HomeComplete = 0 AND Mtr1DesVelZero=0 AND Mtr2DesVelZero=0 AND Mtr1InPos=0 AND Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile I123=-5 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL på B I7213=0 //Velg triggesignal (HMFL1) B Mtr1HomeComplete=0 CMD"#1HM" //HOME-kjøring While (Mtr1HomeComplete = 0 AND Mtr1DesVelZero=0 AND Mtr1InPos=0 ) //Wait for homing of 1 to finish EndWhile DummyProg40=1 ENDIF RefFerdigX=1 ReferanseBX=0 DummyRefX=0 Disable PLC 4 CLOSE [/code] In order to run this code, you need to use the following commands: [code] DummyProg40=0 Enable PLC 4[/code] to get your homing routine started.
Link to comment
Share on other sites

Sina, Big thanks for taking time to reply on this. I've kind of been thrown right into this so I'm trying to learn it all by fixing occuring problems and adding small functions. I will play around a little with this on one of the machines on Friday, production is running too busy atm. Regards Per
Link to comment
Share on other sites

Per, This morning, I just realized that my logic operators in the while statements where wrong. Please use this one instead: [code] #include "macro_def.PMC" // for following M-variables, use suggested M-variable definitions #define Mtr1HomeComplete M145 #define Mtr2HomeComplete M245 #define Mtr1InPos M140 #define Mtr2InPos M240 #define Mtr1DesVelZero M133 #define Mtr2DesVelZero M233 //PLC replacement for MOTION PROGRAM 41 //REF.KJØRING AKSE BX //---------------------------------- CLOSE DELETE GATHER DELETE TRACE OPEN PLC 4 CLEAR DummyProg40=0 I121=500 I221=500 IF(M120=1 AND M220 =1 AND DummyProg40=0) //HMFL av B og av X? I123=-25 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL på B I7213=0 //;Velg triggesignal (HMFL) B I223=-20 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL på X I7223=0 //Velg triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 OR Mtr2HomeComplete = 0 OR Mtr1DesVelZero=0 OR Mtr2DesVelZero=0 OR Mtr1InPos=0 OR Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile DummyProg40=1 ENDIF IF (M120=0 AND M220=0 AND DummyProg40=0) //HMFL på B og på X? I123=5 //HOME-hastighetB I126=1000 //HOME offsetB I7212=3 //Trigger på HMFL av B I7213=0 //Velger triggesignal (HMFL) B I223=5 //HOME-hastighetX I226=1000 //HOME offsetX I7222=3 //Trigger på HMFL av X I7223=0 //Velger triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 OR Mtr2HomeComplete = 0 OR Mtr1DesVelZero=0 OR Mtr2DesVelZero=0 OR Mtr1InPos=0 OR Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile I123=-5 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL på B I7213=0 //Velg triggesignal (HMFL1) B I223=-5 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL på X I7223=0 //Velg triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 OR Mtr2HomeComplete = 0 OR Mtr1DesVelZero=0 OR Mtr2DesVelZero=0 OR Mtr1InPos=0 OR Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile DummyProg40=1 ENDIF IF(M120=1 AND M220=0 AND DummyProg40=0) ;HMFL av B og på X? I123=-5 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL av B I7213=0 //Velger triggesignal (HMFL) B I223=5 //HOME-hastighetX I226=1000 //HOME offsetX I7222=3 //Trigger på HMFL av X I7223=0 //Velger triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 OR Mtr2HomeComplete = 0 OR Mtr1DesVelZero=0 OR Mtr2DesVelZero=0 OR Mtr1InPos=0 OR Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile I223=-5 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL på X I7223=0 //Velg triggesignal (HMFL) X Mtr2HomeComplete=0 CMD"2HM" //HOME-kjøring While (Mtr2HomeComplete = 0 OR Mtr2DesVelZero=0 OR Mtr2InPos=0) //Wait for homing of 2 to finish EndWhile DummyProg40=1 ENDIF IF(M120=0 AND M220=1 AND DummyProg40=0) //HMFL på B og av X? I123=5 //HOME-hastighetB I126=1000 //HOME offsetB I7212=3 //Trigger på HMFL av B I7213=0 //Velger triggesignal (HMFL) B I223=-20 //HOME-hastighetX I226=0 //HOME offsetX I7222=11 //Trigger på HMFL av X I7223=0 //Velger triggesignal (HMFL) X Mtr1HomeComplete=0 Mtr2HomeComplete=0 CMD"#1HM#2HM" //HOME-kjøring While (Mtr1HomeComplete = 0 OR Mtr2HomeComplete = 0 OR Mtr1DesVelZero=0 OR Mtr2DesVelZero=0 OR Mtr1InPos=0 OR Mtr2InPos=0) //Wait for homing of 1 and 2 to finish EndWhile I123=-5 //HOME-hastighetB I126=0 //HOME offsetB I7212=11 //Trigger på HMFL på B I7213=0 //Velg triggesignal (HMFL1) B Mtr1HomeComplete=0 CMD"#1HM" //HOME-kjøring While (Mtr1HomeComplete = 0 OR Mtr1DesVelZero=0 OR Mtr1InPos=0 ) //Wait for homing of 1 to finish EndWhile DummyProg40=1 ENDIF RefFerdigX=1 ReferanseBX=0 DummyRefX=0 Disable PLC 4 CLOSE [/code]
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...