Basic Objects

The read and write of basic objects is symmetrical. Therefore the description is limited to read access. The data width of basic objects is 8bit (byte), 16bit (word) or 32bit (long). All widths are handled in the same way, therefore the description is limited to 32bit (long) object entries.

For a simple read access of a (hypothetical) 32bit object entry with an index=0x1234 and subindex=0x56, the service call is:

CODirRdLong(&demo.Dir, CO_DEV(0x1234,0x56), &value);

The following diagram shows the internal behavior of this service.


Figure - Read Basic Object


For multiple accesses to the same object entry, the following sequence reduces the performance overhead, which are based on searching within the object directory. The object functions takes the pre-searched object entry (see service CODirFind()) as first argument:


obj = CODirFind(&demo.Dir, CO_DEV(0x1234,0x56));
 
do {
    COObjRdValue(obj, &value, 4, 0);
 } while (value == 0);