4 bit parallel ADC for spindle gear control

More
19 Oct 2016 23:08 #81874 by skunkworks
Yes - you command a spindle speed and it selects the correct gear. The other thing that happens is if you use the Spindle override - it doesn't shift gears.. (you would not want the spindle to stop and shift gears as it is cutting) it works well

sam
The following user(s) said Thank You: johnmc

Please Log in or Create an account to join the conversation.

More
19 Oct 2016 23:37 #81876 by andypugh
Here is my version of the comp. It almost certainly needs to change to suit your exact requirements.
component gearshift "A component to operate an electronically controlled gearbox";
pin in float max-speed-##[32:personality] "The maximum speed in each gear";
pin in u32 bits-## [32:personality] "The pattern of output bits to set for the corresponding gear";
pin out bit gear-select-# [5] "The individual clutch outputs";
pin in float spindle-speed-in "The spindle speed command";
pin in bit spindle-ctrl-in "The spindle-is-on signal from motion";
pin out bit spindle-ctrl-out "The spindle-is-on signal passed to the motor";
pin out unsigned gear "The currently-selected gear";
option personality yes;

function _;

license "GPL";
author "andy pugh";

;;

FUNCTION(_){
    static int state = 0;

    switch (state) {
    case 0: // Idle
        if (spindle_speed_in > 0){
            state = 1;
        }
        break;
    case 1: // setting outputs
        for (gear = 0; spindle_speed_in > max_speed(gear) && gear < personality; gear++){
            rtapi_print("gear = %i max = %f\n", gear, max_speed(gear));
        }
        gear_select(0) = (bits(gear) & 0x01);
        gear_select(1) = (bits(gear) & 0x02);
        gear_select(2) = (bits(gear) & 0x04);
        gear_select(3) = (bits(gear) & 0x08);
        gear_select(4) = (bits(gear) & 0x10);
        state = 2;
    case 2: // wait for spindle on
        if (spindle_ctrl_in == 0) return;
        state = 3;
        break;
    case 3: // waiting for spindle-off to allow gearchange
        spindle_ctrl_out = spindle_ctrl_in;
        if (spindle_ctrl_in == 0){
            gear_select(0) = 0;
            gear_select(1) = 0;
            gear_select(2) = 0;
            gear_select(3) = 0;
            gear_select(4) = 0;
            gear = 0;
            state = 0;
        }
        break;
    }
}

You need to install it with the command
sudo halcompile --install gearshift.comp
More details on halcompile here: linuxcnc.org/docs/2.7/html/hal/comp.html
Attachments:

Please Log in or Create an account to join the conversation.

More
20 Oct 2016 12:18 #81889 by johnmc
Good day Andy
Many thanks for your information on gearshift control component.
At least the pathway has a very dim light shining, and it will be like eating a elephant, one bite at a time.
Cheers john

On another matter I get no notification of replies to this topic, and find your replies on forum site.?

Please Log in or Create an account to join the conversation.

More
20 Oct 2016 14:07 #81890 by andypugh
I get notifications, so it seems to still be working.
Perhaps the forum has the wrong email address, or it is falling into a spam trap?

Please Log in or Create an account to join the conversation.

Time to create page: 0.998 seconds
Powered by Kunena Forum