flex_object_mem_manage

NI-Motion Functions

flex_object_mem_manage

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

Object Memory Management

Usage

status = flex_object_mem_manage(u8 boardID, u8 object, u16 operation);

Purpose

Saves, deletes, or frees programs or buffers in RAM and ROM.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
object u8 program or other memory object
operation u16 operation to perform on the object

Parameter Discussion

object is a program or buffer stored in onboard RAM or ROM.

operation is the operation to perform on the memory object.

operation Constant operation Value
NIMC_OBJECT_SAVE 0
NIMC_OBJECT_DELETE  1
NIMC_OBJECT_FREE 2

Using This Function

This function is used to save to ROM, delete from ROM, or free from RAM, a program or buffer object. Objects saved to non-volatile Flash ROM are available for use at any future time, even after power cycles.

To save an object to ROM, call this function with operation = NIMC_OBJECT_SAVE. The object is copied to ROM and exists in both RAM and ROM until the next power cycle, when the RAM image is erased.

To remove an object from ROM, call this function with operation = NIMC_OBJECT_DELETE. The object is deleted from both ROM and RAM if it still exists in RAM.

After you have saved an object to ROM, you can free up its space in RAM by calling this function with operation = NIMC_OBJECT_FREE. This has no effect on the copy in ROM but deletes the image in RAM, making more memory available for storing additional programs or other objects.

Note  You cannot save or delete an object while any program is running or any buffer is in use. Also, you cannot free a program or buffer while it is running. In addition, you cannot save or delete an object when any motor is moving. Attempting to execute this function in these cases generates an error.

You can delete a buffer that is active, such as a high-speed capture buffer that is waiting for a trigger, but NI-Motion returns an error in this case.
Tip  Saving or deleting an object takes 2 to 4 seconds.

The 7340/7330 controller has 64 KB of RAM plus 128 KB of ROM (divided into two 64 KB sectors) for program and buffer storage. You can run programs from either RAM or ROM, but you cannot split programs between the two, and you cannot split programs between the two 64 KB ROM sectors. With an average command size of 10 bytes, a single program can be as large as 6,400 commands. As another example, the 7340/7330 controller can simultaneously execute 10 programs, five from RAM and five from ROM, with each program up to 1,280 commands long.

Like programs, buffers can be stored in RAM or ROM. The maximum buffer size is somewhat less than 64 KB (16,000 samples), because some of each sector is used for record keeping.

This function may take longer than 62 ms to process, so it is not guaranteed to be compatible with real-time execution.