#define MAX_X 800 #define MAX_Y 800 main() { do { auto=gvarget(501); //Automatic mode if (auto) { do { rect_not_ready=gvarget(7369); }while(rect_not_ready==0); left_right=1; xmax=gvarget(7350); if (xmax>MAX_X){ left_right=0;}; ymax=gvarget(7351); if (ymax>MAX_Y){ left_right=0;}; gvarset(502,left_right); //502 - shows both sides or single side LR=gvarget(500); if (LR==0) //left { // gvarset(9100,1); //show message #1 //do{ a=portget(11); }while(a==0); //press pedal, port 11 //do{ a=gvarget(6065); }while(a!=0); //press pedal, port 11 // gvarset(9100,0); //clear the message portclr(10);//Vacuum Left OFF portset(9); // portset(11);// portset(22);// // gvarset(9101,1); //show message #2 //do{ a=portget(13); }while(a==0); //press pedal, port 13 // gvarset(9101,0); //убрать portset(10);//Vacuum Left portclr(9); // timer=5; do{ timer--; }while(timer>0); //wait 0.5 seconds while the vacuum is working portclr(11);//выключить упоры portclr(22);// //// //ждать пока УП завершится do{ a=gvarget(6065); }while(a!=0); //wait //// do { do{ a=gvarget(6065); }while(a!=0); //wait for the system to be ready gvarset(100010,54); //Дать код G54 timer=5; do{ timer--; }while(timer>0); //wait 0.5s for the system to switch n=gvarget(5220);//gets the current coordinate system number } while(n!=1); //while the current system is not G54 do{ a=gvarget(6065); }while(a!=0); //wait for the system to be ready gvarset(100001,1); //go to the beginning of the program timer=5; do{ timer--; }while(timer>0); //wait 0.5s do{ a=gvarget(6065); }while(a!=0); //wait for the system to be ready gvarset(100002,1); //start the program }else //right { // gvarset(9110,1); //show message #1 // do{ a=portget(12); }while(a==0); //press pedal, port 11 // gvarset(9110,0); //clear the message portclr(15); //Vacuum Left OFF portset(16); // portset(14); // portset(23); // // gvarset(9111,1); //show message #2 // do{ a=portget(14); }while(a==0); //press pedal, port 13 // gvarset(9111,0); //clear portset(15); //Vacuum Left portclr(16); // timer=5; do{ timer--; }while(timer>0); //wait 0.5 seconds while the vacuum is working portclr(14);// portclr(23);// //// do{ a=gvarget(6065); }while(a!=0); //wait //wait until the control program is finished //// do{ do{ a=gvarget(6065); }while(a!=0); //wait until the program is ready gvarset(100010,55); //assigns G54 coordinate system timer=5; do{ timer--; }while(timer>0); //wait 0.5 seconds while the coordinate system switch is happening n=gvarget(5220);//obtain the current coordinate system number } while(n!=2);//while the system is not G55 do{ a=gvarget(6065); }while(a!=0); //wait while the processor is busy gvarset(100001,1); //return to the beginning of the program timer=5; do{ timer--; }while(timer>0); //wait 0.5 seconds do{ a=gvarget(6065); }while(a!=0); //wait for the system to be ready gvarset(100002,1); //start the program }; timer=20; do{ timer--; }while(timer>0); //3 second pause do{ a=gvarget(6065); }while(a!=0); //wait until the program is complete LR=LR^1; //switch to the other side gvarset(500,LR); };//auto }while(1); exit(99); };