Need Help! Fails to do homing. Kflop + Konnect.


Results 1 to 7 of 7

Thread: Fails to do homing. Kflop + Konnect.

  1. #1
    Member
    Join Date
    Dec 2016
    Location
    Belarus
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Fails to do homing. Kflop + Konnect.

    Hello. I can't produce a homing action. Please help.

    I'm using Kflop and Konnect. Kflop via Jp4 is connected to Konnect. Three axes are connected to JP7 Kflop.
    Three inductive sensors are connected through Konnect. Sensors are connected to 1024 1025 and 1026 pin.
    InitStepDir3Axis.c
    Code:
    #include "KMotionDef.h"
    
    
    // Defines axis 0, 1, 2 as simple step dir outputs
    // enables them
    // sets them as an xyz coordinate system for GCode
    
    
    int main()   
    {
        InitAux();
        AddKonnect_Aux0(0,&VirtualBits,VirtualBitsEx); // jp4
    
    
        ch0->InputMode=NO_INPUT_MODE;
        ch0->OutputMode=STEP_DIR_MODE;
        ch0->Vel=21000;
        ch0->Accel=21000;
        ch0->Jerk=4e+06;
        ch0->P=0;
        ch0->I=0.01;
        ch0->D=0;
        ch0->FFAccel=0;
        ch0->FFVel=0;
        ch0->MaxI=200;
        ch0->MaxErr=1e+06;
        ch0->MaxOutput=200;
        ch0->DeadBandGain=1;
        ch0->DeadBandRange=0;
        ch0->InputChan0=0;
        ch0->InputChan1=0;
        ch0->OutputChan0=8;
        ch0->OutputChan1=0;
        ch0->MasterAxis=-1;
        ch0->LimitSwitchOptions=0x103;
        ch0->LimitSwitchNegBit=1026;
        ch0->LimitSwitchPosBit=1026;
        ch0->SoftLimitPos=1e+09;
        ch0->SoftLimitNeg=-1e+09;
        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.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=NO_INPUT_MODE;
        ch1->OutputMode=STEP_DIR_MODE;
        ch1->Vel=40000;
        ch1->Accel=400000;
        ch1->Jerk=4e+06;
        ch1->P=0;
        ch1->I=0.01;
        ch1->D=0;
        ch1->FFAccel=0;
        ch1->FFVel=0;
        ch1->MaxI=200;
        ch1->MaxErr=1e+06;
        ch1->MaxOutput=200;
        ch1->DeadBandGain=1;
        ch1->DeadBandRange=0;
        ch1->InputChan0=1;
        ch1->InputChan1=0;
        ch1->OutputChan0=9;
        ch1->OutputChan1=0;
        ch1->MasterAxis=-1;
        ch1->LimitSwitchOptions=0x103;
        ch1->LimitSwitchNegBit=1025;
        ch1->LimitSwitchPosBit=1025;
        ch1->SoftLimitPos=1e+09;
        ch1->SoftLimitNeg=-1e+09;
        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.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=NO_INPUT_MODE;
        ch2->OutputMode=STEP_DIR_MODE;
        ch2->Vel=40000;
        ch2->Accel=400000;
        ch2->Jerk=4e+06;
        ch2->P=0;
        ch2->I=0.01;
        ch2->D=0;
        ch2->FFAccel=0;
        ch2->FFVel=0;
        ch2->MaxI=200;
        ch2->MaxErr=1e+06;
        ch2->MaxOutput=200;
        ch2->DeadBandGain=1;
        ch2->DeadBandRange=0;
        ch2->InputChan0=2;
        ch2->InputChan1=0;
        ch2->OutputChan0=10;
        ch2->OutputChan1=0;
        ch2->MasterAxis=-1;
        ch2->LimitSwitchOptions=0x103;
        ch2->LimitSwitchNegBit=1024;
        ch2->LimitSwitchPosBit=1024;
        ch2->SoftLimitPos=1e+09;
        ch2->SoftLimitNeg=-1e+09;
        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.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);
    
    
        DefineCoordSystem(0,1,2,-1);
    
    
        return 0;
    }


    Home-KMotionCNC.c

    Code:
    #include "KMotionDef.h"
    
    
    int DoPC(int cmd);
    int DoPCInt(int cmd, int i);
    #define GATH_OFF 0  // define the offset into the Gather buffer where strings are passed
    
    
    main()
    {
    
    
          //  ????  Z
                    ch2->LimitSwitchOptions=0x100; 
                Jog(2,260);                        
                while (ReadBit(1024)) ;            
                Delay_sec(3.00);           
                Zero(2);                           
                Jog(2,0);                          
                MoveAtVel(2,1000, 160);         
                while (!CheckDone(2)) ;         
                                    Jog(2,160); 
                while (ReadBit(1024)) ;         
                Zero(2);                        
                Jog(2,0);                       
                MoveAtVel(2,1000, -160);        
                while (!CheckDone(2)) ;         
                ch2->LimitSwitchOptions=0x103;
                
                
             
          // ???? ?      
                ch0->LimitSwitchOptions=0x100;
                Jog(0,-1600);                 
                while (ReadBit(1026)) ;       
                Zero(0);                      
                Jog(0,0);                     
                MoveAtVel(0,819, 1600);       
                while (!CheckDone(0)) ;       
                Jog(0,-800);            
                while (ReadBit(1026)) ; 
                Zero(0);                
                Jog(0,0);               
                MoveAtVel(0,819, 1600); 
                while (!CheckDone(0)) ; 
                ch0->LimitSwitchOptions=0x103;
                
                
                     // ???? Y      
                           ch1->LimitSwitchOptions=0x100; 
                Jog(1,-1600);                           
                while (ReadBit(1025)) ;              
                Zero(1);                            
                Jog(1,0);                           
                MoveAtVel(1,819, 1600);          
                while (!CheckDone(1)) ;          
                                    Jog(1,-800); 
                while (ReadBit(1025)) ;           
                Zero(1);                         
                Jog(1,0);                        
                MoveAtVel(1,819, 1600);        
                while (!CheckDone(1)) ;        
                ch1->LimitSwitchOptions=0x103;
    
    
    
    
                MDI("G92.1");
    }
    
    
    // put the MDI string (Manual Data Input - GCode) in the 
    // gather buffer and tell the App where it is
    int MDI(char *s)
    {
       char *p=(char *)gather_buffer+GATH_OFF*sizeof(int);
       int i;
       
       do // copy to gather buffer w offset 0
       {
          *p++ = *s++;
       }while (s[-1]);
       
       // issue the command an wait till it is complete
       // (or an error - such as busy)
       return DoPCInt(PC_COMM_MDI,GATH_OFF);
    }
    
    
    
    
    // Put an integer as a parameter and pass the command to the App
    int DoPCInt(int cmd, int i)
    {
       int result;
       persist.UserData[PC_COMM_PERSIST+1] = i;
       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);
       
       return result;
       }


    Similar Threads:


  2. #2
    Member
    Join Date
    Dec 2016
    Location
    Belarus
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Re: Fails to do homing. Kflop + Konnect.

    When I press the Homming button the axis starts to move, but there is no stopping when pin1024 is triggered.
    The LED light lights up on the most inductive sensor and the LED light on the Konnect (pin 1024) board lights up. But the axis continues to move without paying attention to the signal with pin1024. The axis may be hit at extreme position if you do not have time to press the stop button.

    I haven't been able to solve this problem for several days. Please help.



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

    Default Re: Fails to do homing. Kflop + Konnect.

    Hi Bambarmiya,

    There is a 3 second delay after Bit 1024 is sensed before stopping:

    Delay_sec(3.00);

    remove it.

    Regards
    TK http://dynomotion.com


  4. #4
    Member
    Join Date
    Dec 2016
    Location
    Belarus
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Re: Fails to do homing. Kflop + Konnect.

    Quote Originally Posted by TomKerekes View Post
    remove it.
    Thank you Tom for paying attention to this problem.

    The fact is that before, when I found this error - this line with a pause in the code was not. I specifically added this line myself - I tried to find where this code does not work. I forgot to delete this line in the first post. This pause does not play a role - the error is still available.

    The axis still continues to move without stopping and does not respond to pin1024.



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

    Default Re: Fails to do homing. Kflop + Konnect.

    Hi Bambarmiya,

    Without the delay there seems to be other errors.

    This should move positive to the switch and begin to start stopping (but not stop)
    Code:
                Jog(2,260);                        
                while (ReadBit(1024)) ;            
                Zero(2);                           
                Jog(2,0);


    This will then continue to move 1000 positive further into the limit and stop. You probably intended negative? Would this go past the sensor? Hit the hard stop?
    Code:
    MoveAtVel(2,1000, 160);         
    while (!CheckDone(2)) ;


    This will continue to move positive until sensor is detected. If past the sensor it would go forever.
    Code:
    Jog(2,160); 
    while (ReadBit(1024)) ;         
    Zero(2);                        
    Jog(2,0);

    This code has an error and will be ignored as a negative velocity magnitude is specified. To move negative specify a negative distance not velocity,
    Code:
                MoveAtVel(2,1000, -160);        
                while (!CheckDone(2)) ;
    HTH

    Regards
    TK http://dynomotion.com


  6. #6
    Member
    Join Date
    Dec 2016
    Location
    Belarus
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Re: Fails to do homing. Kflop + Konnect.

    Hello Tom. Your explanations helped to understand some points, and I also found something that needs to be changed.
    I'm attaching the code I earned correctly.
    Thank you for your help!
    Code:
    #include "KMotionDef.h"
    
    
    int DoPC(int cmd);
    int DoPCInt(int cmd, int i);
    #define GATH_OFF 0  // define the offset into the Gather buffer where strings are passed
    
    
    main()
    {
    
    
          // finding ???? Z
                ch2->LimitSwitchOptions=0x100; 
                Jog(2,1600);                  
                while (ReadBit(1026)!=1);      
                Zero(2);                       
                Jog(2,0);                     
                Delay_sec(0.50);                   
                MoveAtVel(2,-800, 1600);       
                while (!CheckDone(2)) ;       
                Delay_sec(0.50);
                Jog(2,200);                          
                while (ReadBit(1026)!=1) ;          
                Zero(2);                              
                Jog(2,0);                           
                Delay_sec(0.50);
                MoveAtVel(2,-1600, 1600);              
                while (!CheckDone(2)) ;             
                ch2->LimitSwitchOptions=0x103;    
    
    
          // finding ???? ?      
                ch0->LimitSwitchOptions=0x100;     
                Jog(0,-1600);                    
                while (ReadBit(1024)!=1);            
                Zero(0);                           
                Jog(0,0);                         
                Delay_sec(0.50);
                MoveAtVel(0,400, 1600);               
                //Delay_sec(3.50);
                //Zero(0);                       
                //Delay_sec(3.50);
                while (!CheckDone(0)) ;            
                Delay_sec(0.50);
                Jog(0,-20);                      
                while (ReadBit(1024)!=1) ;         
                Zero(0);                          
                Jog(0,0);                          
                Delay_sec(0.50);
                MoveAtVel(0,800, 1600);          
                while (!CheckDone(0)) ;            
                ch0->LimitSwitchOptions=0x103;    
    
    
         // finding ???? Y      
                ch1->LimitSwitchOptions=0x100;     
                Jog(1,-1600);                    
                while (ReadBit(1025)!=1);            
                Zero(1);                           
                Jog(1,0);                         
                Delay_sec(0.50);
                MoveAtVel(1,400, 1600);               
                while (!CheckDone(1)) ;            
                Delay_sec(0.50);
                Jog(1,-20);                      
                while (ReadBit(1025)!=1) ;         
                Zero(1);                          
                Jog(1,0);                          
                Delay_sec(0.50);
                MoveAtVel(1,800, 1600);          
                while (!CheckDone(1)) ;            
                ch1->LimitSwitchOptions=0x103;    
                
    
    
                MDI("G92.1");  
    }
    
    
    
    
    
    
    // put the MDI string (Manual Data Input - GCode) in the 
    // gather buffer and tell the App where it is
    int MDI(char *s)
    {
       char *p=(char *)gather_buffer+GATH_OFF*sizeof(int);
       int i;
       
       do // copy to gather buffer w offset 0
       {
          *p++ = *s++;
       }while (s[-1]);
       
       // issue the command an wait till it is complete
       // (or an error - such as busy)
       return DoPCInt(PC_COMM_MDI,GATH_OFF);
    }
    
    
    
    
    // Put an integer as a parameter and pass the command to the App
    int DoPCInt(int cmd, int i)
    {
       int result;
       persist.UserData[PC_COMM_PERSIST+1] = i;
       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);
       
       return result;
       }




  7. #7
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3502
    Downloads
    0
    Uploads
    0

    Default Re: Fails to do homing. Kflop + Konnect.

    Hi Bambarmiya,

    Thanks for taking the time to post back.

    Regards
    TK http://dynomotion.com


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

Fails to do homing. Kflop + Konnect.

Fails to do homing. Kflop + Konnect.

Fails to do homing. Kflop + Konnect.