Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved. 
56
iEthernet 
W5200
IP  address.  At  this  time,  there  is  no  need  to  get  the  destination  hardware  address 
about destination A, B and C, and also ARP
TO
is not occurred. 
Note: Broadcast IP   
=>  The  Broadcast  IP  address  can  be  obtained  by  performing  a  bit-wise  logical  OR 
operation between the bit complement of the subnet mask and the host’s IP address. 
ex> If IP:”222.98.173.123” and the subnet mask:“255.255.255.0”, broadcast IP is 
“222.98.173.255” 
Description  Decimal  Binary 
HOST IP  222.098.173.123
11011110.01100010.10101101.01111011 
Bit Complement Subnet mask  000.000.000.255
00000000.00000000.00000000.11111111 
Bitwise OR  -  - 
Broadcast IP  222.098.173.255
11011110.01100010.10101101.11111111 
SOCKET Initialization 
For the UDP data communication, SOCKET initialization is required; it opens the 
SOCKET. The SOCKET open process is as followed. At first, choose one SOCKET among 
the  8  SOCKETS  of  W5200,  then  set  the  protocol  mode  (Sn_MR(P3:P0))  of  the  chosen 
SOCKET and set the source port number Sn_PORT0 for communication. Finally, execute 
the  OPEN  command.  After  the  OPEN  command,  the  state  of  Sn_SR  is  changed  to 
SOCK_UDP. Then the SOCKET initialization is complete. 
{ 
START: 
Sn_MR = 0x02;      /* sets UDP mode */ 
Sn_PORT0 = source_port;    /* sets source port number */ 
Sn_CR = OPEN;      /* sets OPEN command */ 
/* wait until Sn_SR is changed to SOCK_UDP */ 
if (Sn_SR != SOCK_UDP) Sn_CR = CLOSE; goto START; 
} 
Check received data 
Check the  reception of UDP  data  from  destination.  User can also check for  received 
data  via  TCP  communication.  It  is  strongly  recommended  to  use  the  second  method 
because of the same reasoning from TCP. Please refer to the “5.2.1.1 TCP SERVER”. 
First method : 
{ 
if (Sn_IR(RECV) == ‘1’) Sn_IR(RECV) = ‘1’; goto Receiving Process stage; 










