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 revisionBoth sides next revision
plc:motion_commands_from_plc [2020/12/15 09:11] ivanplc:motion_commands_from_plc [2021/11/02 14:02] skirillov
Line 1: Line 1:
 ===== Running Motion (Positioning) commands from PLC ===== ===== Running Motion (Positioning) commands from PLC =====
 +==== Option 1 ====
  
-Motion Controller and PLC running on myCNC controllers as independent tasks in Rral Time multi-tasking environment.+Motion Controller and PLC running on myCNC controllers as independent tasks in Real Time multi-tasking environment.
 There is API to run motion commands from PLC. This features used for wide range of procedures like probing, homing, measure procedures etc.  There is API to run motion commands from PLC. This features used for wide range of procedures like probing, homing, measure procedures etc. 
  
Line 110: Line 111:
  
 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]] )
 +
 +
 +==== Option 2 ====
 +
 +If set bit #13 in axis mask, then Option 2 of the PLC motion command is executed.
 +In this case Control board handle all calculation for the positioning motion itself without the support of myCNC software.
 +The Controller does not need in communicating with the Host PC and the motion started immediately (despite of Option 1, where extra communication with the Host PC leads to an extra delay of about 100-150ms).
 +
 +Недостаток данного метода - значение перемещения необходимо программировать в Pulses, так как контроллер не имеет данных о реальных единицах перемещения.
 +
 +Вспомогательные регистры - 
 +8630 - задание скорости движения в пульсах/сек
 +8631 - задание времени разгона до заданной скорости в мс
 +
 +
 +Пример команды - 
 +  g0moveA(0x01,0x1001,16000);        //absolute programming; Y axis;
 +  0x01 - Абсолютные координаты
 +  0x10001 - bit #13 (0x1000) и маска оси X (0x01)
 +  16000 - координата заданной оси Х в пульсах (например если pulse-per-mm для оси Х - 800, то перемещение в мм будет \\ 1600/800=20мм
 +
 +<code c draw_square>
 +wait_motion_end()
 +{
 +  timer=2; do{timer--;}while (timer>0);  //wait motion started
 +  do 
 +   
 +      ex=0; code=gvarget(6060);
 +      if (code==0x4d) {ex=1;};
 +      if (code==0x57) {ex=1;};
 +    } while(ex==0);
 +};
 +
 +square()
 +{
 +  gvarset(8630,50000); //speed/frequency 50kHz
 +  gvarset(8631,100);   //Time ~ 0.1sec (in milliseconds)
 +
 +  g0moveA(0x01,0x1001,16000);        //absolute programming; Y axis;
 +  wait_motion_end();
 +  g0moveA(0x01,0x1002,16000);        //absolute programming; Y axis;
 +  wait_motion_end();
 +  g0moveA(0x01,0x1001,8000);        //absolute programming; X axis;
 +  wait_motion_end();
 +  g0moveA(0x01,0x1002,8000);        //absolute programming; Y axis;
 +  wait_motion_end();
 +
 +
 +};
 +
 +</code>
 +
 +
  
plc/motion_commands_from_plc.txt · Last modified: 2024/02/21 13:58 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki