#include pins.h // Look after INPUT_GANTRY_S1 & INPUT_GANTRY_S2 input pins // Position Y is stored in register #801 when sensor s1 is triggered // Position Y is stored in register #802 when sensor s2 is triggered // If both sensors triggered, then // - Motion stopped // - Position difference is calculated and stored into register #800 main() { timer=0; message=PLCCMD_MOTION_CONTINUE; texit=timer+30;do{timer++;}while(timer0); gvarset(801,position1); //send the position to myCNC software Register #801 timer=50;do{timer--;}while(timer>0); gvarset(802,position2); //send the position to myCNC software Register #802 timer=50;do{timer--;}while(timer>0); offset=position1-position2; gvarset(800,offset); timer=50;do{timer--;}while(timer>0); exit(99); };