hz.tools/gpib: bindings to GPIB (IEEE-488)
Paul Tagliamonte 2021-11-26 projectGPIB (otherwise known as HP-IB or IEEE-488) is a connector used in lab test equipment to allow headless control of devices on the workbench.
The hz.tools/gpib
library needs the GPIB kernel driver
such as this packaging installed,
as well as gpib_config
having been run to configure the GPIB devices.
Code needed to work with GPIB devices in Go can be found at github.com/hztools/go-gpib, and imported by Go source as hz.tools/gpib.
package main
import (
"fmt"
"hz.tools/gpib"
"hz.tools/gpib/device/hp437"
)
func main() {
dev, err := gpib.Open(0, 0, 13, nil)
if err != nil {
panic(err)
}
defer dev.Close()
hp := hp437.New(dev)
pow, err := hp.Power()
if err != nil {
panic(err)
}
fmt.Printf("%.3f\n", pow)
}
The pad
, sad
and device
arguments to gpib.Open
can be checked
using the findlisteners
tool packaged with the gpib
module.
You can see a post I wrote up using this library using an HP 437B Power Meter.