#include pins.h #include vars.h // g0moveA - start motion: // flags - // bit 0 - absolute programming // bit 1 - machine coordinates // bit 7 - delayed start. // axes mask // bit 0 - X axis; bit 1 - Y axis;bit 2 - Z axis;bit 3 - A axis;bit 4 - B axis;bit 5 - C axis lift_up() { if (proc==plc_proc_spindle) { z1=gvarget(17003); timer=10; do{timer--;}while (timer>0);//wait till motion started z2=gvarget(7020); z2=z2*100; if (absolute==0) { z2=z1+z2; }; z1=z1+100; //add 1mm gap if (z2>z1) { //position coordinate in given axis in 0.01 units (mm) gvarset(7080,speed_z); //set speed g0moveA(1,0x4,z2); //absolute programming; Z axis; timer=300; do{timer--;}while (timer>0); //wait motion started //wait motion stopped do { ex=0; code=gvarget(6060); if (code==0x4d) {ex=1;}; if (code==0x57) {ex=1;}; } while(ex==0); }; }; }; main() { message=PLCCMD_TRIGGER4_ON; timer=2;do{timer--;}while(timer>0); if (absolute!=0) { absolute=1; }; portclr(OUTPUT_MIST); portclr(OUTPUT_FLOOD); gvarset(7372,0);//Reset Mist State timer=30;do{timer--;}while(timer>0); gvarset(7373,0);//Reset Flood State timer=30;do{timer--;}while(timer>0); lift_up(); dac01=0x0; //off DAC output portclr(OUTPUT_SPINDLE); portclr(OUTPUT_CCW_SPINDLE); gvarset(7370,0);//Spindle State gvarset(7371,0);//Spindle Speed Mirror register message=PLCCMD_TRIGGER1_OFF; timer=10;do{timer--;}while(timer>0); proc=plc_proc_idle; exit(99); };