Sam Grove / canopen_slavenode

Description: CANfestival - an open source CANopen framework

Embed: (wiki syntax)

« Back to documentation index

You are viewing an out of date revision of canopen_slavenode! View latest revision

Object Dictionary Management

Object Dictionary Management

The Object Dictionary is the heart of each CANopen device containing all communication and application objects. More...

Data Structures

struct  struct_CO_Data
 This structure contains all necessary informations to define a CANOpen node. More...

Defines

#define getODentry(OD, wIndex, bSubindex, pDestData, pExpectedSize, pDataType,checkAccess)
 getODentry() to read from object and endianize
#define readLocalDict(OD, wIndex, bSubindex, pDestData, pExpectedSize, pDataType,checkAccess)
 readLocalDict() reads an entry from the object dictionary, but in contrast to getODentry(), readLocalDict() doesn't endianize entry and reads entry in machine native endianness.
#define setODentry(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
 setODentry converts SourceData from network byte order to machine native format, and writes that to OD.
#define writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
 Writes machine native SourceData to OD.

Detailed Description

The Object Dictionary is the heart of each CANopen device containing all communication and application objects.


Define Documentation

#define getODentry (   OD,
  wIndex,
  bSubindex,
  pDestData,
  pExpectedSize,
  pDataType,
  checkAccess 
)
Value:
_getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
                  pDataType,  checkAccess, 1)

getODentry() to read from object and endianize

Parameters:
ODPointer to a CAN object data structure
wIndexThe index in the object dictionary where you want to read an entry
bSubindexThe subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information
*pDestDataPointer to the pointer which points to the variable where the value of this object dictionary entry should be copied
pExpectedSizeThis function writes the size of the copied value (in Byte) into this variable.
*pDataTypePointer to the type of the data. See objdictdef.h
checkAccessFlag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes)
endianizeSet to 1 : endianized into network byte order
Returns:
  • OD_SUCCESSFUL is returned upon success.
  • SDO abort code is returned if error occurs . (See file def.h)

Definition at line 144 of file objacces.h.

#define readLocalDict (   OD,
  wIndex,
  bSubindex,
  pDestData,
  pExpectedSize,
  pDataType,
  checkAccess 
)
Value:
_getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
                  pDataType,  checkAccess, 0)

readLocalDict() reads an entry from the object dictionary, but in contrast to getODentry(), readLocalDict() doesn't endianize entry and reads entry in machine native endianness.

Parameters:
ODPointer to a CAN object data structure
wIndexThe index in the object dictionary where you want to read an entry
bSubindexThe subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information
*pDestDataPointer to the pointer which points to the variable where the value of this object dictionary entry should be copied
pExpectedSizeThis function writes the size of the copied value (in Byte) into this variable.
*pDataTypePointer to the type of the data. See objdictdef.h
checkAccessif other than 0, do not read if the data is Write Only [Not used today. Put always 0].
endianizeSet to 0, data is not endianized and copied in machine native endianness
Returns:
  • OD_SUCCESSFUL is returned upon success.
  • SDO abort code is returned if error occurs . (See file def.h)

Definition at line 174 of file objacces.h.

#define setODentry (   d,
  wIndex,
  bSubindex,
  pSourceData,
  pExpectedSize,
  checkAccess 
)
Value:
_setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
                  checkAccess, 1)

setODentry converts SourceData from network byte order to machine native format, and writes that to OD.

 // Example usage:
 UNS8 B;
 B = 0xFF; // set transmission type

 retcode = setODentry( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
Parameters:
dPointer to a CAN object data structure
wIndexThe index in the object dictionary where you want to write an entry
bSubindexThe subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information
*pSourceDataPointer to the variable that holds the value that should be copied into the object dictionary
*pExpectedSizeThe size of the value (in Byte).
checkAccessFlag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes)
endianizeSet to 1 : endianized into network byte order
Returns:
  • OD_SUCCESSFUL is returned upon success.
  • SDO abort code is returned if error occurs . (See file def.h)

Definition at line 233 of file objacces.h.

UNS32 writeLocalDict (   d,
  wIndex,
  bSubindex,
  pSourceData,
  pExpectedSize,
  checkAccess 
)

Writes machine native SourceData to OD.

Parameters:
dPointer to a CAN object data structure
wIndexThe index in the object dictionary where you want to write an entry
bSubindexThe subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information
*pSourceDataPointer to the variable that holds the value that should be copied into the object dictionary
*pExpectedSizeThe size of the value (in Byte).
checkAccessFlag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes)
endianizeData is not endianized and copied in machine native endianness
Returns:
  • OD_SUCCESSFUL is returned upon success.
  • SDO abort code is returned if error occurs . (See file def.h)

     // Example usage:
     UNS8 B;
     B = 0xFF; // set transmission type
    
     retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
    

Definition at line 266 of file objacces.h.