ModbusTcp

package module
v0.0.0-...-6d37f7b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModbusTcp

type ModbusTcp struct {

	//IP地址加端口
	Ip string
	//是否启用自动重连
	AutoReConnect bool
	//超时
	Timeout int
	// contains filtered or unexported fields
}

func (*ModbusTcp) Open

func (m *ModbusTcp) Open()

Open 创建TCP链接

func (*ModbusTcp) ReadCoilStatus

func (m *ModbusTcp) ReadCoilStatus(Id uint8, RegisterAddress, Length uint16) (Data []bool, err error)

ReadCoilStatus 读取线圈状态

func (*ModbusTcp) ReadHoldingRegister

func (m *ModbusTcp) ReadHoldingRegister(Id uint8, RegisterAddress, Length uint16) (Data []byte, err error)

ReadHoldingRegister 读取保持寄存器

func (*ModbusTcp) ReadInputRegister

func (m *ModbusTcp) ReadInputRegister(Id uint8, RegisterAddress, Length uint16) (Data []byte, err error)

ReadInputRegister 读取输入寄存器

func (*ModbusTcp) ReadInputStatus

func (m *ModbusTcp) ReadInputStatus(Id uint8, RegisterAddress, Length uint16) (Data []bool, err error)

ReadInputStatus 读取输入状态

func (*ModbusTcp) WriteMultipleCoilStatus

func (m *ModbusTcp) WriteMultipleCoilStatus(Id uint8, RegisterAddress uint16, Data []bool) (err error)

WriteMultipleCoilStatus 写多个线圈

func (*ModbusTcp) WriteMultipleHoldingRegister

func (m *ModbusTcp) WriteMultipleHoldingRegister(Id uint8, RegisterAddress uint16, Data []byte) (err error)

WriteMultipleHoldingRegister 写多个保持寄存器

func (*ModbusTcp) WriteSingleCoilStatus

func (m *ModbusTcp) WriteSingleCoilStatus(Id uint8, RegisterAddress uint16, Data bool) (err error)

WriteSingleCoilStatus 写单个线圈

func (*ModbusTcp) WriteSingleHoldingRegister

func (m *ModbusTcp) WriteSingleHoldingRegister(Id uint8, RegisterAddress uint16, Data []byte) (err error)

WriteSingleHoldingRegister 写单个保持寄存器

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL