Advertisement
Guest User

Untitled

a guest
Mar 14th, 2018
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SCL 0.82 KB | None | 0 0
  1. master_modbus(
  2.     xOPEN_SOCKET:= xOpenSocket,
  3.     strIP_ADDRESS:= '172.22.10.59',
  4.     wPORT:= 502,
  5.     bUNIT_ID:= ,
  6.     bFUNCTION_CODE:= 23,
  7.     wREAD_ADDRESS:= 12288,
  8.     wREAD_QUANTITY:= 10,
  9.     ptREAD_DATA:= ADR(readData),
  10.     wWRITE_ADDRESS:= 12388,
  11.     wWRITE_QUANTITY:= 10,
  12.     ptSEND_DATA:= ADR(SendData),
  13.     tTIME_OUT:= ,
  14.     xSEND:= xStart,
  15.     xIS_OPEN=> ,
  16.     wERROR=> ,
  17.     bRESPONSE_UNIT_ID=> );
  18.  
  19. timer1(IN:= xOpenSocket, PT:= t#100ms, Q=> xStartSend, ET=> );
  20.  
  21. CASE iKrok OF
  22.     0:
  23.         SendData[1] := wai1;
  24.         SendData[2] := 100;
  25.         SendData[3] := 200;
  26.         SendData[4] := 300;
  27.         xOpenSocket := TRUE;
  28.         IF master_modbus.xIS_OPEN THEN
  29.             xStart := TRUE;
  30.             iKrok := iKrok +1;
  31.         ELSE
  32.             iKrok := 0;
  33.         END_IF;
  34.  
  35.     1:
  36.         readData[1];
  37.         IF master_modbus.wERROR > 0 THEN
  38.             xdo4 := TRUE;
  39.         ELSE
  40.             xdo4 := FALSE;
  41.             iKrok := 0;
  42.         END_IF;
  43. END_CASE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement