New Machine Build SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills - Page 4


Page 4 of 4 FirstFirst 1234
Results 61 to 73 of 73

Thread: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills

  1. #61

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Tom,

    Great Day!!! That was the clue I needed.

    The problem is caused by a timing issue triggered when Axis 6 takes almost zero time to process. This occurs when Axis 6 is disabled and has no significant input to process.

    A workaround is to configure Axis 6 as Encoder Input Mode even though no input is needed. Any Input Channel can be specified. ie

    ch6->InputMode=ENCODER_MODE;
    I have an Encoder on Axis 6, and had not changed the code to match that on ch6 input mode... So we changed it and loaded it accordingly... and now it appears we are operational.

    We ordered another KFlop and Kanalog board as a backup in case... so we did not loose the next three days. Hopefully we will be running soon. Testing every circuit. Most of the outputs tested. Now testing all the inputs.

    Look like were up and going... as far as on to testing all inputs.

    Thanks,

    - Jeff R.

    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  2. #62

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Greetings,

    Next issue I am having... Code Below??

    I have X, Y, Z, A, T, C, W, S
    ch 0 1 2 3 4 5 6 7 Spindle Out on ch 7.
    out 0 1 2 6 6 3 4 7 T for Tool Changer is Step & Dir out.
    Enc. In 0 1 2 3 4 5

    The issue I am having now... is the A axis works fine... and even if I move its wires to the ch0 or the ch6... and the voltage output works fine.

    On the older used Yaskawa Drives... when Using ch0 to try and move that Axis... it just creeps along.

    Yet I can put a Battery Box, on the Analog signal input to that drive... and it runs like crazy... or very well.
    _____________________________________________

    Am I missing something...? as far as setting up the Kanalog Board?

    Thanks for any help, I do need to get this going...

    - Jeff R.

    __________________________________________________
    #include "KMotionDef.h"

    //GoldCNC5 Installation.
    // Defines axis 0, 1, 2, 3, 4, 5, 6 as needed.

    int main()
    {
    //FPGA(STEP_PULSE_LENGTH_ADD)=32 + 0x40 + 0x80; // set the pulse time to ~ 2us, mux to JP4 and JP6, and pulse the Step High
    FPGA(STEP_PULSE_LENGTH_ADD)=32 + 0x80;


    ch0->InputMode=ENCODER_MODE; //X Axis
    ch0->OutputMode=DAC_SERVO_MODE;
    ch0->Vel=320000; //1920 RPM Max Rapid Travel Settings
    ch0->Accel=8000000; //Rapid Travel Settings
    ch0->Jerk=4e+006; //Rapid Travel Settings
    ch0->P=5;
    ch0->I=0.03;
    ch0->D=500;
    ch0->FFAccel=0;
    ch0->FFVel=0;
    ch0->MaxI=200;
    ch0->MaxErr=20000;
    ch0->MaxOutput=2000;
    ch0->DeadBandGain=1;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=0;
    ch0->OutputChan0=0; //Output Channel
    ch0->OutputChan1=0;
    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=20480;
    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.000769;
    ch0->iir[2].B1=0.001538;
    ch0->iir[2].B2=0.000769;
    ch0->iir[2].A1=1.92081;
    ch0->iir[2].A2=-0.923885;


    //EnableAxisDest(0,0)

    ch1->InputMode=ENCODER_MODE; //Y Axis
    ch1->OutputMode=DAC_SERVO_MODE;
    ch1->Vel=320000; //1920 RPM Max Rapid Travel Settings
    ch1->Accel=8000000; //Rapid Travel Settings
    ch1->Jerk=4e+006; //Rapid Travel Settings
    ch1->P=5;
    ch1->I=0.03;
    ch1->D=500;
    ch1->FFAccel=0;
    ch1->FFVel=0;
    ch1->MaxI=200;
    ch1->MaxErr=1e+006;
    ch1->MaxOutput=2000;
    ch1->DeadBandGain=1;
    ch1->DeadBandRange=0;
    ch1->InputChan0=1;
    ch1->InputChan1=0;
    ch1->OutputChan0=1; //Output Channel
    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=20480;
    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.000769;
    ch1->iir[2].B1=0.001538;
    ch1->iir[2].B2=0.000769;
    ch1->iir[2].A1=1.92081;
    ch1->iir[2].A2=-0.923885;

    //EnableAxisDest(1,0);

    ch2->InputMode=ENCODER_MODE; //Z Axis
    ch2->OutputMode=DAC_SERVO_MODE;
    ch2->Vel=320000; //1920 RPM Max Rapid Travel Settings
    ch2->Accel=8000000; //Rapid Travel Settings
    ch2->Jerk=4e+006; //Rapid Travel Settings
    ch2->P=5;
    ch2->I=0.03;
    ch2->D=500;
    ch2->FFAccel=0;
    ch2->FFVel=0;
    ch2->MaxI=200;
    ch2->MaxErr=1e+006;
    ch2->MaxOutput=2000;
    ch2->DeadBandGain=1;
    ch2->DeadBandRange=0;
    ch2->InputChan0=2;
    ch2->InputChan1=0;
    ch2->OutputChan0=2; //Output Channel
    ch2->OutputChan1=0;
    ch2->MasterAxis=-1;
    ch2->LimitSwitchOptions=0x100;
    ch2->LimitSwitchNegBit=0;
    ch2->LimitSwitchPosBit=0;
    ch2->SoftLimitPos=1e+030;
    ch2->SoftLimitNeg=-1e+030;
    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=20480;
    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.000769;
    ch2->iir[2].B1=0.001538;
    ch2->iir[2].B2=0.000769;
    ch2->iir[2].A1=1.92081;
    ch2->iir[2].A2=-0.923885;


    //EnableAxisDest(2,0);

    ch3->InputMode=ENCODER_MODE; //A Axis 4TH AXIS LATHE
    ch3->OutputMode=DAC_SERVO_MODE;
    ch3->Vel=320000; //1920 RPM Max Rapid Travel Settings
    ch3->Accel=8000000; //Rapid Travel Settings
    ch3->Jerk=4e+006; //Rapid Travel Settings
    ch3->P=5;
    ch3->I=0.03;
    ch3->D=500;
    ch3->FFAccel=0;
    ch3->FFVel=0;
    ch3->MaxI=200;
    ch3->MaxErr=1e+006;
    ch3->MaxOutput=2000;
    ch3->DeadBandGain=1;
    ch3->DeadBandRange=0;
    ch3->InputChan0=3;
    ch3->InputChan1=0;
    ch3->OutputChan0=6; //Output Channel
    ch3->OutputChan1=0;
    ch3->MasterAxis=-1;
    ch3->LimitSwitchOptions=0x100;
    ch3->LimitSwitchNegBit=0;
    ch3->LimitSwitchPosBit=0;
    ch3->SoftLimitPos=1e+030;
    ch3->SoftLimitNeg=-1e+030;
    ch3->InputGain0=1;
    ch3->InputGain1=1;
    ch3->InputOffset0=0;
    ch3->InputOffset1=0;
    ch3->OutputGain=1;
    ch3->OutputOffset=0;
    ch3->SlaveGain=1;
    ch3->BacklashMode=BACKLASH_OFF;
    ch3->BacklashAmount=0;
    ch3->BacklashRate=0;
    ch3->invDistPerCycle=214000;
    ch3->Lead=0;
    ch3->MaxFollowingError=1000000000;
    ch3->StepperAmplitude=20;

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

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

    ch3->iir[2].B0=0.000769;
    ch3->iir[2].B1=0.001538;
    ch3->iir[2].B2=0.000769;
    ch3->iir[2].A1=1.92081;
    ch3->iir[2].A2=-0.923885;


    //EnableAxisDest(3,0);

    ch4->InputMode=NO_INPUT_MODE;
    ch4->OutputMode=STEP_DIR_MODE;
    ch4->Vel=6700; //Step Drive set to 400. 800 per tool change.
    ch4->Accel=5000;
    ch4->Jerk=40000;
    ch4->P=0.000000;
    ch4->I=0.010000;
    ch4->D=0.000000;
    ch4->FFAccel=0.000000;
    ch4->FFVel=0.000000;
    ch4->MaxI=200.000000;
    ch4->MaxErr=1000000.000000;
    ch4->MaxOutput=200.000000;
    ch4->DeadBandGain=1.000000;
    ch4->DeadBandRange=0.000000;
    ch4->InputChan0=0;
    ch4->InputChan1=0;
    ch4->OutputChan0=6;
    ch4->OutputChan1=0;
    ch4->LimitSwitchOptions=0x100;
    ch4->LimitSwitchNegBit=0;
    ch4->LimitSwitchPosBit=0;
    ch4->InputGain0=1.000000;
    ch4->InputGain1=1.000000;
    ch4->InputOffset0=0.000000;
    ch4->InputOffset1=0.000000;
    ch4->invDistPerCycle=1.0;
    ch4->Lead=0.000000;
    ch4->MaxFollowingError=1000000000.000000;
    ch4->StepperAmplitude=20.000000;

    ch4->iir[0].B0=1.000000;
    ch4->iir[0].B1=0.000000;
    ch4->iir[0].B2=0.000000;
    ch4->iir[0].A1=0.000000;
    ch4->iir[0].A2=0.000000;

    ch4->iir[1].B0=1.000000;
    ch4->iir[1].B1=0.000000;
    ch4->iir[1].B2=0.000000;
    ch4->iir[1].A1=0.000000;
    ch4->iir[1].A2=0.000000;

    ch4->iir[2].B0=0.000769;
    ch4->iir[2].B1=0.001538;
    ch4->iir[2].B2=0.000769;
    ch4->iir[2].A1=1.920810;
    ch4->iir[2].A2=-0.923885;

    EnableAxisDest(4,1); //Enable the Axis.

    ch5->InputMode=ENCODER_MODE; //C Axis
    ch5->OutputMode=DAC_SERVO_MODE;
    ch5->Vel=4000;
    ch5->Accel=400000;
    ch5->Jerk=4e+006;
    ch5->P=0;
    ch5->I=0.01;
    ch5->D=0;
    ch5->FFAccel=0;
    ch5->FFVel=0;
    ch5->MaxI=200;
    ch5->MaxErr=1e+006;
    ch5->MaxOutput=200;
    ch5->DeadBandGain=1;
    ch5->DeadBandRange=0;
    ch5->InputChan0=4;
    ch5->InputChan1=0;
    ch5->OutputChan0=3;
    ch5->OutputChan1=0;
    ch5->MasterAxis=-1;
    ch5->LimitSwitchOptions=0x100;
    ch5->LimitSwitchNegBit=0;
    ch5->LimitSwitchPosBit=0;
    ch5->InputGain0=1;
    ch5->InputGain1=1;
    ch5->InputOffset0=0;
    ch5->InputOffset1=0;
    ch5->OutputGain=1;
    ch5->OutputOffset=0;
    ch5->SlaveGain=1;
    ch5->BacklashMode=BACKLASH_OFF;
    ch5->BacklashAmount=0;
    ch5->BacklashRate=0;
    ch5->invDistPerCycle=800;
    ch5->Lead=0;
    ch5->MaxFollowingError=1000000000;
    ch5->StepperAmplitude=20;

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

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

    ch5->iir[2].B0=0.000769;
    ch5->iir[2].B1=0.001538;
    ch5->iir[2].B2=0.000769;
    ch5->iir[2].A1=1.92081;
    ch5->iir[2].A2=-0.923885;

    ch6->InputMode=ENCODER_MODE;
    ch6->OutputMode=DAC_SERVO_MODE;
    ch6->Vel=40000;
    ch6->Accel=400000;
    ch6->Jerk=4e+006;
    ch6->P=0;
    ch6->I=0;
    ch6->D=0;
    ch6->FFAccel=10000;
    ch6->FFVel=2047;
    ch6->MaxI=2047;
    ch6->MaxErr=200;
    ch6->MaxOutput=2047;
    ch6->DeadBandGain=1;
    ch6->DeadBandRange=0;
    ch6->InputChan0=5;
    ch6->InputChan1=1;
    ch6->OutputChan0=4; //Output Channel
    ch6->OutputChan1=1;
    ch6->MasterAxis=-1;
    ch6->LimitSwitchOptions=0x100;
    ch6->LimitSwitchNegBit=0;
    ch6->LimitSwitchPosBit=0;
    ch6->SoftLimitPos=1e+009;
    ch6->SoftLimitNeg=-1e+009;
    ch6->InputGain0=1;
    ch6->InputGain1=1;
    ch6->InputOffset0=0;
    ch6->InputOffset1=0;
    ch6->OutputGain=-1; //Changed
    ch6->OutputOffset=0;
    ch6->SlaveGain=1;
    ch6->BacklashMode=BACKLASH_OFF;
    ch6->BacklashAmount=0;
    ch6->BacklashRate=0;
    ch6->invDistPerCycle=1;
    ch6->Lead=0;
    ch6->MaxFollowingError=10000000;
    ch6->StepperAmplitude=250;

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

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

    ch6->iir[2].B0=1;
    ch6->iir[2].B1=0;
    ch6->iir[2].B2=0;
    ch6->iir[2].A1=0;
    ch6->iir[2].A2=0;
    //EnableAxisDest(6,1);


    DefineCoordSystem6(0,1,2,3,-1,5); //Router With Lathe.


    //Add IO Board
    InitAux();
    AddKonnect_Aux0(0,&VirtualBits,VirtualBitsEx);
    AddKonnect_Aux0(1,VirtualBitsEx+1,VirtualBitsEx+2) ;
    AddKonnect_Aux0(2,VirtualBitsEx+3,VirtualBitsEx+4) ;

    //AddKonnect(0,&VirtualBits,VirtualBitsEx);
    //AddKonnect(1,VirtualBitsEx+1,VirtualBitsEx+2);
    //AddKonnect(2,VirtualBitsEx+3,VirtualBitsEx+4);

    VirtualBits=0;
    VirtualBitsEx[0]=0;
    VirtualBitsEx[1]=0;
    VirtualBitsEx[3]=0;

    //Board 0 has Output Bits mapped to 48 - 63 and Input Bits Mapped to 1024-1055
    //Board 1 has Output Bits mapped to 1056-1071 and Input Bits Mapped to 1088-1119
    //Board 2 has Output Bits mapped to 1120-1135 and Input Bits Mapped to 1152-1183


    //Flash LED.
    SetBit(47);
    Delay_sec(1);
    ClearBit(47);
    Delay_sec(1);
    SetBit(47);
    Delay_sec(1);
    ClearBit(47);
    Delay_sec(1);
    SetBit(47);
    Delay_sec(1);
    ClearBit(47);


    return 0;
    }


    Last edited by jeffserv; 03-21-2016 at 11:20 PM. Reason: Added code detail...
    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  3. #63
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Hi Jeff,

    I don't follow your numbering. But to get full speed (full 10V) to the Drive set MaxOutput to 2047. Also MaxI might need to be 5000 or higher.

    Regards.

    Regards
    TK http://dynomotion.com


  4. #64

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Greetings,

    Ok, I can remove the Analog wires from the Analog Output on the Kanalog. Then wire the Battery Box to the Drive. Drive input monitor shows the input signal, and the drive responses beautifully. So the drive is OK, and able to function via analog +or- 10vdc.

    Now when I put these same wires, + to Kanalog DAC 0 and cooresponding GND to that output... then I get no Voltage output at all... or lets says nearly. I even put a meter inline to see if I could see any voltage... none at all.

    Yet the Anolog I/O shows voltage... it will show + or - 9.97vdc and will show none on the drive input or on the volt meter either.

    Still lost on this one...

    I have even changed out the Kanalog board for the new one sent to me... to remove the possibility of a bad board.

    I have even created an Init file with only the ch0 drive... to just work on that... yet "no go".
    __________________________

    What it will do, is at 1/10 of an inch per minuts, or very very slow... the analog will move to a setting. Or follow at Jog0=200.

    Need Help?

    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  5. #65
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Hi Jeff,

    You can test the Kanalog DAC output by cycling KFLOP power to disable all axes. Then command DAC0=-2000. Do you get 10V on the DAC 0 output?

    Please post your Init file.

    Make a move on the Step Response Screen and post the Command, Position, Output Plot.

    Do you have more than one axis configured to use DAC 0?

    Carefully check the +/- 15V on Kanalog.

    Regards

    Regards
    TK http://dynomotion.com


  6. #66

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Ok, Did the DAC and I get great and exact voltage out of the Kanalog board. When I am not hooked to the 1998 Yaskawa Drives.

    As soon as I connect them, then the voltage goes to zero or .0001 and thus I believe the issue to be electronic. Seems the Kanalog and the old drives are incompatible?

    I am doing all testing with the Dynomotion screens.

    Init. file in previous post.

    The Step Response is basically none responsive.

    Yes I have 6 analog drives, and 1 Spindle DAC out to control... at the moment.

    I have no clue where to measure the Kanalog's 15 volts.
    __________________________________________________ ________________________

    I have the option to set the Yaskawa drives to Step & Direction... and I may attempt this; since the Analog seems to not work, in this case.
    __________________________________________________ ________________________

    It seems for the Analog, I would need some sort of amplication, between the Kanalog and the Yaskawa drives? Is there something like this?

    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  7. #67

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Greetings,

    Had no success with the Analog, controlling the old Yaskawa Drives. However these drives can be controlled by Step and Direction (Puls and Sign) as they call it. They are all working now.

    My next challenge is the Main Spindle speed control. I have the code below. This file and code is called when ever I use "M3 S18000" for instance... FWD and REV by M3 and M4 and M5 OFF.

    KM.CoordMotion.Interpreter.SetMcodeAction(10, MCODE_TYPE.M_Action_Program, 2, 2, 0, 0, 0, "C:\\KMotion433\\GoldCNC5\\Spindle.c"); //Gcode S Command
    Speed Control Don't seem to be working...

    Issue is I believe it needs to generate and send to the DAC "-2047" for full RPM... and not "2047".
    __________________________________________________ ________

    Could you help me with the code below, to make it do so. Thanks!!!!

    #include "KMotionDef.h"

    #define FACTOR1 0.1137222 // 18000 RPM Spindle
    #define FACTOR2 0.0004885 // 1 / 2047 FOR CONVERTION
    #define RPM 2

    main()
    {
    float speed = *(float *)&persist.UserData[RPM]; // RPM Setting from Application
    float dac = (float)((speed * FACTOR1)*FACTOR2); // Convert to 0 - 1 Setting or Jog

    if (dac > 2047) dac=2047; // Limit DAC to DAC range

    Jog(7, dac); // Output speed to DAC.
    }


    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  8. #68
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Hi Jeff,

    Have you read this:
    KMotionCNC Spindle Control

    Note the negative OutputGain.

    Can you Jog Axis 7 to control the Spindle? Jog7=0.5 should do 9000RPM

    Then you should just need one factor of 1.0/18000.0

    HTH

    Regards
    TK http://dynomotion.com


  9. #69

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    OK,

    Got the spindle speed control working... was mainly my configuration...

    Below is what is working: Thanks so much!
    __________________________________________________ ______________________

    ch7->InputMode=NO_INPUT_MODE;
    ch7->OutputMode=DAC_SERVO_MODE;
    ch7->Vel=40000;
    ch7->Accel=400000;
    ch7->Jerk=4e+006;
    ch7->P=0;
    ch7->I=0;
    ch7->D=0;
    ch7->FFAccel=10000;
    ch7->FFVel=2047;
    ch7->MaxI=2047;
    ch7->MaxErr=200;
    ch7->MaxOutput=2047;
    ch7->DeadBandGain=1;
    ch7->DeadBandRange=0;
    ch7->InputChan0=7;
    ch7->InputChan1=1;
    ch7->OutputChan0=7; //Output Channel
    ch7->OutputChan1=1;
    ch7->MasterAxis=-1;
    ch7->LimitSwitchOptions=0x100;
    ch7->LimitSwitchNegBit=0;
    ch7->LimitSwitchPosBit=0;
    ch7->SoftLimitPos=1e+009;
    ch7->SoftLimitNeg=-1e+009;
    ch7->InputGain0=1;
    ch7->InputGain1=1;
    ch7->InputOffset0=0;
    ch7->InputOffset1=0;
    ch7->OutputGain=-1; //Changed
    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;
    EnableAxisDest(7,1);


    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  10. #70

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    New Question?:

    if (GV.HomeTC == 1)
    {
    KM.CompileAndLoadCoff(4, "C:\\KMotion433\\GoldCNC5\\HomeTC.c", false);
    GV.HomeTC = 0;
    }

    // Execute the Homing Thread
    WriteLineHandleException("Execute4");
    I am loading a file into thread 4, then executing it. I do this for various Homing Routines. XYZA, XY, A, C, W, TC (Tool Changer).
    ___________________________________________

    What I am interested in:

    Is there a way to know when this thread is done?

    When a homing routine is done, I want to Update all my displays in my application.
    I do this with a variable in my app. using ResetMotionParameters = 1;

    I need to know when, so I can know when to update everything?
    __________________________________________________ _______________________________________

    Here is something that may work... I turn off the Output bit 47 in my C program for homing..., then re-enable 47 when Homing is done. I already do this for LED control, on my Homing Button.

    // Execute the Homing Thread
    WriteLineHandleException("Execute4");
    while (GV.out47 != 0) { Thread.Sleep(10); } //Wait, to allow 47 to go off, set by home programs.
    while (GV.out47 != 1) { Thread.Sleep(1000); } //Do nothing while waiting for 47 to go high.
    GV.ReSetMotionParameters = 1; //Reset Motion Parameters and Displays.
    Thanks so much,

    - Jeff

    Last edited by jeffserv; 03-30-2016 at 03:20 PM. Reason: Possible Solution? For Review??
    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  11. #71
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Hi Jeff.

    The is a .NET KM_Controller function to check if a Thread is currently executing:

    /// <summary>
    /// Checks whether a User Program Thread is currently executing.
    /// </summary>
    /// <returns>Returns true if executing, false if not executing</returns>
    public bool ThreadExecuting(int thread)

    Also a KFLOP Script Command:
    Script Commands

    I suspect your VirtualBit Flag technique would work fine. But there might be a remote chance of a race condition where the PC Starts the execution but then freezes for whatever reason for a second or so. If the Home Routine is fast enough (unlikely) it could set the bit low and high before the PC has a chance to see it go low. The code would then hang forever. Its better to code in a way where timing is never a factor. So have the PC set the bit Low first, verify it is actually low, then start the home routine, then wait for it to be high.

    HTH

    Regards
    TK http://dynomotion.com


  12. #72

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Thanks Tom,

    The "ThreadExecuting" allowed me to monitor the status of the thread, then re-act to it... below is what I did. I have a Timer 1 Tick, that runs various task that need done. The other code did lock up... this is much better.

    private void CheckIfThread4IsExecuting() //Timer 1 Tick.
    {
    GV.Thread4Executing = KM.ThreadExecuting(4); //GV or Global Variable = KM thread status.
    if (GV.Thread4Watch == 1) //Watch for Kflop Thread 4 to finish.
    {
    if (GV.Thread4Executing != true) //Watch for Kflop Thread 4 to Stop.
    {
    Thread.Sleep(1000);
    GV.ReSetMotionParameters = 1;
    GV.Thread4Watch = 0;
    }
    }
    if (GV.Thread4Watch == 0)
    {
    if (GV.Thread4Executing == true) //Watch for Kflop Thread 4 to Start.
    {
    GV.Thread4Watch = 1;
    Thread.Sleep(1000);
    }
    }
    }


    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


  13. #73

    Default Re: SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Dril

    Machine is operational: Below a couple of pictures.

    John, owners son machining a steel part.

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160326_183010-jpg

    Machining Steel Part.

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160326_182950-jpg

    Kflop, Kanalog, and 3 Konnect Boards - Installed in middle of Control Cabinet - Interface over 150 new wires into the cabinet. Replacing old controls, cheap switches and such.
    Also added Servo Drive for A axis or Lathe Spindle 4th Axis motion. Top Right of Panel.
    Covers not replaced yet!

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160326_182910-jpg

    Added simple Stepper Drive to control Tool Changer Carousel, with its own 24vdc power supply. Lower left of panel.

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160326_182926-jpg

    Step & Direction Out: To X Y Z and Tool Changer.

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160323_162218-jpg

    Interface of 18 wire Robot Cable & 33 wire Robot Cable, for remote control of 13 Drill Heads, Drill Head up and down... & Tool Changer; as well as Spindle Control of Tool Lock and Unlock.

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160226_211825-jpg

    Gauges to monitor Vacuum Pressure Zone 1 and Zone 2.

    SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills-20160305_203924-jpg

    GOLDCNC5, BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachineautomation.com - ETL UL508A CSA CERTIFIED INDUSTRIAL CONTROL PANEL SHOP


Page 4 of 4 FirstFirst 1234

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

SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills

SCM Record 220 / CNC Retrofit / Lg Production Router / 10 Tool Changer / +13 Drills