xPC Target    

UDP Receive Block

The Receive block has two output ports. The first port is the actual output of the received data as a vector of uint8 while the second one is a flag indicating whether any new data has been received. This port outputs a value of 1 for the sample when there is new data and a 0, otherwise. The default behavior of the Receive block is to keep the previous output when there is no new data. This behavior can be modified by the user by using the second port to flag when there is new data.

The Block Parameters for the Review block are shown below.

The IP address to receive from can be left with the default value of 0.0.0.0. This will accept all UDP packets from any other computer. Otherwise, if set to a specific IP address, only packets arriving from that IP address will be received. The IP port to receive from is the port which the block will accept data from. The other end of the communication will have to send data to the port specified here. The output port width is the width of the acceptable packets. This may be obtained when designing the other side (send side) of the communication. The sample time may be set to -1 for inheritable sample time, but it is recommended that this be set to some specific (large) value to eliminate chances of dropped packets. This is especially true when you are using a small base sample time.


  UDP Communication Setup UDP Send Block