Protocol processing initialization:

The procedure for initializing the protocol processing is identical for all controllers used in this example.

The initialization of the protocol processing and the required resources is done in the controller configuration.

../_images/2d28aa85e38bd3b80a33139000eba54e

The desired receive buffer length in bytes is specified using the parameter “Size of receive buffer”. All received telegrams are first stored in this buffer and can then be read by means of the ETH_UDP_REC block. Aside from the actual user data of a telegram the sender’s IP address and the telegram length are stored. The value 8192 bytes should be sufficient for most applications.

The parameters “Size of transmit buffer high prio” and “Size of transmit buffer low prio”  are used to specify the transmit buffer sizes for telegrams with high or low priority in bytes. UDP telegrams can be transmitted either with normal or high priority. For each priority a separate transmit buffer is available. If only one transmit priority is used in the program, the corresponding transmit buffer has to be configured with a sufficient size.

If mixed priorities are used, the telegrams with high priority are transmitted first. Telegrams with normal priority (if available) are not transmitted until the transmit buffer for telegrams with high priority does no longer contain any telegrams. If another message with high priority is written into the transmit buffer before the transmission of all telegrams with normal priority is finished, the normal priority transmission is interrupted for the transmission of the high priority message. After this, the transmission of telegrams with normal priority is continued.

The parameter “Size of timeout buffer” is used to specify the length of the timeout buffer. This buffer is used to automatically store information about telegrams which could not be transmitted to the recipient due to an error. Errors can be caused e.g. by an interrupted Ethernet line, an incorrectly specified IP address for the recipient which does not exist in the network or a recipient controller which is in STOP state.

The parameter “Receive broadcast” is used to specify whether received broadcast telegrams shall be stored in the receive buffer (Enable) or dismissed (Disable). In our example no broadcasts are used. The parameter is therefore set to ‘Disable’.

The parameter “Behavior on receive buffer overflow” is used to specify what should happen if further telegrams are received after the receive buffer is full. If the parameter is set to ‘Overwrite’, the oldest telegrams stored in the buffer are replaced by the received new telegrams. If it is set to ‘Reject’, the data stored in the buffer are kept and the subsequently received telegrams are dismissed instead until sufficient space is available again in the buffer.

Note

In order to avoid receive buffer overflow e.g. due to higher data traffic than expected, enlarge the receive buffer or read the buffer more frequently via the ETH_UDP_REC block.