bufferActiveLength

bufferActiveLength — queries or sets the number of active bytes of a buffer.

Synopsis

       
(bufferActiveLength card_id buf_id [nbytes])
	

Parameters

card_id

The target card ID (0..3).

buf_id

The ID of the buffer.

nbytes

If specified, sets the number of bytes in the buffer that are active.

Returns

OK if successful. Otherwise, one of the following error messages:

(error "bufferActiveLength DR_ERR_CARD_INVALID (time) Invalid card: card_id")
(error "bufferActiveLength DR_ERR_BLK_INVALID (time) invalid buffer id: buf_id")

Description

This command queries or sets the number of bytes of a buffer that are active (actually transferred to the fieldbus card buffers). The command improves performance, since it would be wasteful to copy a complete card buffer (512 bytes for 2K cards or 3.5 Kbytes for 8K cards) where the system only contained a handful of devices. The default minimum for all buffers is 32 bytes, which is adequate for most small systems. If the digital or analog commands are used to create points, the active length is automatically increased based on the point address. A single point at the highest address is enough to guarantee that the necessary portion of the buffer is transferred. The bufferActiveLength command provides an explicit alternative to specify the buffer length.

Each of the input and output buffers maintains a separate active length. If using a point to set the active length, the point's address and read/write mode will dictate which buffer is effected. A point with a W or RW mode will always be associated with the output buffer (buffer 0). A second point with an address specifying buffer 1 and an R mode will be required to set the active length of the input buffer.

[Note]

The number of bytes that are actually transferred through the fieldbus is determined by the card configuration, which must agree with the block sizes presented by the field devices. These lengths should be the same as the active length.

Example

The following example sets the number of active bytes in buffer 0 of card 0 to 128.

(bufferActiveLength 0 0 128)