Make your own free website on Tripod.com

General Properties

Retries number of times the message is sent to a slave before the function return an error code.

RaiseError When this property is True, the modbus server functions raise an error instead of returning an error code.

Serial Device Properties

These properties are only for local modbus (serial device) connections.

ByteSize - Specifies the number of bits in the bytes transmitted and received.

BaudRate - Specifies the baud rate

ComPort - Comm serial port

FlowControl - Specifies flow control.

Parity - Specifies the parity scheme to be used.

SilentInterval - silent interval marking the begin and the end of message in ms.

StopBits - number of stop bits.

Timeout - message timeout in ms.

TransmissionMode - Specifies RTU or ASCII transmission mode.

Open Modbus properties

These properties are only for remote modbus (TCP/IP) connections.

Host - Host name

Port - IP Port

 

Retries

syntax

mbusrv.Retries [= NumberofRetries%]

HRESULT Retries([out, retval] short *pVal);
HRESULT Retries([in] short newVal);

Remarks

Get/Set number of times the message is sent to a slave before the function return an error code. For instance, if Retries = 3 , when a messages is sent to a device and occur an error, that message will be sent again more 2 times.

Data Type

Integer

RaiseError

mbusrv.RaiseError [ = {True | False}]

HRESULT RaiseError([out, retval] VARIANT_BOOL *pVal);
HRESULT RaiseError([in] VARIANT_BOOL newVal);

Remarks

When this property is True, the ModbusSrv raise an error instead of returning an error code. By Default this property is False.

example

Sub TestCom()

On Error Goto ComError

mbusrv.RaiseError=True

//It's not needed to verify each call for errors

mbusrv.ForceSingleCoil(17,172,True) ; //force coil 173 ON in slave device 17
mbusrv.PresetSingleRegister(17,1,3) ; //preset register 40002 to 03 in slave device 17

Exit Sub

ComError:

MsgBox " Comm Error " & Err.Description

Exit Sub

end sub

Data Type

Boolean

 

ByteSize

mbusrv.Retries [= ByteSize%]

HRESULT ByteSize([out, retval] short *pVal);
HRESULT ByteSize([in] short newVal);

Remarks

Specifies the number of bits in the bytes transmitted and received. RTU uses 8 and ASCII 7.

See also:

Data Type

Boolean

 

BaudRate

mbusrv.BaudRate [= BaudRate&]

HRESULT BaudRate([out, retval] long *pVal);
HRESULT BaudRate([in] long newVal);

Remarks

Specifies the baud rate , 300 , 1200 , 9600 (bps).

See also:

Data Type

Long

 

ComPort

mbusrv.BaudRate [= ComPort%]

Remarks

Specifies the Comm serial port 1 to 8.

See also:

Data Type

Integer

FlowControl

mbusrv.FlowControl [= FlowControl%]

HRESULT FlowControl([out, retval] short *pVal);
HRESULT FlowControl([in] short newVal);

Remarks

Specifies the flow control. This member can a combination of the following values:
mbFC_NONE No Flow control
mbFC_DTRDSR Hardware Flow Control DTR/CTS
mbFC_RTSCTS Hardware Flow Control DTR/CTS
mbFC_XONXOFF Software Flow Control XON/XOFF

If you use , for instance , software and hardware flow control set this member as mbFC_RTSCTS+mbFC_XONXOFF.

See also:

Data Type

Integer

Parity

mbusrv.Parity [= Parity%]

HRESULT Parity([out, retval] short *pVal);
HRESULT Parity([in] short newVal);

Remarks

Specifies the parity scheme to be used.
Value Meaning
mbEVENPARITY Even
mbMARKPARITY Mark
mbNOPARITY No parity
mbODDPARITY Odd
mbSPACEPARITY Space

See also:

Data Type

Integer

SilentInterval

mbusrv.SilentInterval [= SilentInterval&]

HRESULT SilentInterval([out, retval] long *pVal);
HRESULT SilentInterval([in] long newVal);

Remarks

Silent interval marking the begin and the end of a message in ms.

RTU messages start and end with a silent interval of at least 3.5 character times. For instance , for baud rate of 9600 bps silent interval is 4 ms , but when doing some practical tests this value was increased to 20 ms for correct communication with devices, try to increase this value if you get many communication errors.

When using ASCII set silent interval 500 or 1000 ms.

See also:

Data Type

Long

StopBits

mbusrv.StopBits [= StopBits%]

HRESULT StopBits([out, retval] short *pVal);
HRESULT StopBits([in] short newVal);

Remarks

Specifies the number of stop bits to be used.

Value Meaning
mbONESTOPBIT 1 stop bit
mbONE5STOPBITS 1.5 stop bits
mbTWOSTOPBITS 2 stop bits

Use 1(ONESTOPBIT) stop bit if parity is used and 2(TWOSTOPBITS) bits if no parity.

See also:

Data Type

Integer

 

Timeout

mbusrv.TimeOut [= TimeOut&]

HRESULT TimeOut([out, retval] long *pVal);
HRESULT TimeOut([in] long newVal);

Remarks

Time-out period for slave response in ms.

See also:

Data Type

Long

 

TransmissionMode

mbusrv.TransmissionMode [= TransmissionMode%]

HRESULT TransmissionMode([out, retval] short *pVal);
HRESULT TransmissionMode([in] short newVal);


Remarks

Modbus use either of two transmission modes: ASCII or RTU. This member can be one of the values below:

mbMODE_RTU RTU transmission mode
mbMODE_ASCII ASCII transmission mode

See also:

Data Type

Integer

 

TcpPort

mbusrv.TcpPort [= TcpPort&]

HRESULT TcpPort([out, retval] long *pVal);
HRESULT TcpPort([in] long newVal);

Remarks:

Get/Set IP port. Open modbus protocol use port 502 as a default.

Data Type

Long

Host

mbusrv.Host [= Host$]

HRESULT Host([out, retval] BSTR *pVal);
HRESULT Host([in] BSTR newVal);

Remarks:

Get/Set Host name. Can be numeric IP format like "198.345.125.30" or a name like "pep1.modicon.com".

 

Data Type

String