Newbie PID advice on a retrofit BenchmanXT - Page 4


Page 4 of 5 FirstFirst 12345 LastLast
Results 37 to 48 of 56

Thread: PID advice on a retrofit BenchmanXT

  1. #37
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    I understood how the SSO worked but whenever I launched a g-code file, the spindle wouldn't start up. If I slightly turned the SSO pot, the spindle would suddenly start and spin at speed. I finally came up with a work around if not the actual solution. I'm using SheetCAM and the EMC post processor seems to give me everything the way KMotionCNC needs to run. The code issues" M03 S2000" and then does a Z down and X and Y movement. So I'm ordering clockwise spindle rotation at 2000 RPM. It turns out that I have to issue an additional M03. So my code is M03 S2000 and the next line is M03 and then the program continues. This works so I'm not going to argue with it. I modified the Post Processor so this shouldn't be a problem again.
    I still have the issue of overrunning the spindle speed. I have yet to find where the SSO is actually applied to the Speed as a multiplier. I also still have the issue of the axis treating the spindle rotation as if it is going to a destination and eventually running out of space as if it has found it's travel limit. I need to solve these problems but at least for the moment, neither is preventing me from cutting test pieces. My first thought on the spindle travel problem is to increase the travel limit somehow. Any thought on either of these two problems?

    Thanks again

    Steve



  2. #38
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2330
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    So my code is M03 S2000 and the next line is M03 and then the program continues. This works so I'm not going to argue with it. I modified the Post Processor so this shouldn't be a problem again.
    Strange

    I still have the issue of overrunning the spindle speed. I have yet to find where the SSO is actually applied to the Speed as a multiplier.
    Please post your current Init Program (with the SSO stuff), S Program, and M3 programs so we can review them.

    I also still have the issue of the axis treating the spindle rotation as if it is going to a destination and eventually running out of space as if it has found it's travel limit.
    Not sure what you mean by this. It might be that you need to set the SoftLimits to infinity (ie +1e30 and -1e30).

    Regards

    TK
    http://dynomotion.com


  3. #39
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    Here are the files : The Init

    #include "KMotionDef.h"


    #define POWERON 142
    #define POWEROFF 143
    #define ESTOP 136
    #define HALTBIT 137
    //#define RESTARTBIT 28
    //#define ZEROALLBIT 29
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"

    #define CHANGE_TOL 0.02 // only update if change is more than this
    #define CHANGE_TIME 0.05 // don't update more often then this time


    ClearBit(144); //disable power


    // function prototypes for compiler
    int DoPC(int cmd);
    int DoPCFloat(int cmd, float f);
    int Debounce(int n, int *cnt, int *last, int *lastsolid);

    // state variables for switch debouncing
    int flast=0,flastsolid=-1,fcount=0;
    int clast=0,clastsolid=-1,ccount=0;
    int elast=0,elastsolid=-1,ecount=0;
    int hlast=0,hlastsolid=-1,hcount=0;
    //int rlast=0,rlastsolid=-1,rcount=0;
    //int zlast=0,zlastsolid=-1,zcount=0;
    double LastFRO=-1;
    double LastFROTime=0;

    double LastSSO = -1;
    double LastSSOTime = 0;
    double SSO = 1.000000;
    double T;




    void ButtonService(void);
    void PotService(void);


    main()
    {
    int BitA,Change1=0,Change2=0, DiffX2;
    int PosNoWrap, NewPos, Pos=0, wraps;

    //SetBit(152);
    //SetBit(157);
    //SetBit(158);

    ClearBit(159); //disable spindle

    ch0->InputMode=ENCODER_MODE;
    ch0->OutputMode=DAC_SERVO_MODE;
    ch0->Vel=272500;
    ch0->Accel=460000;
    ch0->Jerk=7.5e+006;
    ch0->P=13;
    ch0->I=0.01;
    ch0->D=90;
    ch0->FFAccel=0;
    ch0->FFVel=0;
    ch0->MaxI=2000;
    ch0->MaxErr=1e+006;
    ch0->MaxOutput=2000;
    ch0->DeadBandGain=1;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=0;
    ch0->OutputChan0=0;
    ch0->OutputChan1=1;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x100;
    ch0->LimitSwitchNegBit=0;
    ch0->LimitSwitchPosBit=0;
    ch0->SoftLimitPos=1e+030;
    ch0->SoftLimitNeg=-1e+030;
    ch0->InputGain0=1;
    ch0->InputGain1=1;
    ch0->InputOffset0=0;
    ch0->InputOffset1=0;
    ch0->OutputGain=-1;
    ch0->OutputOffset=0;
    ch0->SlaveGain=1;
    ch0->BacklashMode=BACKLASH_OFF;
    ch0->BacklashAmount=0;
    ch0->BacklashRate=0;
    ch0->invDistPerCycle=1;
    ch0->Lead=0;
    ch0->MaxFollowingError=1000000000;
    ch0->StepperAmplitude=20;

    ch0->iir[0].B0=1;
    ch0->iir[0].B1=0;
    ch0->iir[0].B2=0;
    ch0->iir[0].A1=0;
    ch0->iir[0].A2=0;

    ch0->iir[1].B0=1;
    ch0->iir[1].B1=0;
    ch0->iir[1].B2=0;
    ch0->iir[1].A1=0;
    ch0->iir[1].A2=0;

    ch0->iir[2].B0=0.056605;
    ch0->iir[2].B1=0.11321;
    ch0->iir[2].B2=0.056605;
    ch0->iir[2].A1=1.22804;
    ch0->iir[2].A2=-0.454462;

    ch1->InputMode=ENCODER_MODE;
    ch1->OutputMode=DAC_SERVO_MODE;
    ch1->Vel=272500;
    ch1->Accel=460000;
    ch1->Jerk=7.5e+006;
    ch1->P=13;
    ch1->I=0.006;
    ch1->D=110;
    ch1->FFAccel=0;
    ch1->FFVel=0;
    ch1->MaxI=20;
    ch1->MaxErr=1e+006;
    ch1->MaxOutput=2400;
    ch1->DeadBandGain=1;
    ch1->DeadBandRange=0;
    ch1->InputChan0=1;
    ch1->InputChan1=0;
    ch1->OutputChan0=1;
    ch1->OutputChan1=0;
    ch1->MasterAxis=-1;
    ch1->LimitSwitchOptions=0x100;
    ch1->LimitSwitchNegBit=0;
    ch1->LimitSwitchPosBit=0;
    ch1->SoftLimitPos=1e+030;
    ch1->SoftLimitNeg=-1e+030;
    ch1->InputGain0=1;
    ch1->InputGain1=1;
    ch1->InputOffset0=0;
    ch1->InputOffset1=0;
    ch1->OutputGain=-1;
    ch1->OutputOffset=0;
    ch1->SlaveGain=1;
    ch1->BacklashMode=BACKLASH_OFF;
    ch1->BacklashAmount=0;
    ch1->BacklashRate=0;
    ch1->invDistPerCycle=1;
    ch1->Lead=0;
    ch1->MaxFollowingError=1000000000;
    ch1->StepperAmplitude=20;

    ch1->iir[0].B0=1;
    ch1->iir[0].B1=0;
    ch1->iir[0].B2=0;
    ch1->iir[0].A1=0;
    ch1->iir[0].A2=0;

    ch1->iir[1].B0=1;
    ch1->iir[1].B1=0;
    ch1->iir[1].B2=0;
    ch1->iir[1].A1=0;
    ch1->iir[1].A2=0;

    ch1->iir[2].B0=0.056605;
    ch1->iir[2].B1=0.11321;
    ch1->iir[2].B2=0.056605;
    ch1->iir[2].A1=1.22804;
    ch1->iir[2].A2=-0.454462;

    ch2->InputMode=ENCODER_MODE;
    ch2->OutputMode=DAC_SERVO_MODE;
    ch2->Vel=200000;
    ch2->Accel=600000;
    ch2->Jerk=500000;
    ch2->P=17;
    ch2->I=0.001;
    ch2->D=140;
    ch2->FFAccel=0;
    ch2->FFVel=0;
    ch2->MaxI=2000;
    ch2->MaxErr=1e+006;
    ch2->MaxOutput=2000;
    ch2->DeadBandGain=1;
    ch2->DeadBandRange=0;
    ch2->InputChan0=2;
    ch2->InputChan1=0;
    ch2->OutputChan0=2;
    ch2->OutputChan1=0;
    ch2->MasterAxis=-1;
    ch2->LimitSwitchOptions=0x100;
    ch2->LimitSwitchNegBit=0;
    ch2->LimitSwitchPosBit=0;
    ch2->SoftLimitPos=1e+009;
    ch2->SoftLimitNeg=-1e+009;
    ch2->InputGain0=1;
    ch2->InputGain1=1;
    ch2->InputOffset0=0;
    ch2->InputOffset1=0;
    ch2->OutputGain=-1;
    ch2->OutputOffset=0;
    ch2->SlaveGain=1;
    ch2->BacklashMode=BACKLASH_OFF;
    ch2->BacklashAmount=0;
    ch2->BacklashRate=0;
    ch2->invDistPerCycle=1;
    ch2->Lead=0;
    ch2->MaxFollowingError=1000000000;
    ch2->StepperAmplitude=20;

    ch2->iir[0].B0=1;
    ch2->iir[0].B1=0;
    ch2->iir[0].B2=0;
    ch2->iir[0].A1=0;
    ch2->iir[0].A2=0;

    ch2->iir[1].B0=1;
    ch2->iir[1].B1=0;
    ch2->iir[1].B2=0;
    ch2->iir[1].A1=0;
    ch2->iir[1].A2=0;

    ch2->iir[2].B0=0.056605;
    ch2->iir[2].B1=0.11321;
    ch2->iir[2].B2=0.056605;
    ch2->iir[2].A1=1.22804;
    ch2->iir[2].A2=-0.454462;

    ch7->InputMode=ENCODER_MODE;
    ch7->OutputMode=DAC_SERVO_MODE;
    ch7->Vel=1e+006;
    ch7->Accel=250000;
    ch7->Jerk=7e+006;
    ch7->P=6;
    ch7->I=0.0015;
    ch7->D=800;
    ch7->FFAccel=0;
    ch7->FFVel=0;
    ch7->MaxI=1000;
    ch7->MaxErr=1e+010;
    ch7->MaxOutput=2047;
    ch7->DeadBandGain=1;
    ch7->DeadBandRange=0;
    ch7->InputChan0=7;
    ch7->InputChan1=1;
    ch7->OutputChan0=7;
    ch7->OutputChan1=1;
    ch7->MasterAxis=-1;
    ch7->LimitSwitchOptions=0x100;
    ch7->LimitSwitchNegBit=0;
    ch7->LimitSwitchPosBit=0;
    ch7->SoftLimitPos=1e+030;
    ch7->SoftLimitNeg=-1e+030;
    ch7->InputGain0=1;
    ch7->InputGain1=1;
    ch7->InputOffset0=0;
    ch7->InputOffset1=0;
    ch7->OutputGain=1;
    ch7->OutputOffset=0;
    ch7->SlaveGain=1;
    ch7->BacklashMode=BACKLASH_OFF;
    ch7->BacklashAmount=0;
    ch7->BacklashRate=0;
    ch7->invDistPerCycle=1;
    ch7->Lead=0;
    ch7->MaxFollowingError=10000000;
    ch7->StepperAmplitude=250;

    ch7->iir[0].B0=1;
    ch7->iir[0].B1=0;
    ch7->iir[0].B2=0;
    ch7->iir[0].A1=0;
    ch7->iir[0].A2=0;

    ch7->iir[1].B0=1;
    ch7->iir[1].B1=0;
    ch7->iir[1].B2=0;
    ch7->iir[1].A1=0;
    ch7->iir[1].A2=0;

    ch7->iir[2].B0=1;
    ch7->iir[2].B1=0;
    ch7->iir[2].B2=0;
    ch7->iir[2].A1=0;
    ch7->iir[2].A2=0;


    EnableAxis(0);
    EnableAxis(1);
    EnableAxis(2);
    EnableAxis(7);


    SetBit(158); // release z axis brake
    SetBit(159); //enable VFD spindle contoller


    DefineCoordSystem(0,1,2,-1);

    T = WaitNextTimeSlice();
    DoPCFloat(PC_COMM_SET_SSO,SSO);
    LastSSO=SSO;
    //printf("SSO = %f\n",SSO);
    LastSSOTime=T;

    for (; // loop forever

    {
    ButtonService();
    PotService();
    }


    }



    void ButtonService()

    {
    int result;


    {


    // Handle Power On Button
    result = Debounce(ReadBit(POWERON),&fcount,&flast,&flastsolid);
    if (result == 1)
    {
    SetBit (144);
    }



    // Handle Power off Button
    result = Debounce(ReadBit(POWEROFF),&ccount,&clast,&clastsolid);
    if (result == 0)
    {

    ClearBit(144); //disable power
    }



    // Handle ESTOP
    result = Debounce(ReadBit(ESTOP),&ecount,&elast,&elastsolid);
    if (result == 0)
    {
    if (ch0->Enable) DisableAxis(0); // axis still enabled? - Disable it
    if (ch1->Enable) DisableAxis(1); // axis still enabled? - Disable it
    if (ch2->Enable) DisableAxis(2); // axis still enabled? - Disable it
    if (ch7->Enable) DisableAxis(7); // axis still enabled? - Disable it
    ClearBit(158);

    //DoPC(PC_COMM_ESTOP);
    }

    // Handle HALT
    result = Debounce(ReadBit(HALTBIT),&hcount,&hlast,&hlastsolid);
    if (result == 1)
    {
    //DoPC(PC_COMM_HALT);
    SetBit(155);
    }
    else if (result == 0)
    {
    ClearBit(155);
    }

    /*
    // Handle RESTART
    result = Debounce(ReadBit(RESTARTBIT),&rcount,&rlast,&rlastsolid);
    if (result == 1)
    {
    DoPC(PC_COMM_RESTART);
    }


    */
    /*
    // Handle ZERO ALL
    result = Debounce(ReadBit(ZEROALLBIT),&zcount,&zlast,&zlastsolid);
    if (result == 1)
    {
    DoPCFloat(PC_COMM_SET_X,0.0);
    DoPCFloat(PC_COMM_SET_Y,0.0);
    DoPCFloat(PC_COMM_SET_Z,0.0);
    }

    */
    }
    }

    // Put a Float as a parameter and pass the command to the App
    int DoPCFloat(int cmd, float f)
    {
    int result;
    persist.UserData[PC_COMM_PERSIST+1] = *(int*)&f;
    return DoPC(cmd);
    }


    // Pass a command to the PC and wait for it to handshake
    // that it was received by either clearing the command
    // or changing it to a negative error code
    int DoPC(int cmd)
    {
    int result;

    persist.UserData[PC_COMM_PERSIST]=cmd;

    do
    {
    WaitNextTimeSlice();
    }while (result=persist.UserData[PC_COMM_PERSIST]>0);

    printf("Result = %d\n",result);

    return result;
    }




    // Debounce a bit
    //
    // return 1 one time when first debounced high
    // return 0 one time when first debounced low
    // return -1 otherwise
    #define DBTIME 300

    int Debounce(int n, int *cnt, int *last, int *lastsolid)
    {
    int v = -1;

    if (n == *last) // same as last time?
    {
    if (*cnt == DBTIME-1)
    {
    if (n != *lastsolid)
    {
    v = *lastsolid = n; // return debounced value
    }
    }
    if (*cnt < DBTIME) (*cnt)++;
    }
    else
    {
    *cnt = 0; // reset count
    }
    *last = n;
    return v;
    }


    PotService(void)
    {

    double Factor=0;
    double Pot,Pot1,FRO,SSO,T;


    T = WaitNextTimeSlice();


    // assume 5V range where 2.5V is nominal FRO
    Pot=KANALOG_CONVERT_ADC_TO_VOLTS(ADC(0)) - 2.5;
    Pot1=KANALOG_CONVERT_ADC_TO_VOLTS(ADC(1)) - 2.5;
    FRO = Pot*0.5+1.0;
    SSO = Pot1*0.5+1.0;

    // send message to KMotionCNC if the pot changed significantly
    // and it has been a while since the last message
    if ((FRO > LastFRO+CHANGE_TOL || FRO < LastFRO-CHANGE_TOL) &&
    T > LastFROTime+CHANGE_TIME)
    {
    // printf("FRO = %f\n",FRO);
    DoPCFloat(PC_COMM_SET_FRO,FRO);
    LastFRO=FRO;
    LastFROTime=T;
    }
    if ((SSO > LastSSO+CHANGE_TOL || SSO < LastSSO-CHANGE_TOL) &&
    T > LastSSOTime+CHANGE_TIME)
    {
    // printf("SSO = %f\n",SSO);
    DoPCFloat(PC_COMM_SET_SSO,SSO);
    LastSSO=SSO;
    LastSSOTime=T;
    }
    }


    The S file :


    #include "KMotionDef.h"

    #include "MySpindleDefs.h"

    int *css_mode = &persist.UserData[PC_COMM_CSS_MODE]; // Mode 1=Normal RPM mode. 2=CSS

    // desired speed is passed from KMotionCNC in variable KMVAR
    // save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
    // save in user variable SPEEDVAR the last desired speed

    main()
    {
    float speed = *(float *)&persist.UserData[KMVAR]; // value stored is actually a float
    float LastState = persist.UserData[STATEVAR]; // get last state

    persist.UserData[SPEEDVAR] = persist.UserData[KMVAR]; // Always save the last desired speed

    if (LastState==0 || *css_mode == 2)
    {
    // if spindle is off (or CSS mode) and User Changes the speed
    // just save the desired speed

    return 0;
    }

    // spindle is already on, so ramp to new speed
    if (USE_POS_NEG_VOLTAGE)
    Jog(SPINDLEAXIS,speed * FACTOR * LastState);
    else
    Jog(SPINDLEAXIS,speed * FACTOR);

    printf("Jogging Spindle %f counts/sec\n",speed * FACTOR);
    }

    The Jog File... It's unaltered as is the spindlejog file :


    #include "KMotionDef.h"

    #include "MySpindleDefs.h"

    int *css_mode = &persist.UserData[PC_COMM_CSS_MODE]; // Mode 1=Normal RPM mode. 2=CSS

    // desired speed is passed from KMotionCNC in variable KMVAR
    // save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
    // save in user variable SPEEDVAR the last desired speed

    main()
    {
    float speed = *(float *)&persist.UserData[SPEEDVAR]; // value stored is actually a float
    float LastState = persist.UserData[STATEVAR]; // get last state

    if (LastState==-1)
    {
    // if spindle was CCW now we want CW
    // spin down

    //ClearBit(SPINDLECW_BIT);
    //ClearBit(SPINDLECCW_BIT);
    Jog(SPINDLEAXIS,0);
    while (!CheckDone(SPINDLEAXIS)) ;
    }

    // turn spindle on CW and ramp to new speed
    SetBit(SPINDLECW_BIT);

    if (*css_mode != 2)
    {
    // spindle is already on, so ramp to new speed
    if (USE_POS_NEG_VOLTAGE)
    Jog(SPINDLEAXIS,speed * FACTOR * LastState);
    else
    Jog(SPINDLEAXIS,speed * FACTOR);
    printf("Jogging Spindle %f counts/sec\n",speed * FACTOR);
    }
    persist.UserData[STATEVAR] = 1; // remember we are CW
    }

    Steve



  4. #40
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2330
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    I don't see anything obvious.

    In the future pleas attach the programs as files (with a .c.txt extension). Pasting in causes all the formatting to be lost and parenthesis change to smiley faces.

    More questions :

    #1 Please include your modified MySpindelDef.h file.

    #2 Please tell us where each of the 4 files are located on your system.

    #3 Include a screen shot of your Tool Setup | M0-M30 page so we can see how the data for these programs is being passed.

    #4 did you change the Spindle Soft Limits to 1e30 and -1e30? Or were they that way before? Are you still getting Soft Limit Errors on the Spindle Axis 7?

    #5 how does your Spindle work? Is there a CW CCW control? Is there an Enable? Is it controlled with a +/-Voltage? Or with Speed and Direction?

    Regards

    TK
    http://dynomotion.com


  5. #41
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    Here are the files. Everything is pretty straight forward. The Spindle is controlled from a +- 10V signal. It is a three phase controlled my an ALLEN BRADLEY 1398-DDM-019 motor controller. I have it set up as a dumb servo and not using the internal PID controller. It passes through the encoder signals so is transparent in that regard. It has a pretty slow response but I've read that is normal for a spindle motor.
    I did change the limits as you suggested and YES! that solved the problem with the limit errors. Having made the CAM change adding the extra M03, I've not had a problem with the spindle not spinning up when the program starts. Next steps are to add Flood and Homing the X, Y and Z axis with series limit switches.
    So far, the Kflop/Kanalog is doing an excellent job. The learning curb has been a bit steep but the goal is to get everything running so a user can operate it with minimal instruction. I am still tidying up the wiring. This unit has an automatic tool changer and getting that to work is icing but I'm feeling pretty good about it right now.

    Thanks
    Steve



  6. #42
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2330
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    I don't see the files. Did you forget to upload them?

    For Homing you might look at the SimpleHomeIndexFunctionTest.c example which uses SimpleHomeIndexFunction.c

    Regards

    TK
    http://dynomotion.com


  7. #43
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,
    I guess I must have angered the thread gods... not sure why the files did not upload. Trying again.
    I looked at the homing routine... looks pretty straight forward. Fingers crossed and I'll give it a try.

    Steve

    Attached Thumbnails Attached Thumbnails PID advice on a retrofit BenchmanXT-toolsetup-jpg   PID advice on a retrofit BenchmanXT-toolfile-png   PID advice on a retrofit BenchmanXT-toolsetupfiles-jpg  
    Attached Files Attached Files


  8. #44
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,
    I'm having fantastic success! I managed to add a relay and get the flood to work so I have accomplished all the goals I had set. I have a couple of questions that I need answered to get this thing ready for the average user. To be able to allow normal operation I have to protect people from themselves. Things like, How do I detect when the unit is running G-Code so I can lock out certain buttons like, unclamp the tool, so that a bored user won't press a button and cause a big problem. So that's one question. What tells me that the kflop/kanalog is running a program? I got homing to work but I want to set soft limits. I need to set soft limits in absolute but allow reference in relative so I can change the origin but retain the absolute limits so that the machine will not run out of limits. I also have to be able to index the spindle for the auto tool changer so the index is a differential signal from the encoder, how do I read an index pulse? I have two buttons on the front panel for Start Cycle and Pause Cycle. I want to be able to press those and get a program run and program pause. I can't find a place to define the buttons so that they cause those actions. Any ideas?
    So those are my current issues: How to know the program is running. How to set soft limits. How to read differential index pulses. How to set Start and Pause cycles on the front panel.
    Thanks!

    Steve



  9. #45
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2330
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    How do I detect when the unit is running G-Code so I can lock out certain buttons like, unclamp the tool, so that a bored user won't press a button and cause a big problem. So that's one question. What tells me that the kflop/kanalog is running a program?
    There is a Macro definition in KFLOP called JOB_ACTIVE. So for example to only allow something when a GCode Job is not running you might code ('!' is the "NOT" operator)

    if (!JOB_ACTIVE)
    {
    ...
    ...
    }


    I got homing to work but I want to set soft limits. I need to set soft limits in absolute but allow reference in relative so I can change the origin but retain the absolute limits so that the machine will not run out of limits
    I'm not sure I understand but the normal procedure is to disable Soft Limits (by setting huge limits) until after Homing is completed


    I also have to be able to index the spindle for the auto tool changer so the index is a differential signal from the encoder, how do I read an index pulse?
    Index Pulses are detected in a software User Program so they can be connected to any spare (in this case differential) input. To index the Spindle (assuming it can move like an Axis) you might Jog it slowly, loop waiting for the Index pulse, then Stop by Jogging to Zero Speed.


    I have two buttons on the front panel for Start Cycle and Pause Cycle. I want to be able to press those and get a program run and program pause. I can't find a place to define the buttons so that they cause those actions. Any ideas?
    You can add a User Program to monitor (and debounce) push button inputs to issue commands. See the ExternalButtons.c Example.

    Regards

    TK
    http://dynomotion.com


  10. #46
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    I'm still making great progress but have not had as much time to devote lately. I have been trying to read as many programs as I can and I am looking for SSO being applied as a multiplier to the spindle speed. I am reading a pot and it is successfully adjusting the SSO. However, I need to know where the SSO is used to multiply the spindle speed set by the g code S command. I need to be able to limit the S x SSO to 4500 RPM. Where does that happen? I just need to set a condition to limit the speed as adjusted by the pot.

    Thanks

    Steve



  11. #47
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2330
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    I'm not exactly sure if this is what you are asking but your Spindle "S" Program will be sent the S x SSO RPM value that should be set. Your Spindle Program could limit the RPM to 4500.

    Regards

    TK
    http://dynomotion.com


  12. #48
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    Great news, I finally figured out the speed control question. I've probably driven you crazy over this and now it seems relatively simple. In the program SpindleJog that is the execfile for the S command. It reads :
    if (USE_POS_NEG_VOLTAGE)
    Jog(SPINDLEAXIS,speed * FACTOR * LastState);
    else
    Jog(SPINDLEAXIS,speed * FACTOR);

    Which I modified to :
    if (USE_POS_NEG_VOLTAGE)
    { if (SPINDLEAXIS,speed > 4000)
    {
    Jog(7,4000 * FACTOR * LastState); // jog spindle which is 7 no more than 4000RPM
    }
    else
    {
    Jog(SPINDLEAXIS,speed * FACTOR * LastState);
    }
    }
    else
    { if (SPINDLEAXIS,speed >4000)
    Jog(7,4000 * FACTOR); // jog spindle which is 7 no more than 4000RPM
    else
    Jog(SPINDLEAXIS,speed * FACTOR);
    }

    To make sure that the Variable potentiometer can never drive the spindle faster than 4000RPM. THAT's what I was trying to limit on the dial. In retrospect it seems simple but I was confused on exactly WHERE I should do that. Now I have two new questions. I have almost run out of sensor inputs and I think I know the answer but I wanted to run this by you. It appears that the 40 pin JP12 connector on the kannalog gives me 8 more inputs and outputs. They are 3.3v level but I think I can work with that. Am I interpreting that correctly?
    Ok and one more question: How can I change KmotionCNC to default to Inches instead of Millimeters?

    Thanks!



Page 4 of 5 FirstFirst 12345 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

PID advice on a retrofit BenchmanXT
PID advice on a retrofit BenchmanXT