#include pins.h #include vars.h main() { portset(OUTPUT_DRILL_VALVE); portset(OUTPUT_DRILL_POWER); gvarset(7080,drill_probe_speed ); //set speed; timer=200;do{timer--;}while(timer>0); //wait till drill head down sens=portget(INPUT_DRILL); if (sens==0) { g0moveA(0x0,0x4,0-30000); //Z axis timer=200;do{timer--;}while(timer>0); //wait till motion started do{ code=gvarget(6060); sens=portget(INPUT_DRILL); if (sens!=0) { code=1; message=PLCCMD_LINE_STOP;//skip line }; }while (code==0); do { code=gvarget(6060); }while(code!=0x4d); //wait till motion finished }; gvarset(7080,drill_speed);//set speed; if (drill_depth>50) { depth=0-drill_depth; g0moveA(0x0,0x4,depth); //Z axis timer=200;do{timer--;}while(timer>0); //wait till motion started do{code=gvarget(6060);}while(code!=0x4d);//wait till motion finished }; gvarset(7080,1000);//set speed up; if (drill_lift_height<100) { drill_lift_height=100; }; g0moveA(0x0,0x4,drill_lift_height); //drill head lift height timer=200;do{timer--;}while(timer>0); //wait till motion started do { code=gvarget(6060); }while(code!=0x4d); //wait till motion finished portclr(OUTPUT_DRILL_VALVE); portclr(OUTPUT_DRILL_POWER); exit(99); };