User Tools

Site Tools


plc:motion_commands_from_plc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
plc:motion_commands_from_plc [2021/11/02 15:25] ivanplc:motion_commands_from_plc [2024/02/21 13:58] ivan
Line 58: Line 58:
 Example <code c>move_up=10; Example <code c>move_up=10;
 g0moveA(0,4,move_up*100);  //Z axis; g0moveA(0,4,move_up*100);  //Z axis;
-timer=10; do{timer--;}while (timer>0);//wait 10ms , motion should start, motion state will turn to **0**+timer=200; do{timer--;}while (timer>0); 
 + //wait 10ms , motion should start, motion state will turn to **0**
 do{ code=gvarget(6060); } while(code==0); do{ code=gvarget(6060); } while(code==0);
 </code> </code>
Line 83: Line 84:
       gvarset(7080,speed_z);//set speed       gvarset(7080,speed_z);//set speed
       g0moveA(absolute,4,lift_up*100);//absolute programming; Z axis;       g0moveA(absolute,4,lift_up*100);//absolute programming; Z axis;
-      timer=10; do{timer--;}while (timer>0);//wait till motion started+      timer=200; do{timer--;}while (timer>0);//wait till motion started
       do { code=gvarget(6060); } while(code==0);      //wait till motion is stopped       do { code=gvarget(6060); } while(code==0);      //wait till motion is stopped
     };     };
Line 110: Line 111:
 }; };
 </code> </code>
 +
 +:!: **NOTE:** Note the ''proc=plc_proc_idle'' code at the end of the M02 macro. If this line is not present, then the Stop command is not completed, and the system will remain suspended as it waits for the PLC code to complete all operations. As a result, running/restarting the control program will not work correctly. 
  
 First block of this procedure check if spindle currently is O, and **lift_up** variable is positive value and the lift tool up for given value set in plc-variables.xml configuration file. For those who don't need this lifting can remove the lines and rebuild PLC (see rebuild buttons in [[plc:plc_builder|PLC Builder interface]] ) First block of this procedure check if spindle currently is O, and **lift_up** variable is positive value and the lift tool up for given value set in plc-variables.xml configuration file. For those who don't need this lifting can remove the lines and rebuild PLC (see rebuild buttons in [[plc:plc_builder|PLC Builder interface]] )
Line 115: Line 118:
  
 ==== Option 2 ==== ==== Option 2 ====
 +
 +//NOTE: At the time of writing this manual, Option 2 for motion control is available in the Testing branch of myCNC firmware (version 15,050 and above). For firmware update instructions, please consult the manual for your particular controller.//
  
 If bit #13 is set for the axis mask, then Option 2 of the PLC motion command is used (instead of Option 1, described above). In this case the control board itself will handle all calculations necessary for the positioning motion without the support of myCNC software. As a result, the controller does not need to communicate with the Host PC and the movement will be started immediately (unlike Option 1, where extra communication with the Host PC leads to an additional delay of about 100-150ms). If bit #13 is set for the axis mask, then Option 2 of the PLC motion command is used (instead of Option 1, described above). In this case the control board itself will handle all calculations necessary for the positioning motion without the support of myCNC software. As a result, the controller does not need to communicate with the Host PC and the movement will be started immediately (unlike Option 1, where extra communication with the Host PC leads to an additional delay of about 100-150ms).
plc/motion_commands_from_plc.txt · Last modified: 2024/05/13 15:49 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki