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 :)