This commit is contained in:
Forsworns 2022-02-15 14:09:03 +08:00
parent f0b2886a03
commit 72a90da815
3 changed files with 9 additions and 6 deletions

View File

@ -18,7 +18,7 @@ static int CliConnect()
res = Cli_ConnectTo(Client, Address, Rack, Slot);
if (Check(Client, res, "UNIT Connection"))
{
Cli_GetPduLength(Client, Requested, Negotiated);
Cli_GetPduLength(Client, &Requested, &Negotiated);
printf(" Connected to : %s (Rack=%d, Slot=%d)\n", Address, Rack, Slot);
printf(" PDU Requested : %d bytes\n", Requested);
printf(" PDU Negotiated : %d bytes\n", Negotiated);
@ -39,20 +39,20 @@ void PerformTasks()
Buffer[0] = 0x01;
Buffer[3] = 0x14;
Cli_WriteAndDump(Client, Area, DBNumber, Start, Amount, WordLen, Buffer, "write DB");
PrivTaskDelay(29);
PrivTaskDelay(5*1000);
}
if(bRead){
Cli_ReadAndDump(Client, Area, DBNumber, Start, Amount, WordLen, Buffer, "read DB");
PrivTaskDelay(1);
PrivTaskDelay(15*1000);
}
if(bWrite){
memset(Buffer, 0, sizeof(Buffer));
Cli_WriteAndDump(Client, Area, DBNumber, Start, Amount, WordLen, Buffer, "write DB");
PrivTaskDelay(29);
PrivTaskDelay(5*1000);
}
if(bRead){
Cli_ReadAndDump(Client, Area, DBNumber, Start, Amount, WordLen, Buffer, "read DB");
PrivTaskDelay(1);
PrivTaskDelay(15*1000);
}
}
}

View File

@ -506,10 +506,13 @@ int S7API Cli_GetLastError(S7Object Client, int &LastError)
//---------------------------------------------------------------------------
int S7API Cli_GetPduLength(S7Object Client, int &Requested, int &Negotiated)
{
printf("before get pdu length\n");
if (Client)
{
Negotiated=PSnap7Client(Client)->PDULength;
printf("Negotiated length %d\n", Negotiated);
Requested =PSnap7Client(Client)->PDURequest;
printf("Requested length %d\n", Requested);
return 0;
}
else

View File

@ -3292,7 +3292,7 @@
* SOCKETS_DEBUG: Enable debugging in sockets.c.
*/
#if !defined SOCKETS_DEBUG || defined __DOXYGEN__
#define SOCKETS_DEBUG LWIP_DBG_ON
#define SOCKETS_DEBUG LWIP_DBG_OFF
#endif
/**