User Tools

Site Tools


mycnc:mql

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
mycnc:mql [2020/02/20 12:50] ivanmycnc:mql [2020/02/20 13:43] ivan
Line 13: Line 13:
 The fine-tuning is done through the built-in PLC procedures, with the setup described in detail in the [[mycnc:independent_pulse_generator|Independent Pulse Generator]] manual.  The fine-tuning is done through the built-in PLC procedures, with the setup described in detail in the [[mycnc:independent_pulse_generator|Independent Pulse Generator]] manual. 
  
 +
 +====MQL Setup in myCNC software====
 +
 +<code>This section has been copied from the Independent Pulse Generator manual linked above.</code>
 +
 +=== Pulse Generator settings in the Software PLC ===
 +The rate, ratio and acceleration can be set up in the Software PLC, as well as in the User Settings widget (the Step-Dir Coolant Control section). 
 +
 +"HANDLER_INIT.plc" procedure is started just after the configuration is sent to the myCNC controller. A few lines to set up the Frequency generator can be added there.
 +
 +++++ Show HANDLER_INIT code |
 +<code C HANDLER_INIT.plc>
 +main()
 + {
 + gvarset(60000,1);//run Servo ON procedure
 +
 + gvarset(8131, 8000); //set Frequency acceleration
 + gvarset(8132, 1359); //set Ratio
 + gvarset(8133, 0);    //Off the Generator.
 +
 + exit(99);
 +};
 +</code>
 +++++
 +
 +=== Pulse Generator settings in Hardware PLC ===
 +
 +Function ''coolant_motor_start()'' is added to the ''mill-func.h'' file:
 +
 +++++ Show mill-func.h code |
 +<code C mill-func.h>
 +coolant_motor_start()
 +{
 +  timer=10;do{timer--;}while(timer>0);
 +
 +  gvarset(8131,1000000); //acceleration
 +  timer=10;do{timer--;}while(timer>0);
 +
 +  x=gvarget(8133);//get the speed (frequency)
 +  k=gvarget(8132);//get the ratio
 +
 +  x=x*k; //calculate the RAW frequency
 +  gvarset(8130,x); //send the raw frequency to the register
 +  timer=30;do{timer--;}while(timer>0); //wait a time for the frequency value to be delivered
 +};
 +</code>
 +++++
 +
 +''M08.plc'' procedure which starts the coolant motor would be the following (//note the inclusion of mill-func.h at the beginning of the code//):
 +
 +++++ Show M08 code |
 +<code C M08.plc>
 +#include pins.h
 +#include mill-func.h
 +
 +main()
 +{
 +  gvarset(7372,1);
 +  portset(OUTPUT_FLOOD); //
 +  coolant_motor_start();
 +  exit(99); //normal exit 
 +};
 +</code>
 +++++
 +
 +A procedure ''M09.plc'' to stop a coolant motor is simpler - we simply need to write "0" to the raw frequency register.
 +
 +++++ Show M09 code |
 +<code C M09.plc>
 +#include pins.h
 +main()
 +{
 +  gvarset(7373,0);
 +  gvarset(7372,0);
 +
 +  portclr(OUTPUT_FLOOD);
 +  portclr(OUTPUT_MIST);
 +
 +  gvarset(8130,0); //stop the pulse generator
 +  timer=30;do{timer--;}while(timer>0); //wait a time for the frequency value to be delivered
 +  exit(99); //normal exit 
 +};
 +
 +</code>
 +++++
 +
 +This concludes the software setup for MQL within the myCNC software.
  
mycnc/mql.txt · Last modified: 2020/10/08 11:37 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki