⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ampparam.cpp

📁 美国COPLEY驱动器,程序开发工具之一.
💻 CPP
📖 第 1 页 / 共 5 页
字号:

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetPhaseAngle( int16 &value )
{ 
   return sdo.Upld16( OBJID_PHASE_ANG, 0, value ); 
}

/***************************************************************************/
/**
  Get the current digital hall sensor state.  The hall state is the value of 
  the hall sensors after any adjustments have been made to them based on the
  hallWiring parameter of the MtrInfo structure.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetHallState( int16 &value )
{ 
   return sdo.Upld16( OBJID_HALL_STATE, 0, value ); 
}

/***************************************************************************/
/**
  Get the analog reference input voltage.  If the amplifier has an analog
  reference input, it's value will be returned in millivolts.

  @param value The value will be returned in this variable
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetRefVoltage( int16 &value )
{
   return sdo.Upld16( OBJID_ANALOG_REF, 0, value );
}

/***************************************************************************/
/**
  Get the high voltage bus voltage in units of 0.1 volts.

  @param value The value will be returned in this variable
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetHighVoltage( int16 &value )
{
   return sdo.Upld16( OBJID_HVREF, 0, value );
}

/***************************************************************************/
/**
  Get the current amplifier temperature (degrees C).

  @param value The value will be returned in this variable
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetAmpTemp( int16 &value )
{
   return sdo.Upld16( OBJID_AMPTEMP, 0, value );
}

/***************************************************************************/
/**
  Get the raw voltage on the two analog encoder inputs (0.1 millivolt units).
  If the amplifier has analog encoder inputs, then they will be read and 
  returned.

  @param sin The sine input of the analog encoder will be returned here.
  @param cos The cosine input of the analog encoder will be returned here.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetAnalogEncoder( int16 &sin, int16 &cos )
{
   const Error *err = sdo.Upld16( OBJID_AENC_SIN, 0, sin );
   if( !err ) err = sdo.Upld16( OBJID_AENC_COS, 0, cos );
   return err;
}

/***************************************************************************/
/**
  Get the actual current values read directly from the amplifier's current
  sensors.

  Note that if the motor wiring is being swapped in software, the U and V
  reading will be swapped.

  @param u The U winding current will be returned here.
  @param v The V winding current will be returned here.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetMotorCurrent( int16 &u, int16 &v )
{
   const Error *err = sdo.Upld16( OBJID_CNRT_U, 0, u );
   if( !err ) err = sdo.Upld16( OBJID_CRNT_V, 0, v );
   return err;
}

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/*
   Misc configuration parameters
   */
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/

/***************************************************************************/
/**
  Set the PWM output mode configuration for the amplifier.
  @param mode The PWM output mode to set
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetPwmMode( AMP_PWM_MODE mode )
{
   return sdo.Dnld16( OBJID_PWM_MODE, 0, (uint16)mode );
}

/***************************************************************************/
/**
  Get the current PWM output mode configuration from the amplifier.
  @param mode The mode information will be returned here.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetPwmMode( AMP_PWM_MODE &mode )
{
   uint16 m;
   const Error *err = sdo.Upld16( OBJID_PWM_MODE, 0, m );
   mode = (AMP_PWM_MODE)m;
   return err;
}

/***************************************************************************/
/**
  Set the phasing mode configuration for the amplifier.
  @param mode The phasing mode to set
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetPhaseMode( AMP_PHASE_MODE mode )
{
   return sdo.Dnld16( OBJID_PHASE_MODE, 0, (uint16)mode );
}

/***************************************************************************/
/**
  Get the current phasing mode configuration from the amplifier.
  @param mode The mode information will be returned here.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetPhaseMode( AMP_PHASE_MODE &mode )
{
   uint16 m;
   const Error *err = sdo.Upld16( OBJID_PHASE_MODE, 0, m );
   mode = (AMP_PHASE_MODE)m;
   return err;
}

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/*
   I/O pins and status registers
   */
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/


/***************************************************************************/
/**
  Get the present value of the general purpose input pins.

  The input pin values are returned one per bit.  The value of input pin
  1 will be returned in bit 0 (1 if high, 0 if low), pin 2 will be in bit 1, 
  etc.

  @param value variable that will store the returned value
  @param viaSDO If true, an SDO will be used to read the input pins.
  If false (default), the most recent input value received from
  the amplifier via PDO will be returned.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetInputs( uint16 &value, bool viaSDO )
{
   if( viaSDO )
      return sdo.Upld16( OBJID_INPUTS, 0, value ); 

   else
   {
      value = (uint16)inputStateMap.getMask();
      return 0;
   }
}

/***************************************************************************/
/**
  Set the current state of the input pin pull up/down resisters.

  Pull up/down resisters control how an undriven input pin will be interpreted
  by the amplifier.  Depending on the model of amplifier being controlled, there
  may be zero or more groups of pull up/down resisters attached to some the input
  pins.

  Each bit of this register is used to control one group of pull up/down resisters.
  Bit 0 controls group 0, etc. 

  Please refer to the amplifier data sheet for details on the number of groups
  of pull up/down resisters, and which input pins are included in each group.

  @param value The new value to write to the pull up/down control register.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetIoPullup( uint16 value )
{
   return sdo.Dnld16( OBJID_PULLUPS, 0, value );
}

/***************************************************************************/
/**
  Get the current state of the input pin pull up/down resisters.

  Pull up/down resisters control how an undriven input pin will be interpreted
  by the amplifier.  Depending on the model of amplifier being controlled, there
  may be zero or more groups of pull up/down resisters attached to some the input
  pins.

  Each bit of this register is used to control one group of pull up/down resisters.
  Bit 0 controls group 0, etc. 

  Please refer to the amplifier data sheet for details on the number of groups
  of pull up/down resisters, and which input pins are included in each group.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetIoPullup( uint16 &value )
{
   return sdo.Upld16( OBJID_PULLUPS, 0, value );
}

/***************************************************************************/
/**
  Set the input pin configuration for the specified input pin.

  Each of the amplifier input pins can be configured to perform some
  function.  This function configures the specified input to perform
  the specified function.

  @param pin The input pin to configure.  Input pins are numbered starting
  from 0.  Check the amplifier datasheet for the number of input pins
  available.
  @param cfg The input pin function to be assigned to this pin.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetInputConfig( int8 pin, INPUT_PIN_CONFIG cfg )
{
   if( pin < 0 ) return &SDO_Error::Subindex;
   return sdo.Dnld16( OBJID_INPUT_CFG, pin+1, (uint16)cfg );
}

/***************************************************************************/
/**
  Get the input pin configuration for the specified input pin.

  Each of the amplifier input pins can be configured to perform some
  function.  This function configures the specified input to perform
  the specified function.

  @param pin The input pin to check.  Input pins are numbered starting
  from 0.  Check the amplifier datasheet for the number of input pins
  available.
  @param cfg The input pin function will be returned in this variable.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetInputConfig( int8 pin, INPUT_PIN_CONFIG &cfg )
{
   uint16 c;
   if( pin < 0 ) return &SDO_Error::Subindex;
   const Error *err = sdo.Upld16( OBJID_INPUT_CFG, pin+1, c );
   cfg = (INPUT_PIN_CONFIG)c;
   return err;
}

/***************************************************************************/
/**
  Set the input pin debounce time for the specified input pin.

  Each of the amplifier input pins can be configured ignore transient 
  states that last less then the debounce time.  This function configures 
  the debounce time for a specific pin.

  @param pin The input pin to configure.  Input pins are numbered starting
  from 0.  Check the amplifier datasheet for the number of input pins
  available.
  @param value The debounce time to use (milliseconds)
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetInputDebounce( int8 pin, int16 value )
{
   if( pin < 0 ) return &SDO_Error::Subindex;
   return sdo.Dnld16( OBJID_DEBOUNCE, pin+1, value );
}

/***************************************************************************/
/**
  Get the input pin debounce time for the specified input pin.

  @param pin The input pin to configure.  Input pins are numbered starting
  from 0.  Check the amplifier datasheet for the number of input pins
  available.
  @param value The pins debounce time (milliseconds) is returned here.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetInputDebounce( int8 pin, int16 &value )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -