cml_io.h

来自「美国COPLEY驱动器,程序开发工具之一.」· C头文件 代码 · 共 1,236 行 · 第 1/5 页

H
1,236
字号
   /// For each input in the group, a value of 1 enables the filter, 0 disables.
   /// @param id Identifies which group of inputs to read.  
   /// @param value The current filter setting of the input lines is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32GetFilt( uint8 id, uint32 &value ){
      return sdo.Upld32( IOOBJID_DIN_32_FILT, id+1, value );
   }

   /// Set the current filter constant setting for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables the filter, 0 disables.
   /// @param id Identifies which group of inputs to effect.
   /// @param value The new filter setting of the input lines.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32SetFilt( uint8 id, uint32 value ){
      return sdo.Dnld32( IOOBJID_DIN_32_FILT, id+1, value );
   }

   /// Get the 'any transition' interrupt mask settings for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables interrupts on any change,
   /// and a value of 0 disables the interrupt.
   /// @param id Identifies which group of inputs to read.  
   /// @param value The current interrupt mask setting of the input lines.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32GetMaskAny( uint8 id, uint32 &value ){
      return sdo.Upld32( IOOBJID_DIN_32_MASK_ANY, id+1, value );
   }

   /// Set the 'any transition' interrupt mask settings for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables interrupts on any transition,
   /// and a value of 0 disables.
   /// @param id Identifies which group of inputs to effect.
   /// @param value The new interrupt mask value.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32SetMaskAny( uint8 id, uint32 value ){
      return sdo.Dnld32( IOOBJID_DIN_32_MASK_ANY, id+1, value );
   }

   /// Get the 'low to high' interrupt mask settings for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables interrupts on a low to high
   /// transition, and a value of 0 disables the interrupt.
   /// @param id Identifies which group of inputs to read.  
   /// @param value The current interrupt mask setting of the input lines.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32GetMaskLow2High( uint8 id, uint32 &value ){
      return sdo.Upld32( IOOBJID_DIN_32_MASK_L2H, id+1, value );
   }

   /// Set the 'low to high' interrupt mask settings for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables interrupts on low to high 
   /// transitions, and a value of 0 disables.
   /// @param id Identifies which group of inputs to effect.
   /// @param value The new interrupt mask value.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32SetMaskLow2High( uint8 id, uint32 value ){
      return sdo.Dnld32( IOOBJID_DIN_32_MASK_L2H, id+1, value );
   }

   /// Get the 'high to low' interrupt mask settings for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables interrupts on a high to low
   /// transition, and a value of 0 disables the interrupt.
   /// @param id Identifies which group of inputs to read.  
   /// @param value The current interrupt mask setting of the input lines.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32GetMaskHigh2Low( uint8 id, uint32 &value ){
      return sdo.Upld32( IOOBJID_DIN_32_MASK_H2L, id+1, value );
   }

   /// Set the 'high to low' interrupt mask settings for a group of 32 digital inputs.
   /// For each input in the group, a value of 1 enables interrupts on high to low
   /// transitions, and a value of 0 disables.
   /// @param id Identifies which group of inputs to effect.
   /// @param value The new interrupt mask value.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Din32SetMaskHigh2Low( uint8 id, uint32 value ){
      return sdo.Dnld32( IOOBJID_DIN_32_MASK_H2L, id+1, value );
   }

   //@}

   /***************************************************************************/
   /** \name Digital output control

     If the module contains digital outputs, these methods may be used to configure
     and set those outputs.  The outputs may be set and controlled individually, 
     or in groups of 8, 16 or 32 outputs.

     All I/O modules should support access to digital outputs in groups of 8.  
     Support for individual access or different groupings is optional under the 
     spec.  If a particular device does not support such groupings, an attempt 
     to use them should return an error code.

     Each output pin or group of pins is assigned an ID number used to access it.
     When single outputs are accessed, these ID numbers range from 0 (the first output)
     to N-1 (the last output), where N is the total number of output pins available
     on the module.

     When groups of outputs are accessed as a unit, the group is assigned a number.
     The first group of outputs will be assigned ID number 0, the second will be ID 1,
     etc.  The number of groups of a particular size will be the total number of outputs
     divided by the group size.

     For example, to access the twenty seventy output pin individually you would use id
     number 26.  To access it as part of a group of 8 outputs, you would access group
     number 3 (26/8).  Output 26 would be bit 2 (26%8) of that group.

*/
   /***************************************************************************/
   //@{

   /// Return the number of individual outputs available on this device.
   /// @param ct The count is returned here.  Zero is returned on error.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutGetCt( uint16 &ct ){
      ct = 0;
      return BitCount( IOOBJID_DOUT_1_VALUE, ct );
   }

   virtual const Error *DoutWrite( uint16 id, bool value, bool viaSDO=false );

   /// Get the current polarity setting for an individual digital output.
   /// A value of true enables inversion and false disables.
   /// @param id Identifies the output to read.
   /// @param value The current polarity setting of the output line is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutGetPol( uint16 id, bool &value ){
      return BitUpld( IOOBJID_DOUT_1_POL, id, value );
   }

   /// Set the current polarity setting for an individual digital output.
   /// A value of true enables inversion and false disables.
   /// @param id Identifies which digital output to effect.
   /// @param value The new polarity setting of the output line.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutSetPol( uint16 id, bool value ){
      return BitDnld( IOOBJID_DOUT_1_POL, id, value );
   }

   /// Get the current filter constant setting for an individual digital output.
   /// A value of true enables the filter, false disables.
   /// @param id Identifies the output to read.
   /// @param value The current filter setting of the output line is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutGetFilt( uint16 id, bool &value ){
      return BitUpld( IOOBJID_DOUT_1_FILT, id, value );
   }

   /// Set the current filter constant setting for an individual digital output.
   /// A value of true enables the filter, false disables.
   /// @param id Identifies which digital output to effect.
   /// @param value The new filter setting of the output line.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutSetFilt( uint16 id, bool value ){
      return BitDnld( IOOBJID_DOUT_1_FILT, id, value );
   }

   /// Get the current error mode setting for an individual digital output.
   /// A value of true will cause the output to take it's programmed error value 
   /// on a device failure.  Setting the mode to false will cause the output to 
   /// hold it's programmed value on failure.
   /// @param id Identifies the output to read.
   /// @param value The current error mode setting of the output line is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutGetErrMode( uint16 id, bool &value ){
      return BitUpld( IOOBJID_DOUT_1_ERRMODE, id, value );
   }

   /// Set the current error mode setting for an individual digital output.
   /// A value of true will cause the output to take it's programmed error value 
   /// on a device failure.  Setting the mode to false will cause the output to 
   /// hold it's programmed value on failure.
   /// @param id Identifies which digital output to effect.
   /// @param value The new error mode setting of the output line.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutSetErrMode( uint16 id, bool value ){
      return BitDnld( IOOBJID_DOUT_1_ERRMODE, id, value );
   }


   /// Get the current error value setting for an individual digital output.
   /// Error values define the state of the output if a device failure occurs.
   /// The error value will only be set for those output pins which have an error
   /// mode set to true.  Those with error mode set to false will not be changed by
   /// a device failure.
   /// @param id Identifies the output to read.
   /// @param value The current error value setting of the output line is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutGetErrValue( uint16 id, bool &value ){
      return BitUpld( IOOBJID_DOUT_1_ERRVAL, id, value );
   }

   /// Set the current error value setting for an individual digital output.
   /// Error values define the state of the output if a device failure occurs.
   /// The error value will only be set for those output pins which have an error
   /// mode set to true.  Those with error mode set to false will not be changed by
   /// a device failure.
   /// @param id Identifies which digital output to effect.
   /// @param value The new error value setting of the output line.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *DoutSetErrValue( uint16 id, bool value ){
      return BitDnld( IOOBJID_DOUT_1_ERRVAL, id, value );
   }

   /// Return the number of 8-bit groups of outputs available on this device.
   /// @param ct The count is returned here.  Zero is returned on error.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Dout8GetCt( uint8 &ct ){
      ct = 0;
      return sdo.Upld8( IOOBJID_DOUT_8_VALUE, 0, ct );
   }

   const Error *Dout8Write( uint8 id, uint8 value, bool viaSDO=false );

   /// Get the current polarity settings for a group of 8 digital outputs.
   /// For each output in the group, a value of 1 enables inversion and 0 disables.
   /// @param id Identifies which group of outputs to read.
   /// @param value The current polarity setting of the output lines is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Dout8GetPol( uint8 id, uint8 &value ){
      return sdo.Upld8( IOOBJID_DOUT_8_POL, id+1, value );
   }

   /// Set the current polarity setting for a group of 8 digital outputs.
   /// For each output in the group, a value of 1 enables inversion and 0 disables.
   /// @param id Identifies which group of outputs to effect.
   /// @param value The new polarity setting of the output lines.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Dout8SetPol( uint8 id, uint8 value ){
      return sdo.Dnld8( IOOBJID_DOUT_8_POL, id+1, value );
   }

   /// Get the current filter constant settings for a group of 8 digital outputs.
   /// For each output in the group, a value of 1 enables the filter, 0 disables.
   /// @param id Identifies which group of outputs to read.  
   /// @param value The current filter setting of the output lines is returned here.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Dout8GetFilt( uint8 id, uint8 &value ){
      return sdo.Upld8( IOOBJID_DOUT_8_FILT, id+1, value );
   }

   /// Set the current filter constant setting for a group of 8 digital outputs.
   /// For each output in the group, a value of 1 enables the filter, 0 disables.
   /// @param id Identifies which group of outputs to effect.
   /// @param value The new filter setting of the output lines.
   /// @return A pointer to an error object, or NULL on success
   virtual const Error *Dout8SetFilt( uint8 id, uint8 value ){
      return sdo.Dnld8( IOOBJID_DOUT_8_FILT, id+1, value );
   }

⌨️ 快捷键说明

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