matlab modbus,Create MODBUS object

Transport — Physical transport layer for device communication

character vector | string

Physical transport layer for device communication, specified as a

character vector or string. Specify transport type as the first argument

when you create the modbus object. You must set the

transport type as either 'tcpip' or

'serialrtu' to designate the protocol you want to

use.

Example:m = modbus('tcpip',

'192.168.2.1')

Data Types:char

DeviceAddress — IP address or host name of MODBUS server

character vector | string

IP address or host name of MODBUS server, specified as a character

vector or string. If transport is TCP/IP, it is required as the second

argument during object creation.

Example:m = modbus('tcpip',

'192.168.2.1')

Data Types:char

Port — Remote port used by MODBUS server

502 (default) | double

Remote port used by MODBUS server, specified as a double. Optional as

a third argument during object creation if transport is TCP/IP. The

default of 502 is used if none is specified.

Example:m =

modbus('tcpip','192.168.2.1',308)

Data Types:double

'Port' — Serial port MODBUS server is connected to

character vector | string

Serial port MODBUS server is connected to, e.g.

'COM1', specified as a character vector or

string. If transport is Serial RTU, it is required as the second

argument during object creation.

Example:m =

modbus('serialrtu','COM3')

Data Types:char

Name-Value Pair Arguments

Specify optional

comma-separated pairs of Name,Value arguments. Name is

the argument name and Value is the corresponding value.

Name must appear inside quotes. You can specify several name and value

pair arguments in any order as

Name1,Value1,...,NameN,ValueN.Example:m =

modbus('serialrtu','COM3','Timeout',20)

There are a number of name-value pairs that can be used when you create the

modbus object, including the two shown here. Some can

only be used with either TCP/IP or Serial RTU, and some can be used with both

transport types. For a list of all the properties and how to set them both

during and after object creation, see Configure Properties for MODBUS Communication.

'Timeout' — Maximum time in seconds to wait for a response from the MODBUS server

10 (default) | double

Maximum time in seconds to wait for a response from the MODBUS

server, specified as the comma-separated pair consisting of

'Timeout' and a positive value of type

double. The default is 10.

You can change the value either during object creation or after you

create the object.

Example:m =

modbus('serialrtu','COM3','Timeout',20)

Data Types:double

'NumRetries' — Number of retries to perform if there is no reply from the server after a timeout

double

Number of retries to perform if there is no reply from the server

after a timeout, specified as the comma-separated pair consisting of

'NumRetries' and a positive value of type

double. If using the Serial RTU transport,

the message is resent. If using the TCP/IP transport, the connection

is closed and reopened. You can change the value either during

object creation, or after you create the object.

Example:m =

modbus('serialrtu','COM3','NumRetries',5)

Data Types:double

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值