Register   |   Login

Print

How to set the timeout waiting for a response from the slave device?

How to set the timeout waiting for a response from the slave device?

Hi, all !!!

How to set the timeout waiting for a response from the slave device?

For example, in the documentation:

"ADAM 5510 Series
PC-based Programmable Controller
User's Manual "

on page 5-158 states:
Quote:

Error_Code

Syntax:
int Error_Code (void);

Description:
When following function call gets error return, this function can get the
exact error code for user.

ADAMRTU_ForceMultiCoils (), ADAMRTU_ForceSingleCoil (),
ADAMRTU_PresetMultiRegs (), ADAMRTU_PresetSingleReg (),
ADAMRTU_ReadCoilStatus (), ADAMRTU_ReadHoldingRegs (),
ADAMRTU_ReadInputRegs (), ADAMRTU_ReadInputStatus ()

Parameters Description
None

Return value:
NULL No exception error returned
Erro Code Exception error returned

Error code:
91 Invalid Response
92 COM Port Initial or Mode Error
93 COM Port Time Out
Interested in the error code 93!

Questions:

1. What is the value of timeout mode Modbus RTU at the default port?
2. How can I set a different timeout mode Modbus RTU port?

PS: BUT, the description of: Modbus TCP Client Functions, for example, on page 5-186
in functions (etc.):
Copy to clipboard
Code:

  int ADAMTCP_ForceMultiCoils (SOCKET * SO, int WaitMilliSec,
                              int Slave_Addr, int CoilIndex, int TotalPoint,
                              int TotalByte, unsigned char szData []);
available option: int WaitMilliSec, BUT in the functions of RTU it is not!

[ Last edited by kuzulis at 2009-9-23 13:36 ]
Share |

TOP

Hello,

After you setup the COM port with "Modbus_COM_Init" you can manipulate the timeout setting with the "ADAM_SetCOMTimeout" or see the current value with "ADAM_GetCOMTimeout".  The setting is for all RTU traffic on the COM port, not individual messages.

You can see the functions definitions in the RTU.h file.
Share |

TOP

Thank you very much!  
Share |

TOP

Quick search in Advantech Support Portal