mycnc:independent_pulse_generator
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
mycnc:independent_pulse_generator [2019/10/03 14:10] – ivan | mycnc:independent_pulse_generator [2020/02/20 08:54] – ivan | ||
---|---|---|---|
Line 51: | Line 51: | ||
The first application we used the Pulse Generator was a Coolant control base on a stepper driver. | The first application we used the Pulse Generator was a Coolant control base on a stepper driver. | ||
- | |||
- | |||
- | === Pulse Generator settings in User Widget === | ||
- | We added Pulse generator settings to a User Widget of " | ||
- | |||
- | |||
- | {{mycnc: | ||
- | |||
- | The programming of Pulse the Coolant widget is shown below. | ||
- | |||
- | " | ||
- | |||
- | <code XML> | ||
- | < | ||
- | | ||
- | | ||
- | |||
- | < | ||
- | </ | ||
- | | ||
- | The lines contain " | ||
- | |||
- | " | ||
- | |||
- | <code XML user-coolant.xml> | ||
- | < | ||
- | <gitem where=" | ||
- | | ||
- | | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | |||
- | <gitem where=" | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | < | ||
- | < | ||
- | </ | ||
- | |||
- | <gitem where=" | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | < | ||
- | < | ||
- | </ | ||
- | |||
- | </ | ||
- | </ | ||
- | |||
- | The code contains 3 parts | ||
- | * the widget label set up | ||
- | * the frequency setup | ||
- | * the Ratio set up | ||
- | |||
- | It's supposed operator no need to change frequency acceleration and this setting is hidden from an operator. | ||
- | The acceleration can be set up in the Software or Hardware PLC for example. | ||
- | |||
=== Pulse Generator settings in the Software PLC === | === Pulse Generator settings in the Software PLC === | ||
The rate, ratio and acceleration can be set up in the Software PLC as well. | The rate, ratio and acceleration can be set up in the Software PLC as well. | ||
- | " | + | " |
<code C HANDLER_INIT.plc> | <code C HANDLER_INIT.plc> | ||
Line 134: | Line 71: | ||
- | ==== (Coolant) Pulse Generator control through Hardware PLC ==== | + | ==== MQL (Coolant) Pulse Generator control through Hardware PLC ==== |
- | Function coolant_motor_start() is addaed | + | Function |
<code C mill-func.h> | <code C mill-func.h> | ||
Line 155: | Line 92: | ||
</ | </ | ||
- | M08.plc procedure which starts the coolant motor would be | + | '' |
<code C M08.plc> | <code C M08.plc> | ||
Line 171: | Line 108: | ||
- | A procedure M09.plc to stop a coolant motor is simpler. Just need to write " | + | A procedure |
<code C M09.plc> | <code C M09.plc> | ||
Line 198: | Line 135: | ||
When utilizing the Hardware PLC, you MUST use the " | When utilizing the Hardware PLC, you MUST use the " | ||
- | **Independent Pulse Generator Spindle implementation example** | + | ===Independent Pulse Generator Spindle implementation example=== |
1. Add the code that enables the generator into the Hardware PLC procedure M03.plc (spindle ON procedure). It is convenient to add code to the end of the procedure before the exit(99); line. | 1. Add the code that enables the generator into the Hardware PLC procedure M03.plc (spindle ON procedure). It is convenient to add code to the end of the procedure before the exit(99); line. | ||
Line 243: | Line 180: | ||
exit (99); // normal exit | exit (99); // normal exit | ||
</ | </ | ||
+ | |||
+ | |||
+ | {{plc: | ||
+ | |||
+ | {{plc: | ||
+ | |||
+ | {{plc: | ||
In this implementation, | In this implementation, | ||
Line 254: | Line 198: | ||
</ | </ | ||
- | In this example, we are assuming that the speed of a conventional spindle is 24,000 rpm. This value, respectively, | + | In this example, we are assuming that the speed of a conventional spindle is 24,000 rpm. This value, respectively, |
- | When calling the PLC procedures for turning ON the spindle (M03.plc) and changing the spindle speed (SPN.plc), the spindle speed value is stored in the **eparam** variable. | + | {{plc: |
+ | |||
+ | At this spindle speed, a full 10V signal must be sent to the analog output, so the " | ||
+ | |||
+ | When calling the PLC procedures for turning ON the spindle (M03.plc) and changing the spindle speed (SPN.plc), the spindle speed value is stored in the **eparam** variable. | ||
myCNC controllers have 12-bit registers for PWM and DAC at 0-10V.This means that with a maximum spindle speed of **24000 rpm** and a factor of **1**, the '' | myCNC controllers have 12-bit registers for PWM and DAC at 0-10V.This means that with a maximum spindle speed of **24000 rpm** and a factor of **1**, the '' | ||
Line 262: | Line 210: | ||
Assume that the maximum servo spindle speed is 4,500 rpm. Then the '' | Assume that the maximum servo spindle speed is 4,500 rpm. Then the '' | ||
- | < | + | < |
The Pulse-Dir input of the servo spindle is set to 10,000 pulses, i.e. the motor shaft will make a full revolution every 10,000 pulses. Then, to achieve a full speed of 4500 rpm, the following pulse rate is required: | The Pulse-Dir input of the servo spindle is set to 10,000 pulses, i.e. the motor shaft will make a full revolution every 10,000 pulses. Then, to achieve a full speed of 4500 rpm, the following pulse rate is required: | ||
- | < | + | < |
- | + | ||
- | The register RAW value for 750kHz (750,000Hz) should be | + | |
- | < | + | The register RAW value for 750kHz (750,000Hz) will therefore be calculated as follows: |
- | If the maximum speed corresponds to the '' | + | < |
- | < | + | If the maximum speed corresponds to the '' |
- | By setting these values in the M03.plc and SPN.plc procedures, we obtain the generation of the required 750 kHz frequency when the spindle speed is set to 4500, as well as smooth frequency control over the entire range from 0 to 4500 rpm. | + | < |
+ | By setting these values in the M03.plc and SPN.plc procedures, we will generate the required 750 kHz frequency when the spindle speed is set to 4500, as well as smooth frequency control over the entire range from 0 to 4500 rpm. | ||
- | **A method for evaluating the required acceleration of a generator** | ||
- | The unit of the generator Acceleration task in a very rough approximation is 1 impulse / s2. | + | ===A method for evaluating the required acceleration |
- | This means that with such an acceleration, | + | |
- | If, in our case, the maximum frequency is 750,000, then the acceleration must be equal to the same value in order to “accelerate” to this frequency in 1 second. | + | One unit of the generator acceleration is, by a very rough approximation, |
- | **Test code for spindle start-up and spindle speed adjustment procedures**: | + | ===Test code for spindle start-up and spindle speed adjustment procedures=== |
<code C M03.plc> | <code C M03.plc> | ||
Line 319: | Line 264: | ||
- | gvarset(8131, | + | gvarset(8131, |
k=671223; | k=671223; | ||
freq=val*k; //calculate the RAW frequency | freq=val*k; //calculate the RAW frequency | ||
if (freq> | if (freq> | ||
- | gvarset(8130, | + | gvarset(8130, |
- | //delay after spindle | + | //delay after the spindle |
timer=spindle_on_delay; | timer=spindle_on_delay; | ||
- | do{timer--; | + | do{timer--; |
exit(99); | exit(99); | ||
Line 336: | Line 281: | ||
<code C SPN.plc> | <code C SPN.plc> | ||
#include vars.h | #include vars.h | ||
- | //set Spindle | + | //set the Spindle |
main() | main() | ||
{ | { | ||
Line 349: | Line 294: | ||
{ | { | ||
k=671223; | k=671223; | ||
- | freq=val*k; //calculate the RAW frequency | + | freq=val*k; //calculate the RAW frequency |
if (freq> | if (freq> | ||
gvarset(8130, | gvarset(8130, | ||
Line 361: | Line 306: | ||
==== Low level CNC registers to control independent pulse generator ==== | ==== Low level CNC registers to control independent pulse generator ==== | ||
- | This is for records only. Users don't have to use low-level access. | + | This is for records only. Users don't have to utilize these settings which can be altered only by having |
^ Register Name ^ Address ^ Description ^ | ^ Register Name ^ Address ^ Description ^ |
mycnc/independent_pulse_generator.txt · Last modified: 2022/02/11 15:45 by ivan