Skip to content

DiracM/LibModbus.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibModbus.jl

Build Status Codecov

Julia wrapper for Libmodbus library

Installation

Within julia, execute

using Pkg; Pkg.add("LibModbus")

Usage example

julia> ctx = RtuContext(raw"\\.\COM10", 9600, :even, 8, 1)
RtuContext(serial_port \\.\COM10, baud 9600, parity even, data_bits 8, stop_bits 1)

julia> connect(ctx)
0

julia> ctx.slave_address=1
1

julia> res=read_input_registers(ctx, 0, 15)
read input registers:
15-element Vector{UInt16}:
 0xd9f6
 0x00fc
 0xded1
 0x806a
 0xbe81
 0xcf72
 0xbfae
 0x7487
 0xb42d
 0xe370
 0xc9d8
 0x67a9
 0xeb4f
 0xc288
 0xd686

julia> disconnect(ctx)

If you reassigned ctx while the serial port is still connected, call GC.gc() to trigger the finalizer on ModbusContext.

See the test directory for more usage examples.

About

Julia wrapper for Libmodbus library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%