ok, i write program in ST, can you tell me where i did the mistake? thanks..
---------------------------------------------------------
CTRL_PWM(CI:=0.5,F:=1);
IP_CONTROL2(IP_C:=IP_C,S_BUF:=S_BUF,R_BUF:=R_BUF);
CASE state OF
0: (* On Wait for release *)
IF CTRL_PWM.Q THEN
state := 10;
IP_STATE := 1;(* Sign on *)
END_IF;
10: (* Wait for clearance to access for connection and sending content *)
IF IP_STATE = 1 THEN (* access permitted? *)
(* IP set up data traffic *)
IP_C.C_PORT := 1201; (* enter port number *)
IP_C.C_IP := IP4_DECODE('192.168.0.5'); (* Enter IP *)
IP_C.C_MODE := 1; (* Mode: UDP+ACTIVE+Port+IP *)
IP_C.C_ENABLE := TRUE; (* Release connection *)
IP_C.TIME_RESET := TRUE; (*Reset TIME monitoring * *)
IP_C.R_OBSERVE := TRUE; (* Monitor data receive *)
R_BUF.SIZE:= 0; (* Reset Home length *)
(* Send data register *)
S_BUF.BUFFER[0] := BYTE#16#11;
S_BUF.BUFFER[1] := BYTE#16#11;
(* Etc. ... *)
S_BUF.SIZE := 2; (* enter send length *)
state := 30;
END_IF;
30:
IF IP_C.ERROR <> 0 THEN
error:=IP_C.ERROR;
state := 00;
IP_STATE := 2;
ELSIF S_BUF.SIZE = 0 AND R_BUF.SIZE >= 0 THEN
R_BUF1.BUFFER := R_BUF.BUFFER;
(* evaluate received data *)
(* Logout - release access for other *)
IP_STATE := 2;
state := 00; (* process end *)
END_IF;
END_CASE;
IP_FIFO(FIFO:=IP_C.FIFO,STATE:=IP_STATE,ID:=IP_ID);
(*IP_C.FIFO:=IP_FIFO.FIFO;
IP_STATE := IP_FIFO.STATE;
IP_ID:=IP_FIFO.ID;*)