industrialNETworXnetx

th_elste

th_elste

| 18.06.2009 | 13:07 | 2 replies

Howto create non-array objects in the object dictionary

Hi,

I've a little problem with the creation of a custom object dictionary. I'm trying to create simple objects (no arrays or records, this works btw.) in the OD of a cifX slave (via packet, using the C-Toolkit and firmware 2.1.2.0).

For example, if I want to create an unsigned int 32 with index 0x7000, I've tried using the following data for the ECAT_OD_CREATE_OBJECT_REQ and ECAT_OD_CREATE_SUBOBJECT_REQ packets (separately or in combination):

usIndex=0x7000;
bNumOfSubObj=1;
bMaxSubObjs=1;
usObjAccess=6;
bObjectCode=OBJCODE_VAR; /* 7 */
usDatatype=OBJTYPE_UNSIGNED32; /* 7 */

usMode=ECAT_OD_SUBOBJECT_MODE_STORAGE;
usIndex=0x7000;
bSubIdx=0;
usDirection=ECAT_OD_SUBOBJECT_DIRECTION_NOT_DEF;
usSubObjAccess=ECAT_OD_ACCESS_ALL;
usDatatype=OBJTYPE_UNSIGNED32; /* 7 */
usFieldLen=1;
usRelativeAddress=0;

Although both packets (separately or in combination) get accepted with no error, the object entry is not recognized afterwards by the master. As I've already mentioned, creating array objects (bObjectCode=8) with subobjects works without a problem. So there seems to be no general problem with my code talking to the od stack. Are all the parameters correct? This is almost excatly the example from the ecs protocol manual and probably it's some stupid mistake I've made but I can't find any reason, why this doesn't work.

regards
Thomas

code- small

code- small

Hilscher Gesellschaft für Systemautomation mbH

| 18.06.2009 | 14:02

Hi,

due to the implementation of the object dictionary the subIndex value in the ECAT_OD_CREATE_SUBOBJECT_REQ must be 1.

Regards,

code-small

th_elste

th_elste

| 18.06.2009 | 14:24

Ah, as always just one bit wrong... Now it's working. :D

Thank you very much for the fast advice
Thomas

Login