Electronic spindle gearbox
- microsprintbuilder
- Offline
- Elite Member
- Posts: 163
- Thank you received: 4
Please Log in or Create an account to join the conversation.
I cannot find the file linuxcnc/src/hal/components.
Why are you looking for it? You can put ebox.comp anywhere convenient, and comp will compile it and move the executable file to the right place.
if
sudo comp --install ebox.comp
sudo apt-get install linuxcnc-dev
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
- Posts: 163
- Thank you received: 4
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
- Posts: 163
- Thank you received: 4
Please Log in or Create an account to join the conversation.
That sounds nice and easy. Can you figure out the changes needed yourself?upon further review I've found that I have a input from the spindle drive that's called slow which pulls to ground when the spindle is slow enough to change gears so the timer is not needed but instead it needs to wait until the slow signal come true.
There are ways, but it might actually be easier to just move the PC nearer to the Internet for an evening.second item is I installed the dev package at the office and have to do a re install of the software at the shop and do not have internet there to just install off the internet. What is your suggestion on the best way to download the files and put them on a disc and install them that way? I know this is off topic but can the gscreen be installed offline as well? Thanks!
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
- Posts: 163
- Thank you received: 4
Please Log in or Create an account to join the conversation.
would I use a if statement or the spindle slow signal from the drive?
That's largely up to you, I think.
Also how would I handle the spindle values in the In file? they are different for each speed range.
You can add your own items to the INI. You can reference those items in the HAL. Or you can put numerical values directly in the HAL.
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
- Posts: 163
- Thank you received: 4
component ebox "electronic gearbox component";
licence "GPL";
pin in bit spindle-slow
pin in bit spindle-on-in;
pin out bit spindle-on-out;
pin in float spindle-speed;
pin out bit relay1;
pin out bit relay2;
pin out bit relay3;
pin out float spindle-gearbox-output-scale
pin out float spindle-gearbox-out-min-limit
pin out float spindle-gearbox-out-max-limit
pin in float spindle-gearbox-low-output-scale
pin in float spindle-gearbox-low-min-limit
pin in float spindle-gearbox-low-max-limit
pin in float spindle-gearbox-mid-output-scale
pin in float spindle-gearbox-mid-min-limit
pin in float spindle-gearbox-mid-max-limit
pin in float spindle-gearbox-hi-output-scale
pin in float spindle-gearbox-hi-min-limit
pin in float spindle-gearbox-hi-max-limit
function _;
;;
FUNCTION(_){
// Only do anything if the spindle speed has changed
if ( absf(spindle_speed - last_speed) < 50) {
spindle_on_out = spindle_on_in
} else {
spindle_on_out=0
if (spindle-slow=0){
wait
} else {
if (spindle_speed >= 2500){
relay1 = 0;
relay 2 = 0;
relay 3 = 1;
spindle-gearbox-output-scale = spindle-gearbox-hi-output-scale
spindle-gearbox-out-min-limit = spindle-gearbox-hi-min-limit
spindle-gearbox-out-max-limit = spindle-gearbox-hi-max-limit
} else if (spindle_speed < 1200) {
relay1 = 1;
relay 2 = 0;
relay 3 = 0;
spindle-gearbox-output-scale = spindle-gearbox-low-output-scale
spindle-gearbox-out-min-limit = spindle-gearbox-low-min-limit
spindle-gearbox-out-max-limit = spindle-gearbox-low-max-limit
} else {
relay1 = 0;
relay 2 = 1;
relay 3 = 0;
spindle-gearbox-output-scale = spindle-gearbox-mid-output-scale
spindle-gearbox-out-min-limit = spindle-gearbox-mid-min-limit
spindle-gearbox-out-max-limit = spindle-gearbox-mid-max-limit
}}}
}
Please Log in or Create an account to join the conversation.
The main problem with the comp is that you can't wait. Execution has to run right through every time or the thread will over-run.
Typically to wait you use the fperiod macro and a counter:
variable timeout;
...
;;
if (condition){
if (timeout > 0){
timeout -= fperiod;
}
else
{
timeout = 10
}
}
...
Please Log in or Create an account to join the conversation.
- microsprintbuilder
- Offline
- Elite Member
- Posts: 163
- Thank you received: 4
I've been writing and testing in classic ladder because that's what I know best and have wrote something like the following. if commanded speed is <=1200 its gear 1 if it's 1200> and < 2500 it's gear 2 and if its >=2500 it's gear 3 then if the commanded gear # different than set gear # stop spindle wait for spindle slow and then set the gear. then wait a second and turn the spindle back on. also somewhere in the mix needs to be if its this gear true these parameters are true. I wrote this in classic ladder to test my theory and it seams to work. I did't impalement it into my machine just ran in ladder changing the values thou.
Please Log in or Create an account to join the conversation.