Appendix E: The I/O Object
Streszczenie: Obiekt IOObj dla modułów wejść/wyjść CANopen: inicjalizacja (InitializeExt, IOSettingsObj), zdarzenia modułu, wejścia i wyjścia analogowe (odczyt, zapis, limity, delty, typy wyzwalania, tryb błędu) i cyfrowe (grupy po 8, maski przerwań, wartości błędów) oraz ustawienia PDO, heartbeat i node guarding.
EN: The I/O object for CANopen I/O modules: analog and digital inputs/outputs, events, PDO and heartbeat settings.
Dotyczy: Copley Motion Objects (CMO, biblioteka COM CMLCOMLib) – sterowanie serwonapędami Copley CANopen z PC (Windows; VB 6.0, VB .NET, LabVIEW)
Źródło: dokumentacja producenta (Copley Motion Objects Programmer’s Guide); tabele przepisane z obrazów na tekst – opracowanie Multiprojekt
This appendix describes IOObj2, used to access I/O devices that comply to the CiA profile DS401: CANopen Device Profile for Generic I/O Modules.
Note: Unless otherwise stated, all properties described in this appendix have read/write access. All methods return an HRESULT. In the event of an error, CMO reports the error in the form of COM-compatible error objects. See Error Handling.
E.1:1 I/O Modules
The functions described here support I/O devices that comply to the CiA profile DS-401: CANopen Device Profile for Generic I/O Modules.
E.1.1:1 General IOObj Methods and Properties
The methods and properties described below are members of CMLCOMLib.IOObj
| Member | Description |
|---|---|
Method Initialize (canOpenObj As ICANopenObj, nodeId As Integer) | Initializes the I/O device with the CANOpenObj and the specified node ID. Parameters: canOpenObj – an instance of a CanOpenObj that has already been initialized; nodeid – the node ID of the I/O module. |
Method InitializeExt (canOpenObj As ICANopenObj, nodeId As Integer, IOSettingsObj As CMLCOMLib.IOSettings) | Initializes the I/O device with the CANOpenObj and the specified node ID. Also, through the IOsettingsObj parameter, allows the CAN network settings for an I/O module to be set at initialization time. This is necessary if PDO mapping is to be turned off for a particular I/O module. Parameters: canOpenObj – an instance of a CanOpenObj that has already been initialized; nodeid – the node ID of the I/O module; IOsettingsObj – allows the CAN network settings for an I/O module to be set at initialization time, see E.1.6: IOSettingsObj. |
Method CreateEvent (mask As CML_IOMODULE_EVENTS, condition As CML_EVENT_CONDITION, eventObject As EventObj) | Creates an instance of the EventObj (see The Event Object) that monitors I/O events and sets them up using the specified parameters. Parameters: mask – a bit-mapped value that indicates which events are to be monitored; condition – trigger condition for the events that will result in the callback method being called (e.g. all events in the mask), see Event Conditions; eventObject – the EventObj instance created by this method. |
CML_IOMODULE_EVENTS Module Events (members of CMLCOMLib.CML_IOmodule_Events; used to select the IO events trigger state)
| Value (Const) | Description |
|---|---|
| IOEVENT_AIN_PDO0 = 65536 | Trigger when any of the first 4 analog inputs generates an event. |
| IOEVENT_AIN_PDO1 = 131072 | Trigger when any of the second 4 analog inputs generates an event. |
| IOEVENT_AIN_PDO2 = 262144 | Trigger when any of the third 4 analog inputs generates an event. |
| IOEVENT_DIN_PDO0 = 1 | Trigger when first 64 digital inputs change state. |
| Member | Description |
|---|---|
Method SDO_Dnld(index As Integer, sub As Integer, variantData As VARIANT) | Downloads data to the IO module via a CAN SDO transfer. Parameters: index – index of a CANopen dictionary object; sub – sub-index of a CANopen dictionary object; variantData – the data that is to be transferred. This data can be one of four types: 8-bit, 16-bit, 32-bit, or String. |
Method SDO_Upld(index As Integer, sub As Integer, variantData As VARIANT) | Uploads data from the IO module via a CAN SDO transfer. Parameters: index – index of a CANopen dictionary object; sub – sub-index of a CANopen dictionary object; variantData – the data that is to be transferred. This data can be one of four types: 8-bit, 16-bit, 32-bit, or String. |
E.1.2:2 IOObj Methods and Properties for Analog Inputs
The methods and properties described below, members of CMLCOMLib.IOObj, relate to analog inputs.
| Member | Description |
|---|---|
Method Ain16Read(channel As Integer, value As Integer, viaSDO As Boolean) | Reads a 16-bit analog input. Parameters: channel – the analog input channel ID; value – the analog input value read; viaSDO – if True, read inputs using SDO transfer. If False (default), use most recently received PDO data, if this input is mapped to a transmit PDO and the PDO is active. |
Property AinIntEnable As Boolean | Current setting of the global interrupt enable for analog inputs. |
Method AinTrigTypeRead(channel As Integer, trigger As CML_IO_AIN_TRIG_TYPE) / Method AinTrigTypeWrite(channel As Integer, trigger As CML_IO_AIN_TRIG_TYPE) | Reads/writes the analog input trigger type associated with input channel. Use this command to set/get the type of event associated with an analog input. Parameters: channel – the analog input channel ID; trigger – the analog input trigger type associated with input channel. |
Module Analog Input Trigger Types (CML_IO_AIN_TRIG_TYPE) – members of CMLCOMLib.CML_IO_AIN_Trig_Type
| Value (Const) | Description |
|---|---|
| IOAINTRIG_UPPER_LIM = 1 | Input above upper limit. |
| IOAINTRIG_LOWER_LIM = 2 | Input below lower limit. |
| IOAINTRIG_UDELTA = 4 | Input changed by more then the unsigned delta amount. |
| IOAINTRIG_NDELTA = 8 | Input reduced by more then the negative delta amount. |
| IOAINTRIG_PDELTA = 16 | Input increased by more then the positive delta. |
| Member | Description |
|---|---|
Method Ain16LowerLimitRead (channel As Integer, limit As Integer) / Method Ain16LowerLimitWrite (channel As Integer, limit As Integer) | Reads/writes the analog input lower limit value as a 16-bit integer. The lower limit defines the value at which an interrupt will be generated if it is enabled. Parameters: channel – the analog input channel ID; limit – the analog input lower limit value. |
Method Ain16NegativeDeltaRead(channel As Integer, delta As Integer) / Method Ain16NegativeDeltaWrite(channel As Integer, delta As Integer) | Reads/writes the analog input negative delta value as a 16-bit integer. The negative delta defines the amount of change at which an interrupt will be generated if it is enabled. Parameters: channel – the analog input channel ID; delta – the analog input negative delta value. |
Method Ain16PositiveDeltaRead(channel As Integer, delta As Integer) / Method Ain16PositiveDeltaWrite(channel As Integer, delta As Integer) | Reads/writes the analog input positive delta value as a 16-bit integer. The positive delta defines the amount of change at which an interrupt will be generated if it is enabled. Parameters: channel – the analog input channel ID; delta – the analog input positive delta value. |
| Member | Description |
|---|---|
Method Ain16UnsignedDeltaRead(channel As Integer, delta As Integer) / Method Ain16UnsignedDeltaWrite(channel As Integer, delta As Integer) | Reads/writes the analog input unsigned delta value as a 16-bit integer. The unsigned delta defines the amount of change at which an interrupt will be generated if it is enabled. Parameters: channel – the analog input channel ID; delta – the analog input unsigned delta value. |
Method Ain16UpperLimitRead(channel As Integer, limit As Integer) / Method Ain16UpperLimitWrite(channel As Integer, limit As Integer) | Reads/writes the analog input upper limit value as a 16-bit integer. The upper limit defines the value at which an interrupt will be generated if it is enabled. Parameters: channel – the analog input channel ID; limit – the analog input upper limit value. |
E.1.3:3 IOObj Methods and Properties for Analog Outputs
The methods and properties described below, members of CMLCOMLib.IOObj, relate to analog outputs.
| Member | Description |
|---|---|
Method Aout16Write(channel As Integer, value As Integer, viaSDO As Boolean) | Writes to a 16-bit analog output. Parameters: channel – the analog input channel ID (as printed; the analog output channel); value – the value to write; viaSDO – if true, the outputs will be written using SDO messages. If false (default), then a PDO will be used if possible. |
Method AoutErrModeRead(channel As Integer, mode As Boolean) / Method AoutErrModeWrite(channel As Integer, mode As Boolean) | Reads/writes the analog output error mode. If the error mode is True, then the analog output will change its value to the programmed error value in the case of a device failure. If False, a device failure will not cause a change in the analog output value. Parameters: channel – the analog output channel ID; mode – the analog output error mode. |
Method Aout16ErrorValueRead(channel As Integer, error As Integer) / Method Aout16ErrorValueWrite(channel As Integer, error As Integer) | Reads/writes the analog out error value. Parameters: channel – the analog input channel ID (as printed; the analog output channel); error – the analog output error value. |
E.1.4:4 IOObj Methods and Properties for Digital Inputs
The methods and properties described below, members of CMLCOMLib.IOObj, relate to digital
inputs.
| Member | Description |
|---|---|
Method Din8Read(group As Integer, value As Integer, viaSDO As Boolean) | Reads a group of 8 digital inputs. Parameters: group – identifies which group of 8 to read; value – the value of the input; viaSDO – if true, read inputs using the SDO transfer. If false (default) use the most recently received PDO data if this input group is mapped to a transmit PDO and the PDO is active. |
Property DinIntEnable As Boolean | Current setting of the global interrupt enable of digital inputs. |
Method Din8MaskAnyRead(group As Integer, mask As Integer) / Method Din8MaskAnyWrite(group As Integer, mask As Integer) | Reads/writes the 'any transition' interrupt mask setting for a group of 8 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. Parameters: group – identifies which group of 8 inputs to read/write; mask – the 'any transition' interrupt mask. |
Method Din8MaskHigh2LowRead(group As Integer, mask As Integer) / Method Din8MaskHigh2LowWrite(group As Integer, mask As Integer) | Reads/writes the 'high to low' interrupt mask setting for a group of 8 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. Parameters: group – identifies which group of 8 inputs to read/write; mask – the 'high to low' interrupt mask. |
Method Din8MaskLow2HighRead(group As Integer, mask As Integer) / Method Din8MaskLow2HighWrite(group As Integer, mask As Integer) | Reads/writes the 'low to high' interrupt mask setting for a group of 8 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. Parameters: group – identifies which group of 8 inputs to read/write; mask – the 'low to high' interrupt mask. |
E.1.5:5 IOObj Methods and Properties for Digital Outputs
The methods and properties described below, members of CMLCOMLib.IOObj, relate to digital outputs.
| Member | Description |
|---|---|
Method Dout8Write(group As Integer, value As Integer, viaSDO As Boolean) | Writes a group of 8 digital outputs. Parameters: group – identifies which group of outputs to write; value – value to write to group; viaSDO – if true, outputs are written using SDO message. If false (default), a PDO is used if possible. |
Method Dout8ErrModeRead(group As Integer, mode As Integer) / Method Dout8ErrModeWrite(group As Integer, mode As Integer) | Reads/writes the current error mode setting of a group of 8 digital outputs. For each output in the group, a value of 1 will cause the output to take its programmed error value on a device failure. Setting the mode to 0 will cause the output to hold its programmed value on failure. Parameters: group – identifies the group of outputs to read/write; mode – the current error mode setting of a group of 8 digital outputs. |
Method Dout8ErrValueRead (group As Integer, error As Integer) / Method Dout8ErrValueWrite(group As Integer, error As Integer) | Reads/writes the current error value setting for a group of 8 digital outputs. Error values define the state of the output if a device failure occurs. The error value will only be set for those output pins that have an error mode set to 1. Those with error mode set to zero will not be changed by a device failure. Parameters: group – identifies the group of outputs to read/write; error (printed as "mode") – the current error value setting for a group of 8 digital outputs. |
E.1.6:6 IOSettingsObj
The following IO parameters are members of CMLCOMLib. IOSettingsObj. An instance of this object is obtained from the IOObj.
| Member | Description |
|---|---|
Property useStandardDinPDO | Use the standard digital input PDO object (default = true). |
Property UseStandardDoutPDO | Use the standard digital output PDO object (default = true). |
Property UseStandardAinPDO | Use the standard analog input PDO object (default = true). |
Property UseStandardAoutPDO | Use the standard analog output PDO object (default = true). |
heartBeatPeriod | Configures the heartbeat period used by this IO module to transmit its heartbeat message. If this property is set to zero, then the heartbeat protocol is disabled on this module. Units: milliseconds. Default: 0. |
heartbeatTimeout | Additional time to wait before generating a heartbeat error. Units: milliseconds. Default: 0. |
guardTime | This object gives the time between node-guarding requests that are sent from the network master to this IO module. The IO module will respond to each request with a node-guarding message indicating the internal state of the IO module. Units: milliseconds. Default: 0. If the IO module has not received a node-guarding request within the time period defined by the product of the guard time and the lifeFactor, the IO module will treat this lack of communication as a fault condition. |
lifeFactor | This property gives a multiple of the guardTime parameter. The IO module expects to receive a node-guarding request within the time period defined by the product of the guard time and the lifetime factor. If the IO module has not received a node-guarding request within this time period, it treats this condition as a fault. Default = 3. |
Słowa kluczowe
IOObj, moduł I/O, IOSettingsObj, Ain16Read, Aout16Write, Din8Read, Dout8Write, CML_IO_AIN_TRIG_TYPE, maska przerwań, PDO, SDO, heartbeat, guardTime






