.

Using mpiMotorConfigSet with Absolute Encoders

All absolute encoder configuration through the MPI is made using mpiMotorConfigSet(...) calls. The below sample code demonstrates the correct way to configure the XMP for Yaskawa absolute encoders.

When using a motor's User Output:


returnValue =
	mpiMotorFlashConfigGet(motor,
			       NULL,
			       &motorConfig,
			       &motorConfigMEI);

	motorConfig.encoderPhase = TRUE; /* Reverse */

	/* Config User Output for SEN line */
	motorConfigMEI.UserOutInvert = TRUE;

	motorConfigMEI.Encoder[0].type = MEIXmpEncoderTypeABS_0; /* Yaskawa encoder */
	motorConfigMEI.Encoder[0].countsPerRev = 65536;		 /* 65536 for 16-bit 
							encoders,131072 for 17-bit */

	returnValue =
		mpiMotorFlashConfigSet(motor,
				       NULL,
				       &motorConfig,
				       &motorConfigMEI);
	msgCHECK(returnValue);

	returnValue =
		mpiMotorConfigSet(motor,
				  &motorConfig,
				  &motorConfigMEI);
	msgCHECK(returnValue);

When using a motor's Transceiver Output:


returnValue =
		mpiMotorFlashConfigGet(motor,
				       NULL,
				       &motorConfig,
				       &motorConfigMEI);

	motorConfig.encoderPhase = TRUE; /* Reverse */

	/* Config transceiver for SEN line */
	motorConfigMEI.Transceiver[0].Config = MEIMotorTransceiverConfigOUTPUT;
	motorConfigMEI.Transceiver[0].Invert = TRUE;

	motorConfigMEI.Encoder[0].type = MEIXmpEncoderTypeABS_0; /* Yaskawa encoder */
	motorConfigMEI.Encoder[0].countsPerRev = 65536;		 /* 65536 for 16-bit 
							encoders,  131072 for 17-bit */
returnValue =
		mpiMotorFlashConfigSet(motor,
				       NULL,
				       &motorConfig,
				       &motorConfigMEI);
	msgCHECK(returnValue);

	returnValue =
		mpiMotorConfigSet(motor,
					  &motorConfig,
					  &motorConfigMEI);

In the above sample code, the steps for configuration are:

 
  1. Choose a transceiver, or User Opto, to be used for the encoders SEN line. The only restriction is that this transceiver must be on the same controller as the absolute encoder (not necessarily the same Motion Block).
  2. Get the current motor configuration from flash memory.
  3. Configure the encoder phase for the absolute encoder to Reverse.
  4. For a User Opto, configure UserOutInvert to be TRUE. When using a transceiver, configure for Output, and Inverted.
  5. Configure the encoder type and counts per revolution.
  6. Save the current motor configuration from flash memory.

Once configured, the initialization of all axes associated with the motors having absolute encoders is automatic at power up or reset. The SEN line is toggled and the origin and command position are calculated and set from the absolute data sent by the drive.

IMPORTANT NOTE: The drive must be powered but should not be enabled.

Determining the countPerRev Parameter

The magnitude countsPerRev parameter is detemined by the number of encoder counts (after quadrature) for one revolution of the motor. The sign of the countsPerRev is derimined by the direction for positive rotation for the motor. For Yaskawa drives this is determined by the drive parameter P000.0. P000.0 = 0 ("Standard Rotation", factory default setting) will cause the motor to move in a counter-clockwise (CCW) direction for positive increases in encoder counts. For Standard Rotation (Pn000.0 = 0) the countPerRev parameter should be positive.

P000.0 = 1 ("Reverse Rotation") will cause the motor to move in a clockwise (CCW) direction for positive increases in encoder counts. For Reverse Rotation the countsPerRev parameter should be negative.

For example the following code would be used for a drive congfigured for Standard Rotation where the number of counts for one revolution of the motor shaft is 8,192:
      motorConfigMEI.Encoder[0].countsPerRev = 8192;

If the same drive were configured for Reverse Rotation the code would be:
      motorConfigMEI.Encoder[0].countsPerRev = -8192;

For both Standard and Reverse Rotation the encoderPhase parameter should be TRUE (encoder reversed).

Return to mpiMotorConfigSet

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2021 Motion Engineering