CANopen Object Dictionary Entry Definition
This block creates an object dictionary entry.
Block ID
CANopen OD Entry Definition
Library
motohawk_canopen_lib
Description

This block creates an object dictionary entry with unique index and subindex. It provides an interface to write or read a value, which could be used in blocks that send or receive CANopen messages.
Internal / External Object Dictionary
Object dictionary entry could be defined as internal or external.
- Internal entries represent object dictionary data of the referenced CANopen instance. They could be used by SDO server upload and download, PDO Tx and Rx protocol, LSS Slave or CANopen instance definition object dictionary references.
- External entries represent object dictionary data of an external node. When it is required to receive object dictionary data from another CANopen instance, it will be writen to the corresponding external object dictionary entry. When it is required to send object dictionary data to another CANopen instance, it will be read from the external object dictionary entry and transmitted to the other CANopen instance. External object dictionary entries are used with SDO client upload and download blocks.
Which ports are available differ depending on selected internal/external option.
Port configurations :
Ports are available only when data source in definition script is set to a value of 2. When data source is set to a constant (1) or a data store (3) there are no inputs or outputs.
- There is one input when :
- entry is internal and access type is read only
- entry is external and access type is write only
- There are two outputs when :
- entry is internal and access type is write only
- entry is external and access type is read only
- There are one input and two outputs when :
- entry is internal or external and access type is read-write
The input supplies the object dictionary entry with a value that would be sent to another CANopen instance.
Output ports supply values that have been received from another CANopen instance and Data Available parameter indicates that new data has been received.
Object dictionary definition script
Object dictionary script must be defined by following structure format :
| objdb.name | = | 'EXT_OD_6000_00'; |
| objdb.is_external_od_entry | = | true; |
| objdb.index | = | hex2dec('6000'); |
| objdb.sub_index | = | 0; |
| objdb.description | = | 'Battery Status'; |
| objdb.units | = | ''; |
| objdb.data_type | = | 'UNSIGNED8'; |
| objdb.data_source | = | 2; |
| objdb.entry_access_type | = | 'RO'; |
| objdb.data_default | = | 1; |
| objdb.data_datastore_name | = | ''; |
| objdb.transform.numerator | = | 1; |
| objdb.transform.denominator | = | 1; |
| objdb.transform.offset | = | 0; |
| objdb.transform.minimum | = | 0; |
| objdb.transform.maximum | = | 1; |
| objdb.transform.saturate | = | true; |
Object dictionary definition script examples are included with the CANopen block set. Suggested arrangement is to have all object dictionary entries associated with the same CANopen instance in a single file. However it is possible to organize it differently as long as resulting structure, which is used as a OD definition parameter, has the same format as the above example.
Description of script parameters (if not marked as optional, parameter is mandatory):
- name - unique name of object dictionary entry
- is_external_od_entry - defines if object dictionary entry is internal (module parameters) or external (external node parameters)
- Internal object dictionary entry is an internal parameter of this CANopen instance
- External object dictionary entry is a duplicate of an entry from an external node
- index - object dictionary numerical index value
- sub_index - sub index of object dictionary entry
- description - brief description, optional parameter
- units - value units, optional parameter
- data_type - data type of value, naming should comply to CANopen specification
- data_source - source of value
- 1 - constant value defined in data_default field
- 2 - port
- 3 - data store
- entry_access_type - access type of value
- 'RO' - read only
- 'WO' - write only
- 'RW' - read and write
- data_default - default value of parameter. For strings it is important to provide data_default with maximum length of possible string. If desired default data is shorter than maximum length of accepted string, fill it with '0'. Length of data_default determines maximum length of accepted string
- data_datastore_name - name of data store, ignored if data_source is different than 3
- transform fields - fields that determines what operations are performed on received value before storing it to object dictionary entry. These fields are optional.
- Numerator - if not defined defaults to 1
- Denominator - if not defined defaults to 1
- Offset - if not defined defaults to 0
- Minimum - must be higher than this value, if if not defined defaults to minimum possible value that could be stored in provided data type
- Maximum - must be lower than this value, if not defined defaults to maximum possible value that could be stored in provided data type
- Saturate - used only in SDO protocol, if not defined defaults to false
- when true, a value that exceeds minimum or maximum value is saturated
- when false, a value that exceeds minimum or maximum value is rejected and abort code is sent in response
Block Parameters
| Parameter Field | Values | Comments/Description |
|---|---|---|
| CANopen Instance Reference | String | Name of associated CANopen instance definition. |
| OD Definition | String | Evaluates to OD entry definition specified in the example script. |
