Compiler directives for buffer allocation, 193, an – Echelon Neuron C User Manual

Page 205

Advertising
background image

Neuron C Programmer’s Guide

193

• If your device is installed with

unicast

connections (that is, one device

sends a network variable or message to one other device), the default

number of network buffers is probably sufficient.

• If your device is installed with

multicast

acknowledged or multicast

request connections (that is, one device sends a message to a group of

devices and expects a response from each), the number of network input

buffers should be at least equal to the size of the largest group.

• If your application frequently has blocking sequences, that is, when tasks

that do not complete for a relatively long time, the default application
buffer count might be insufficient.

If, for example, a device sends a message with the acknowledged or request

service to 63 different devices, the sender device could receive 63 almost
simultaneous acknowledgments or responses. In general, large acknowledged

connections should not be used because the same message delivery reliability can
be achieved using repeated messaging, with far less network traffic. Network

variable updates using the repeated delivery service do not generate any

acknowledgements, and therefore do not require any input buffers.

The exact number of network input buffers required is a function of both bit rate

and the system clock rate, so some experimentation might be necessary to

determine the minimum number of buffers.

Compiler Directives for Buffer Allocation

The following sections describe the compiler directives used for setting the size

and number of different types of buffers.
The compiler issues warnings when any of the buffer size compiler directives are
used and the resulting settings are too small to accommodate all possible

network management messages from being properly received or responded to.
Each of the buffer directives can include an optional modifier specification after
the number of buffers. The modifier can be either of the following keywords:

• minimum

The minimum keyword specifies that the number of buffers indicated for

the pragma directive is the

minimum

number of buffers required for the

application. The compiler defines at least as many buffers as specified in

the directive, but could define additional buffers if the application

requires them. This keyword encourages modular development, wherein
different modules could have different buffer count or size requirements.

• final

The final keyword specifies that the number of buffers indicated for the

pragma directive is the

absolute

number of buffers to be used by the

application. The compiler defines exactly as many buffers as specified in

the directive, and issues an error if additional buffers are required. This
keyword promotes self-documenting source code.

Example: The following two directives specify the incoming network buffers.

The first directive specifies that the compiler should define at least 66-byte

Advertising