Data Sheet

© Copyright 2013 WIZnet Co.,Ltd. All rights reserved.
61
iEthernet
W5200
/* set SEND command */
Sn_CR = SEND;
}
Check complete sending / Timeout
To transmit the next data, user must check that the prior SEND command is completed.
The larger the data size, the more time to complete the SEND command. Therefore,
the user must properly divide the data to transmit. The ARP
TO
can occur when user
transmits UDP data. If ARP
TO
occurs, the UDP data transmission has failed.
First method :
{
/* check SEND command completion */
while(Sn_IR(SENDOK)==‘0’) /* wait interrupt of SEND completion */
{
/* check ARP
TO
*/
if (Sn_IR(TIMEOUT)==‘1’) Sn_IR(TIMEOUT)=‘1’; goto Next stage;
}
Sn_IR(SENDOK) = ‘1’; /* clear previous interrupt of SEND completion */
}
Second method :
{
If (Sn_CR == 0x00) transmission is completed.
If (Sn_IR(TIMEOUT bit) == ‘1’) goto next stage;
/* In this case, if the interrupt of Socket n is activated, interrupt occurs. Refer to
Interrupt Register(IR), Interrupt Mask Register (IMR) and Socket n Interrupt Register (Sn_IR).
*/
}
Check Finished / SOCKET close
If user doesn’t need the communication any more, close the Socket n .
{
/* clear remained interrupts */
Sn_IR = 0x00FF;
IR(n) = ‘1’;
/* set CLOSE command */
Sn_CR = CLOSE;
}