6.23 NC_COMMAND_SEARCH_INDEX: Axial Index Searching Signal


  • This NC COMMAND is issued by the PLC and specifies that the CNC should make an index signal to find the axis. After it is found, it will stop and end the NC COMMAND, as described below:

Signal

Function

plc.ncCommand.flag

initiate NC COMMAND.

plc.ncCommand.data.x

Specifies the speed at which the seek signal is sought. If it is positive, it is in the positive direction. If it is negative, it is in the negative direction and the unit is mm/min.

plc.ncCommand.data.y

plc.ncCommand.data.z

plc.ncCommand.data.a

plc.ncCommand.data.b

plc.ncCommand.data.c

plc.ncCommand.finish

Issued by the CNC to indicate the completion of the action.


  • For the handshake method, refer to the following PLC sample segment.
  • Please note when using this NC COMMAND:

1.

Only one axis seek operation can be performed at a time.

2.

PLC can issue this NC COMMAND only when executing M code in MDI or program. This line can only have M CODE and H CODE.

3.

The speed of the locator needs to take a slower speed, otherwise it is inaccurate, so it may take a long time to do this.

4.

Usually this action is done to verify whether the position of the CNC is reproduced. The Index signal detector is fixed on the frame of the motor to form a fixed external reference position. The distance from this seek operation can be used to know whether the position is reproduced.


Example M72:

M72

H designated axial

H0

X

H1

Y

H2

Z

H3

A

H4

B

H5

C


PLC Example:

void plcRun(Status &sts, PlcBlock &plc)

{

...



 if( plc.mCode.flag;

   switch( plc.mCode.data ) {


     ...


     case 72:

       if( ( (plc.ncCommand.flag&0xff) == NC_COMMAND_SEARCH_INDEX ) &&

           plc.ncCommand.finish ) {

         plc.ncCommand.flag = 0;

         plc.mCode.finish = 1;

       } else if( plc.ncCommand.flag == 0 ) {

         plc.ncCommand.data.x = plc.ncCommand.data.y = plc.ncCommand.data.z =

         plc.ncCommand.data.a = plc.ncCommand.data.b = plc.ncCommand.data.c = 0;

         int thisSpeed = 0;

         if( plc.mhAttr&PLC_MH_ATTR_1 )

           thisSpeed = plc.mhCode1;

         if( plc.mhAttr&PLC_MH_ATTR_0 ) {

           if( plc.mhCode0==0 )

             plc.ncCommand.data.x = thisSpeed;

           else if( plc.mhCode0==1 )

             plc.ncCommand.data.y = thisSpeed;

           else if( plc.mhCode0==2 )

             plc.ncCommand.data.z = thisSpeed;

           else if( plc.mhCode0==3 )

             plc.ncCommand.data.a = thisSpeed;

           else if( plc.mhCode0==4 )

             plc.ncCommand.data.b = thisSpeed;

           else if( plc.mhCode0==5 )

             plc.ncCommand.data.c = thisSpeed;

         }

         if( thisSpeed && plc.mhCode0>=0 && plc.mhCode0<=5 )

           plc.ncCommand.flag = NC_COMMAND_SEARCH_INDEX;

       }

       break;


     ...

   }

 }


 ...

}