flex_read_registry_rtn

NI-Motion Functions

flex_read_registry_rtn

Device Compatibility

Device Compatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Xenus
N
NI SoftMotion Controller for CANopen—Accelnet
N

Read Object Registry

Usage

status = flex_read_registry_rtn(u8 boardID, u8 index, REGISTRY* registryRecord);

Purpose

Reads a data record for a memory object from the Object Registry.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
index u8 registry record number
registryRecord REGISTRY* data record containing information about the memory object

Parameter Discussion

index is the registry record number. The range for index is 0 to 31.

registryRecord is the data record containing object information in the following structure:

   struct {
      u16 device; // Object number
      u16 type; // Object type. If 1, a program. If 2, a buffer.
      u32 pstart; // Start address in RAM or ROM
      u32 size; // Size of the object in words
   } REGISTRY;

Object type tells you the type of object stored:

Object type Value
NIMC_OBJECT_TYPE_PROGRAM  1
NIMC_OBJECT_TYPE_BUFFER 2

Size is in number of 16-bit words. For buffers, the size value returned is twice the size of the buffer as you configured it with the Configure Buffer function, where bufferSize is specified in 32-bit words.

If pstart < 0x100000, then the object is in Flash (ROM), otherwise, the object is in RAM.

Using This Function

This function returns a registry record for an object from the object registry. The object registry contains information about all objects stored in memory. You can store up to 32 objects in RAM and/or ROM. Each time an object is stored, a new record is created to keep track of it.

Note  If an object exists both in RAM and ROM, this function reports the object as existing in RAM. To see the object in ROM, you must first free the object from RAM.

On 7330 and 7340 motion controllers, objects are in RAM if pstart  0x100000, and in ROM if pstart < 0x100000. On the 7350 controller, objects are in RAM if pstart  0x200000, and in ROM if pstart < 0x200000.

Registry records are referenced by index and each call to this function returns information about the referenced object. The index is not the same as the object number. You can use up to 255 unique object numbers (0x01 through 0xFF) but only 32 objects can be stored in memory at one time.