main() { //exit(99); a=0; do{ hx=gvarget(7391); //monitor axes flags X, Y, Z and C hy=gvarget(7392) ; hz=gvarget(7393); //hc=gvarget(7396); a++; if(a>9){a=1;}; b=hx+hy*10+hz*100; //b=hx+hy*10+hz*100+hc*1000; c=a*10000000; gvarset(99,c+b); //build variable to display which axis is not ready home_old=home; home=hx+hy+hz; //check if any of axis is not ready //home=hx+hy+hz+hc; //check if any of axis is not ready if (home!=0) //if any of axis is not ready, then ... { prg=gvarget(6065); if (prg!=0) //Check if Program running is started and Stop it immediately { gvarset(0xffffff,1); //Stop Program }; gvarset(9100,1); //display the message #1 on the screen, if any of home alarm activated gvarset(8160,2); //set XHC Homing display }else { gvarset(9100,0); //hide the message #1, if everything's ok if (home_old!=home) //just home { gvarset(8160,0); //set XHC Homing display }; }; }while(1); exit(99); };