CANopen Slave Documentation
Version 6.16.04
Loading...
Searching...
No Matches
cos301.h File Reference

Detailed Description

This module implements the variables and callback functions for the object dictionary from CiA 301 for various indices.

+ Include dependency graph for cos301.h:

Functions

void Cos301_ClearErrorRegister (uint8_t ubErrorValueV)
 
void Cos301_SetDeviceType (uint8_t ubLogicalDeviceV, uint32_t ulDeviceTypeV)
 
void Cos301_SetErrorRegister (uint8_t ubErrorValueV)
 

Variables

uint8_t ubIdx1001_ErrorRegisterG
 
uint32_t ulIdx1002_StatusRegisterG
 
uint8_t aubIdx1008_DeviceNameC []
 
uint8_t aubIdx1009_HwVersionC []
 
uint8_t aubIdx100A_SwVersionC []
 
uint8_t ubIdx1018_SubNumberC
 
uint32_t ulIdx1018_VendorIdC
 
uint32_t ulIdx1018_RevisionNumC
 
uint8_t ubIdx1022_EdsTypeC
 

Function Documentation

◆ Cos301_ClearErrorRegister()

void Cos301_ClearErrorRegister ( uint8_t  ubErrorValueV)
Parameters
[in]ubErrorValueVbit coded error value
See also
Cos301_SetErrorRegister()

This function clears the value of object 1001h. The error flag eCoErrReg_GENERIC can only be cleared if no other error is currently active.

◆ Cos301_SetDeviceType()

void Cos301_SetDeviceType ( uint8_t  ubLogicalDeviceV,
uint32_t  ulDeviceTypeV 
)
Parameters
[in]ubLogicalDeviceVLogical device number
[in]ulDeviceTypeVDevice type value

This function sets the value of object 1000h (Device type). For CANopen FD, the data object provides the number of implemented logical devices, the type of each implemented logical device and the provided functionality. The parameter ubLogicalDeviceV defines the logical device number, the first logical device starts at index 1.

For Classical CANopen, the value of ubLogicalDeviceV must be 1.

◆ Cos301_SetErrorRegister()

void Cos301_SetErrorRegister ( uint8_t  ubErrorValueV)
Parameters
[in]ubErrorValueVbit coded error value
See also
Cos301_ClearErrorRegister()

This function sets the value of object 1001h. The generic error flag eCoErrReg_GENERIC is set automatically.

Variable Documentation

◆ aubIdx1008_DeviceNameC

aubIdx1008_DeviceNameC
extern

Device name string (Index 1008h)

Todo:
Set this string to the desired device name (cos_user.c)

The string aubIdx1008_DeviceNameC holds the name of the device.

#if COS_DICT_OBJ_1008 == 1
uint8_t aubIdx1008_DeviceNameC[] = "CANopen Stack template";
#endif
uint8_t aubIdx1008_DeviceNameC[]
Device name string (Index 1008h)

◆ aubIdx1009_HwVersionC

aubIdx1009_HwVersionC
extern

Device hardware version (Index 1009h)

Todo:
Set this string to the current device hardware version (cos_user.c)

The string ubIdx1009_HwVersionC holds the hardware version of the device.

#if COS_DICT_OBJ_1009 == 1
uint8_t aubIdx1009_HwVersionC[] = "1.00";
#endif
uint8_t aubIdx1009_HwVersionC[]
Device hardware version (Index 1009h)

◆ aubIdx100A_SwVersionC

aubIdx100A_SwVersionC
extern

Device software version (Index 100Ah)

Todo:
Set this string to the current device software version (cos_user.c)

The string aubIdx100A_SwVersionC holds the software version of the device.

#if COS_DICT_OBJ_100A == 1
uint8_t aubIdx100A_SwVersionC[] = "1.00";
#endif
uint8_t aubIdx100A_SwVersionC[]
Device software version (Index 100Ah)

◆ ubIdx1001_ErrorRegisterG

ubIdx1001_ErrorRegisterG
extern

Error register (Index 1001h)

The variable ubIdx1001_ErrorRegisterG holds the error status of the device. It must be set by the application program.

◆ ubIdx1018_SubNumberC

ubIdx1018_SubNumberC
extern

Identity object (Index 1018h)

Todo:
Set this value to the number of supported sub-indices. It is recommended to support all possible entries (cos_user.c).

The value ubIdx1018_SubNumberC holds the number of supported sub-indices.

◆ ubIdx1022_EdsTypeC

ubIdx1022_EdsTypeC
extern

EDS type (Index 1022h)

Todo:
Set this value to your EDS file type (cos_user_eds.c).

The value ubIdx1022_EdsTypeC holds the EDS file type, ie. the contents of object 1021h.

◆ ulIdx1002_StatusRegisterG

ulIdx1002_StatusRegisterG
extern

Manufacturer status register (Index 1002h)

The variable ulIdx1002_StatusRegisterG holds a manufacturer specific value (32 bit). It must be set by the application program.

◆ ulIdx1018_RevisionNumC

ulIdx1018_RevisionNumC
extern

Identity object - revision number (Index 1018h)

Todo:
Set this value to your software revision number (cos_user.c).

The value ulIdx1018_RevisionNumC consists of a major revision number and a minor revision number. The major revision number identifies a specific CANopen behavior. If the CANopen functionality is expanded, the major revision has to be incremented. The minor revision number identifies different versions with the same CANopen behavior.

◆ ulIdx1018_VendorIdC

ulIdx1018_VendorIdC
extern

Identity object - vendor ID (Index 1018h)

Todo:
Set this value to your CANopen vendor ID (cos_user.c).

The value ulIdx1018_VendorIdC holds the CANopen vendor ID. The vendor ID is assigned by the CiA office.