modbus

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToFloat32

func BytesToFloat32(b []byte) float32

BytesToFloat32 字节转float32

字节序是大端,低字节在低地址,高字节在高地址

等同于c语言

data = buff[i++]; data <<= 8;

data += buff[i++];data <<= 8;

data += buff[i++] ; data <<= 8;

data += buff[i++];

val= *(float*)&data;

func Float32ToBytes

func Float32ToBytes(f float32) [4]byte

Float32ToBytes 浮点数转成字节 按大端字节序,高位在低地址,地位在高地址

Types

type ModbusClient

type ModbusClient struct {
	// contains filtered or unexported fields
}

func NewModbusClient

func NewModbusClient(addr string) (*ModbusClient, error)

func (*ModbusClient) Close

func (client *ModbusClient) Close()

Close 关闭

func (*ModbusClient) Connect

func (client *ModbusClient) Connect() error

Connect 连接modbus

func (*ModbusClient) ReadHoldingRegistersBytes

func (client *ModbusClient) ReadHoldingRegistersBytes(slaveID byte, address, quantity uint16) ([]byte, error)

ReadHoldingRegistersBytes 读取寄存器值

Jump to

Keyboard shortcuts

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