Comm

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: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CRC16Table = []uint16{}/* 256 elements not displayed */

CRC16Table CRC16查询表

Functions

func BytesCombine

func BytesCombine(pBytes ...[]byte) []byte

BytesCombine 字节切片合并函数

func CRC16CheckSum

func CRC16CheckSum(data []byte) (crc16byte []byte)

CRC16CheckSum CRC16校验函数

func DataChange

func DataChange(Input []byte, Order string) (Data []byte)

func Uint16ToByte

func Uint16ToByte(value uint16) (data []byte)

Types

type ModbusMaster

type ModbusMaster interface {
	Open()
	// ReadCoilStatus 读取线圈状态
	ReadCoilStatus(Id uint8, RegisterAddress, Length uint16) (Data []bool, err error)
	// ReadInputStatus 读取输入状态
	ReadInputStatus(Id uint8, RegisterAddress, Length uint16) (Data []bool, err error)
	// ReadHoldingRegister 读取保持寄存器
	ReadHoldingRegister(Id uint8, RegisterAddress, Length uint16) (Data []byte, err error)
	// ReadInputRegister 读取输入寄存器
	ReadInputRegister(Id uint8, RegisterAddress, Length uint16) (Data []byte, err error)
	// WriteSingleCoilStatus 写单个线圈
	WriteSingleCoilStatus(Id uint8, RegisterAddress uint16, Data bool) (err error)
	// WriteMultipleCoilStatus 写多个线圈
	WriteMultipleCoilStatus(Id uint8, RegisterAddress uint16, Data []bool) (err error)
	// WriteSingleHoldingRegister 写单个保持寄存器
	WriteSingleHoldingRegister(Id uint8, RegisterAddress uint16, Data []byte) (err error)
	// WriteMultipleHoldingRegister 写多个保持寄存器
	WriteMultipleHoldingRegister(Id uint8, RegisterAddress uint16, Data []byte) (err error)
}

type ModbusSlave

type ModbusSlave interface {
}

type Option

type Option struct {
	Ip            string
	AutoReconnect bool
	Serial        string
	Baud          int
	Parity        byte
	StopBits      byte
	Timeout       int
}

Jump to

Keyboard shortcuts

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