examples:plasma-x1366l
Lathe Profile developing blog
- m5_turning_func.h
check_m5_encoder() { count=200; do { a=gvarget(9048+enumber); //Encoder; 9048+enumber timer=5; do { timer--; } while (timer>0); b=gvarget(9048+enumber); //Encoder; 9048+enumber if (a==b) { count=0; }; } while (count>0); }; m19_encoder_stop() { timer=0; timeout=timer+3000; do { timer++; a=gvarget(9048+enumber); //Enc Position relative to Z-label if (a<0) {a+=emax;}; delta=a-stop_position; if (delta<eposition) { m=0-eposition; if (delta>m) { timer=timeout+1; }; }; } while (timer<timeout); };
- m5_turning_et10_func.h
m5_et10() { pwm02=0; speed=0; channel=2; message=PLCCMD_SET_CNC_EXTVAR; command=0x32; parameter=1988+speed+(channel<<12); timer=10;do{timer--;}while(timer>0); }; et10_slow_speed() { speed=200; channel=2; message=PLCCMD_SET_CNC_EXTVAR; command=0x32; parameter=1988+speed+(channel<<12); timer=500;do{timer--;}while(timer>0); };
- M05.plc
//Spindle Stop #define command var00 #define parameter var01 #include pins.h #include m5_turning_et10_func.h #include m5_turning_func.h main() { if (gvarget(8265)!=0) //8265 { //modbus_slow_speed(); et10_slow_speed(); enumber=1; //Encoder ID number emax=8192; eposition=20; stop_position=3000; m19_encoder_stop(); }; m5_et10(); //m5_modbus(); proc=plc_proc_idle; check_m5_encoder(); gvarset(7370,0); timer=30;do{timer--;}while (timer>0); //Spindle State exit(99); //normal exit };
- M03.plc
//Turn on Spindle clockwise #include pins.h #include vars.h #include turning_func.h main() { speed=eparam; gvarset(7370,1); timer=30;do{timer--;}while (timer>0); //Spindle State gvarset(7371,eparam); timer=30;do{timer--;}while (timer>0); //Spindle Speed Mirror register //check_shoulder(); proc=plc_proc_spindle; //m3_modbus(); m3_et10(); check_m3_encoder(); exit(99); };
examples/plasma-x1366l.txt · Last modified: 2020/09/11 13:56 by skirillov