Hi Tom
Thank you for your help.
My ATC program is working, it returns to last tool position without crashing tools.
now I have an other problem, my ATC carousel uses binary code sensors to select each tool, there are three sensors aligned under the aluminum plate with steel pins to code each tool. and there is one more sensor on the shaft of the motor, i used that for tool number 8,everything works fine exept some tool numbers fails the rotation, depend where is it, I found that when the carousel try to rotate, in some point it clears the rightmost sensor first than the middle one, then the middleone clears first than the leftmost sensor this is ovious for the rotation angle, but the ATC C.program read that changes right away and make the carousel stop before it reach the next postion, so the tool would crash, this is only when the carousel try to start to rotate, it moves just few degrees and stop, and not fails in all positions mostly it works fine, for example from tool 5 to 4, 6 to 4, 7 to 4, 7 to 6 it fails, all depends if the rightmost sensor involves code.
is there some way to disable the sensors for some miliseconds when carousel start to rotate then enable them to catch the next position, or make some code to read first the three sensors clear then read the code, that way when the carousel start rotating ignors sensors until they clear and get new code, i dont know if i axplained well?.
this is my atc C. program
regards.